summaryrefslogtreecommitdiffstats
path: root/libass/ass_fontconfig.c
Commit message (Collapse)AuthorAgeFilesLines
* fontconfig: add font fallback callbackGrigori Goronzy2015-07-101-17/+98
| | | | | This creates a sorted list of fallback fonts and reuses it, for speed. Font sorting is very slow.
* fontselect: add fallback and substitution callbacksGrigori Goronzy2015-07-101-0/+2
| | | | | Add callbacks to introduce more sane fallback handling and font alias substitutions.
* Fix warningsGrigori Goronzy2015-07-101-1/+2
|
* fontselect: coretext: allow selection based on PostScript nameStefano Pigozzi2015-07-101-1/+2
| | | | | | | | | | | 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.
* Support multiple font family namesGrigori Goronzy2015-07-101-9/+12
| | | | | | Some fonts use localized family names, especially CJK fonts, which often have English and Japanese or Chinese names. Handle these cases just like full names.
* Add support for font width propertyGrigori Goronzy2015-07-101-6/+5
| | | | | | Add a width field to metadata. This is used for sorting fonts as well. Fixes wrong matches with different width variants in the same font family.
* Use TrueType font weight scaleGrigori Goronzy2015-07-101-2/+12
| | | | | | | | | | fontconfig uses an unusual scale from 0-215 for the font weight. It looks like it is somewhat derived from the typographic scale some font families use, but is still rather nonstandard. Nowadays the TrueType scale from 100-900 seems to be standard. CSS uses it, for example. However, most importantly, VSFilter also uses the TrueType scale. So let's use it in libass, too.
* Custom font matching and font sourcesGrigori Goronzy2015-07-101-497/+96
| | | | | | | Implement a simple font sorter (FontSelector) and an interface to deal with multiple font sources (FontProvider). Unfinished business, but works for the most part. Currently the only implemented FontProvider uses fontconfig.
* More malloc checkingwm42014-11-201-0/+3
| | | | | | | | Don't crash if running out of memory when allocating per-glyph data during shaping. Also some fixes to initialization. The caller of ass_fontconfig.c/match_fullname() actually handles a NULL return value correctly.
* Print debug message when loading a memory fontwm42014-11-151-0/+2
|
* Check more mallocswm42014-11-091-3/+13
| | | | This is just a start and gets most easy ones.
* fontconfig: don't compact the sorted font listOleg Oshmyan2014-01-241-1/+1
| | | | Some broken fonts are dropped by Fontconfig during compacting.
* Improve font mismatch messagewm42013-06-221-5/+12
| | | | | | | | | | | | | | | | | | | | | | | Example for an old message: [ass] fontconfig: Selected font is not the requested one: 'DejaVu Sans' != 'Wingdings' it was hard to tell which was the selected and the requested font. Also, it's not really clear what's the problem at all. Why would it select a different font? Obviously, the issue is that it can't find the font in the first place. Now it prints: [ass] fontconfig: cannot find glyph U+006C in font 'Wingdings', falling back to 'DejaVu Sans' Or if the code parameter for select_font() is 0: [ass] fontconfig: cannot find font 'Wingdings', falling back to 'DejaVu Sans' I'm not sure if this message is really accurate in all cases. It's possible that there are more reasons for failure. But all things considered, this should be easier to understand.
* fontconfig: remove default "lang" setting from patternsUoti Urpala2013-05-141-0/+8
| | | | | | | | | | | | | | Fontconfig defaults set the "lang" value in patterns, and it then prefers fonts which are listed as supporting this language. The default value may not match actual script language, and even a setting of "en" for English subtitle can cause problems. Remove the "lang" setting from patterns used to find fonts. A file had a normal and an oblique version of the same font attached, with different character set coverage: the normal version lacked some non-ascii characters that fontconfig includes in its list of characters required for English support. As a result, the oblique version was picked for what was supposed to be normal text.
* Fix fontconfig disabled at runtimeGrigori Goronzy2011-02-161-1/+2
| | | | | | MPlayer is able to use this configuration with the -nofontconfig flag; this fixes crashes in case no font is available. Fixes a crash at uninit as well.
* Relicense to ISCGrigori Goronzy2010-09-281-12/+10
| | | | | | In hope to make libass as useful as possible, relicense libass to ISC, a simplified 2-clause BSD license. All contributors who provided non-trivial changes have granted their permission for this.
* Get rid of NULL checks for freeGrigori Goronzy2010-08-091-5/+4
| | | | | The useless "if (foo) free(foo)" idiom is all over the place, just get rid of it finally...
* POSIX compliance: add strings.h include where appropriateGrigori Goronzy2010-08-071-0/+1
| | | | | strcasecmp/strncasecmp needs strings.h according to POSIX, so add this include where these occur.
* Fix match_fullname loopGrigori Goronzy2010-07-111-1/+2
| | | | | Let's loop over everything and not just the outline check. *sigh* Fixes a crash reported by lachs0r on IRC.
* Improve fullname matchingGrigori Goronzy2010-06-261-5/+18
| | | | | | | | Only match outline fonts and take slant and weight into consideration. This matches all font faces which have at least the slant/weight that is requested. This fixes issue 23; however, corner cases can be constructed in which wrong fonts will be matched, if multiple slant/weight variants of the same font exist, but that is very unlikely in practice.
* Support multiple faces per attachment correctlyGrigori Goronzy2010-04-171-1/+1
| | | | | | | | Store the real font face id instead of using 0 all the time and use the real font face id for font lookup as well. This makes font attachments with multiple faces work correctly. Thanks to ubitux and uau!
* Cosmetics: remove underscore prefix from _select_font functionGrigori Goronzy2010-02-131-4/+4
|
* fontconfig: consider fullname for matching fontsGrigori Goronzy2010-02-121-3/+61
| | | | | | | Additionally match fonts via the fullname (or name for humans) and prefer these matches. Previously, libass matched against the family name only and this name can be completely different from the fullname (which is used by VSFilter!).
* Update documentation to reflect fontconfig changesGrigori Goronzy2010-02-121-2/+2
|
* Adjust a few message levels and message textsGrigori Goronzy2010-01-191-1/+1
|
* Remove support for fontconfig < 2.4.2Grigori Goronzy2010-01-081-119/+1
| | | | | Get rid of compatibility code and #ifdefs for very old fontconfig versions. libass now requires at least version 2.4.2.
* Fix libass w/o fontconfigGrigori Goronzy2009-10-111-1/+1
| | | | | | | | | Make sure that libass does not crash even if no default font is provided. Additionally, fix crashes related to drawings in this and possibly other unusual cases. Document the default_path and default_family parameters of ass_set_fonts.
* strdup() fontconfig strings freed by callerGrigori Goronzy2009-10-081-3/+5
| | | | | fontconfig_select() can return the path to the default font as fallback, but the caller frees it later. Return a copy with strdup() instead.
* Fix build without fontconfigAlexis Ballier2009-08-121-0/+2
|
* Rename typedefs (breaks API)Grigori Goronzy2009-08-061-18/+18
| | | | | | Rename all typedefs from the convention foo_bar_t, which can possibly conflict with POSIX types, to FooBar (and ASS_FooBar for public API typedefs). Fix formatting and stray comments while at it.
* Clean up typedefs/structsGrigori Goronzy2009-07-281-1/+1
| | | | | Remove useless _s suffix from struct names and remove struct name where not needed (only the typedef'd struct is used). Clean up API headers.
* Fix fontconfig memory leaksGrigori Goronzy2009-07-241-4/+2
| | | | | | | | | | | | Do not manually use FcConfigFilename; passing a NULL pointer to FcConfigParseAndLoad is just as effective and also avoids a memory leak since the string allocated by FcConfigFilename was never freed. Free FcConfig instance in fontconfig_done; since we're not using the default configuration anymore it doesn't make sense to keep the configuration around. Leaks were found by valgrind/memcheck.
* Fix compilation without fontconfigGrigori Goronzy2009-07-241-3/+5
| | | | | Adjust fontconfig_select and fontconfig_update stubs for the recent changes.
* Fallback to default fontconfig configurationGrigori Goronzy2009-07-221-1/+9
| | | | | | | | If parsing or loading the fontconfig configuration file, either using the default or a specified one, fails, try to load the default fontconfig configuration. This triggers loading a fallback configuration if no configuration file is available at all. A warning message is emitted to notify the user about this.
* Improve fontconfig setupGrigori Goronzy2009-07-171-12/+25
| | | | | | | Add an argument to ass_set_fonts for controlling whether the fontconfig font cache should be built/updated. Add a new function ass_fonts_update to make it possible to update fonts later on. Additionally, stop using FcConfigSetDefault for thread safety.
* Message callback funtionalityGrigori Goronzy2009-07-111-36/+39
| | | | | | | | | | | Introduce functionality for providing a message callback that is used for passing messages to the controlling application instead of simply printing them to standard output. The function pointer to the callback is stored in the ass_library_t instance. ass_msg needs access to it, so in many places the library instance needs to be passed around now. The default behavior is the old one: messages of MSGL_INFO or lower are printed to the standard output, prefixed with "[ass]".
* Replace string defines with real stringsGrigori Goronzy2009-07-111-35/+32
| | | | | | Instead of referencing string defines from help_mp.h, use the strings directly in ass_msg. Consequently, help_mp.h is useless and can be deleted.
* Include ass_utils.h instead of mputils.hGrigori Goronzy2009-06-271-1/+1
|
* Rename various non-static functionsGrigori Goronzy2009-06-271-1/+1
| | | | | Rename a few functions to avoid symbol clashes. Clean up mputils.h.
* Rename mp_msg to ass_msgGrigori Goronzy2009-06-271-21/+21
|
* ass_set_fonts: optionally pass fontconfig config pathgreg2009-06-201-5/+13
| | | | | | | Optionally pass a fontconfig config file to the fontconfig initialisation. This changes the public API.
* Silence warnings introduced by -Wallgreg2009-06-201-1/+1
| | | | | Silence a few warnings that should be harmless and were introduced by the -Wall option.
* Reindent all source code.greg2009-06-201-380/+408
| | | | | | | | | | | | | | | Reindent complete source code (*.c, *.h) with indent, the exact command line being: indent -kr -i4 -bap -nut -l76 *.c *.h From now on, new code should use (more or less) K&R style, only spaces and no tabs, 4 spaces indent width. Avoid long lines. Fix function declaration pointer spacing. Remove spaces that were added to many function declarations by indent, like some_func(foo_t * bar). Fix indenting of macros in ass.c
* whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-15/+15
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: reindent.eugeni2009-03-161-5/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28977 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix uninitialized memory access in ass_fontconfig.eugeni2009-03-161-0/+2
| | | | | | | This fixes hangups with plaintext subtitles happening when the first subtitle is about to be displayed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28976 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: reindent.eugeni2009-03-081-25/+25
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28896 b3059339-0415-0410-9bf9-f77b7e298cf2
* Treat -font/-subfont as Fontconfig pattern in libass.eugeni2009-03-081-11/+20
| | | | | | Patch by Adrian Stutz (adrian sttz ch). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28895 b3059339-0415-0410-9bf9-f77b7e298cf2
* Consistently use NULL for pointers instead of 0.reimar2008-11-021-6/+6
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27876 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fallback to non-fontconfig behaviour when fontconfig initialization fails.reimar2008-11-021-5/+3
| | | | | | | Also fixes a memleak in that case, bug #1313. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27875 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rename font-related preprocessor directives.diego2008-08-071-4/+4
| | | | | | | Switch them from a HAVE_ to a CONFIG_ prefix. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27425 b3059339-0415-0410-9bf9-f77b7e298cf2
* Check if the font set returned from FcFontSort in not NULL.eugeni2008-06-231-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27128 b3059339-0415-0410-9bf9-f77b7e298cf2
* Reindent.eugeni2008-06-231-35/+36
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27127 b3059339-0415-0410-9bf9-f77b7e298cf2
* Only use application font dir if library->fonts_dir is not NULL.eugeni2008-06-231-0/+2
| | | | | | | | This can be the case if ass_set_fonts_dir() call is omitted, results in segfault. Never happens in the current MPlayer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27126 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: reindent after the last commit.eugeni2008-05-221-25/+25
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26857 b3059339-0415-0410-9bf9-f77b7e298cf2
* Read all faces of a memory font, not just the first one.eugeni2008-05-221-1/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26856 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix compilation with FontConfig <= 2.2.96.eugeni2008-05-221-0/+2
| | | | | | | | It lacks FcPatternRemove function. The code will work fine, but produce an incorrect "Selected font is not the requested one" warning in rare cases. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26851 b3059339-0415-0410-9bf9-f77b7e298cf2
* Speak of libass instead of MPlayer in the libass license headers.diego2008-05-141-4/+4
| | | | | | | | We already use LIBASS_ prefixes for the multiple inclusion guards. Thus libass can be considered separate enough to warrant this. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26770 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use standard license header.diego2008-05-131-16/+18
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26755 b3059339-0415-0410-9bf9-f77b7e298cf2
* When building font pattern, treat both ' ' and '-' as word separators.eugeni2008-05-111-7/+9
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26742 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix possible free of unallocated memory.eugeni2008-05-111-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26741 b3059339-0415-0410-9bf9-f77b7e298cf2
* Define FC_FULLNAME and FC_EMBOLDEN to fix compilation with ancient fontconfig.eugeni2008-05-081-0/+10
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26692 b3059339-0415-0410-9bf9-f77b7e298cf2
* If both full name and family are available, use the former in inexact match ↵eugeni2008-05-081-1/+1
| | | | | | warning. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26691 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove extra family names from the search pattern after FcFontSort andeugeni2008-05-081-6/+18
| | | | | | | | | | | call FcFontRenderPrepare to select the best family name for the font in case there are several of them. This does not affect font matching results, but helps to avoid warning about inexact match. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26690 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix the second fontconfig_init function as the declaration in the .h file.ulion2008-05-031-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26652 b3059339-0415-0410-9bf9-f77b7e298cf2
* Print more info about selected font.eugeni2008-05-021-2/+24
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26648 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rewrite font family check in a simpler way.eugeni2008-05-021-8/+9
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26647 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move font family check to the end of the list.eugeni2008-05-021-5/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26646 b3059339-0415-0410-9bf9-f77b7e298cf2
* Cosmetics: rename local variables to better reflect their contents.eugeni2008-05-021-17/+17
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26645 b3059339-0415-0410-9bf9-f77b7e298cf2
* Only warn if both font family and it's full name are different from requested.eugeni2008-05-011-3/+6
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26624 b3059339-0415-0410-9bf9-f77b7e298cf2
* Allow inexact font family matching.eugeni2008-05-011-0/+20
| | | | | | | | | | | | | | | In SSA/ASS fonts are sometimes referenced by their "full name", which is usually a concatenation of family name and font style (ex. Ottawa Bold). Full name is available from FontConfig pattern element FC_FULLNAME, but it is never used for font matching. Therefore, I'm removing words from the end of the name one by one, and adding shortened names to the pattern. It seems that the first value (full name in this case) has precedence in matching. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26623 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove libass dependency on global font_fontconfig variable.eugeni