summaryrefslogtreecommitdiffstats
path: root/libass/ass_coretext.c
Commit message (Collapse)AuthorAgeFilesLines
* fontselect: add fallback and substitution callbacksGrigori Goronzy2015-07-101-2/+4
| | | | | Add callbacks to introduce more sane fallback handling and font alias substitutions.
* fontselect: expose a fontprovider selection APIStefano Pigozzi2015-07-101-1/+2
| | | | | | | | | Allow the user of libass to select the font provider from ass_set_fonts. This API change actually doesn't break client code which was passing `fc=1`; now the same value will autodetect a usable font provider. Also add an api to list available font providers as that is useful for client code to show drop down menus with a font provider to choose from.
* coretext: fix conversion from CFStringRef to utf8 bufferStefano Pigozzi2015-07-101-3/+5
| | | | | | The code incorrectly assumed that the utf8 characters could always be represented with only one byte. This commit queries CFStringRef instances for the actual amount of bytes needed.
* coretext: also lazy load fonts based on Family and PostScript namesStefano Pigozzi2015-07-101-8/+21
| | | | | Previously, the lazy load of fonts was only using display name. Also use the other names available through the CoreText API (FamilyName and PostScriptName).
* fontselect: coretext: allow to match fontname using the providerStefano Pigozzi2015-07-101-3/+58
| | | | | | | | | | | | | | | | | | | | | | Not all APIs cache everything the same way that fontconfig does. This allows to first perform a match based on the font name and then score the matched fonts using the common code using and in memory database approach. The benefit is the application doesn't have to load all of the fonts and query for weight, slant, width, path and fullnames. I left both code paths inside ass_coretext.c. This allows to test matching problems and have a term of comparison with the slower implementation. To activate it one just has to flip the CT_FONTS_EAGER_LOAD define to 1. Here are some benchmarks with a pretty typical OS X font library of ~600 fonts and using Libass's test program to load a script with 'Helvetica Neue': CT_FONTS_EAGER_LOAD=0 0.04s user 0.02s system 79% cpu 0.081 total CT_FONTS_EAGER_LOAD=1 0.12s user 0.06s system 44% cpu 0.420 total
* fontselect: coretext: allow selection based on PostScript nameStefano Pigozzi2015-07-101-5/+10
| | | | | | | | | | | Up until now fontselect used the face index to identify which font to load from a font collection. While this pretty convenient when using something freetype based like fontconfig, it seems to be somewhat freetype specific. CoreText uses the PostScript name as the unique identifier of a font. This commit allows to use that instead of the index to decide which face to open with FT_New_Face. To use the PostScript name the provider must return a -1 index and the PostScript name.
* fontselect: implement a coretext font providerStefano Pigozzi2015-07-101-0/+217
Fontconfig is known to be very slow on OS X and Windows, this has to do with the extremely prohibitive cache times (which are getting even longer with latest versions of Fontconfig). This commits starts to address the problem by using CoreText on OS X to load the font data. The commit uses the simplest possible approach to load all of the data in memory and then use it to match. This causes a somewhat slow startup time (around ~400ms on my i7) but it is already better than waiting *minutes* for Fontconfig to cache the fonts data. A later commit will improve the speed of the match by using a hybrid approach that lazy loads in the libass database only the necessary fonts.