summaryrefslogtreecommitdiffstats
path: root/libass
Commit message (Collapse)AuthorAgeFilesLines
* ass_fontselect: ignore ./.. and hidden fileswm42015-09-081-0/+2
|
* fontselect: handle additional malloc errorsGrigori Goronzy2015-09-081-2/+5
|
* ass_fontselect: uninline ass_map_font()wm42015-09-072-12/+15
| | | | | Also fixes the build on OSX under some circumstances (weird and inconsistent rules for the inline keyword in C).
* ass_fontselect: log the selected font providerwm42015-09-071-5/+9
|
* ass_shaper: raise shaper info log levelwm42015-09-071-1/+1
| | | | | MSGL_V is usually for far noisier messages, such as those printed per subtitle event.
* ass_bitmap: fix potential NULL derefwm42015-09-071-3/+7
| | | | | | | | | | | | | Another consequence of the trickiness in this code. This codepath for opaque_box=1 assumes both bm_o and bm_g are set, but if memory allocation fails somewhere, bm_o could be non-NULL, but bm_g NULL, which then would result in a crash when accessing bm_g. Possibly this code could be cleaned up to look much nicer (and not have dozens of hidden, obscure bugs), but for now this fixes the potential crash found by Coverity. Fixes CID 146125.
* ass_render: fix potential NULL derefwm42015-09-071-1/+1
| | | | Fixes CID 146421.
* ass_drawing: make ass_drawing_new() fail properly on OOMwm42015-09-071-1/+4
| | | | Fixes CID 146124.
* ass_parse: add check against ass_drawing_new() failurewm42015-09-071-8/+9
| | | | | Also move the argument parsing part to the top of the function. IT's easier to read this way.
* ass_render: fix potential NULL derefwm42015-09-071-2/+2
| | | | | | | | | | The logic here is pretty complicated. The caller of this function guards it with "if(info->bm || info->bm_o){", and generally indeed only one of them is set. But in some cases, both are needed. fix_outline() definitely dereferences both. This is not necessarily guaranteed, e.g. on out of memory errors. Add the missing checks. Fixes CID 146125.
* fontselect: initialize postscript nameGrigori Goronzy2015-09-071-1/+1
| | | | Bad things can happen otherwise. Found by coverity scan.
* fontselect: fix memory leakGrigori Goronzy2015-09-071-1/+1
| | | | Introduced by commit d6bb9af6. Found by coverity scan.
* Merge branch 'fonts'Grigori Goronzy2015-09-0725-602/+3521
|\
| * fontselect: get rid of strdup for display nameGrigori Goronzy2015-09-072-8/+3
| | | | | | | | | | The name is always pulled from the font info, which is static, so there is no need to strdup.
| * fontselect: improve font display name choiceGrigori Goronzy2015-09-071-3/+7
| |
| * fontselect: remove outdated remarkGrigori Goronzy2015-09-071-4/+0
| | | | | | | | | | fontselect is an internal only API for now. That said, it also seems much more sane to let library users deal with this resource management.
| * fontconfig: fix memory leak in error pathGrigori Goronzy2015-09-071-0/+1
| | | | | | | | Found by clang static analysis.
| * fontselect: call match_fonts for each aliasGrigori Goronzy2015-09-071-3/+6
| | | | | | | | In case a font provider actually uses more than one substitution.
| * fontselect: fix fallback family fallbackGrigori Goronzy2015-09-071-1/+1
| |
| * fontconfig: handle fallback corner casesGrigori Goronzy2015-09-071-2/+16
| | | | | | | | | | | | If no particular codepoint is requested (codepoint == 0), just return the first font family. Additionally, handle fontconfig errors, albeit they're unlikely to happen.
| * fontselect: fix match_fonts semanticsGrigori Goronzy2015-09-071-27/+55
| | | | | | | | | | | | | | | | | | | | We don't want to add fonts multiple times, so call match_fonts lazily, i.e. only after selecting a font with a certain name failed. Since font matching interacts with glyph coverage checks, add a simple mechanism to determine whether matching failed because of name or glyph coverage. Additionally make sure to handle substitutions before any calls to match_fonts; this only correctly deals with single-name substitutions, though.
| * directwrite, coretext: implement substitutionsGrigori Goronzy2015-09-023-0/+59
| | | | | | | | | | This adds simple and sensible substitutions for generic font family names. A helper function is introduced to reduce code duplication.
| * directwrite: fix fallback for codepoint 0Grigori Goronzy2015-09-011-5/+7
| |
| * directwrite: fix compilationGrigori Goronzy2015-09-011-1/+1
| | | | | | | | A name clash was introduced by commit ab08d079.
| * coretext: use SAFE_CFRelease() for robustnesswm42015-09-011-17/+18
| | | | | | | | | | | | CFRelease(NULL) can crash. While we're still not sure which CoreText API calls can fail etc. (thanks Apple), this should fix a couple of theoretically possible crashes.
| * fontselect: fix yet another memory leakGrigori Goronzy2015-09-011-0/+2
| |
| * fontselect: stop font selection after first matchGrigori Goronzy2015-09-011-0/+5
| |
| * fontselect: remove static fallback font listGrigori Goronzy2015-09-011-26/+0
| | | | | | | | | | The default font provider needs to provide a GetFallbackFunc callback instead.
| * fontselect: add constwm42015-09-011-1/+1
| |
| * fontselect: never pass family=NULL to get_fallback()wm42015-09-012-1/+4
| | | | | | | | | | The CoreText backend doesn't like this, and in fact there's no reason to pass NULL.
| * coretext: fix sizeof vs. strlenwm42015-09-011-2/+1
| |
| * coretext: always use lazy loadingwm42015-09-011-29/+1
| | | | | | | | | | We already decided that eager loading is too slow. No need to keep multiple code paths around.
| * fontselect: simplify get_fallback signaturewm42015-09-015-16/+9
| | | | | | | | | | Apparently we only need the font family (and even that isn't used in all font providers). Drop the others.
| * fontselect: use designated initializerswm42015-09-015-37/+28
| | | | | | | | | | | | Tired of matching the names and order of the callbacks in my head. While we're at it, also give some of the callbacks better names.
| * coretext: implement GetFallbackFuncStefano Pigozzi2015-09-011-1/+25
| |
| * fontselect: add bounds checking for memory font stream readswm42015-08-311-0/+6
| |
| * font: fix double frees if opening memory font failswm42015-08-311-2/+0
| | | | | | | | | | Apparently, libfreetype calls close_stream_font through the FT_Stream.close callback.
| * fontselect: fix a memory leakwm42015-08-311-22/+29
| | | | | | | | The result of the subst_font callback was not freed.
| * fontselect: reimplement ass_set_fonts_dir() functionalitywm42015-08-283-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ass_set_fonts_dir() is supposed to enable all fonts in a specific directory. The implementation for it was dropped with the commit introducing the new fontselect code. Some users were relying on it, so we need it back. It used to be implemented using a single fontconfig call. But since this has to work even if fontconfig support is not even compiled, a new implementation is needed. This commit adds very simple and low-effort support for it. It loads all files into memory, and then lets the memory font code do the rest. A more efficient implementation would be possible, for example by implementing a new font provider, which serves get_data requests from open file handles. Anyone who wants to do this is welcome to try, and this commit is just the minimum to restore the lost feature.
| * render_api: fix crash when calling ass_set_fonts() after renderingwm42015-08-281-0/+2
| | | | | | | | | | | | | | | | | | | | The caches may reference data which belongs to the font provider. If the font selector and the font provider are destroyed, it can leave dangling pointers in the renderer cache. (At least that's what it looks like.) For some reason, this didn't even trigger valgrind warnings with the fontconfig font provider. Possibly the dangling pointers were FT_Face pointers, and fontconfig might cache these process-wide.
| * font: fix broken charmap fallback handlingwm42015-08-281-1/+1
| | | | | | | | | | | | | | | | | | An earlier commit added this code to avoid adding font faces multiple times. In this form, it breaks the "Trying all charmaps" fallback case, which can lead to text being rendered as boxes. Return the font that is going to contain the missing glyph instead. The calling code will check again, and run the fallback if necessary.
| * fontselect: fix fallbackswm42015-08-281-1/+1
| | | | | | | | I broke it.
| * configure: proper configure switches for DirectWrite and CoreTextwm42015-08-282-6/+6
| | | | | | | | | | Also, remove the ass_coretext.c conditional compilation hack, and fix Makefile.am instead.
| * ass: make font_provider API privatewm42015-08-285-180/+180
| | | | | | | | | | | | | | | | | | | | We were discussing whether this should be public or private. It could be public, because the API is potentially useful, and is relatively simple. On the other hand, the API is not necessarily final, and making it public would prevent us from improving/fixing it. Make it private for now - making it public later is much easier than having to break the public API later.
| * ass: ass_fonts_update() is a stubwm42015-08-281-2/+2
| |
| * ass: restore ABI compatibility with older versions (more or less)wm42015-08-282-3/+8
| | | | | | | | | | | | | | | | | | | | | | While enums normally are ints on most systems, it isn't guaranteed. This might also make C++ code fail to compile, since C++ doesn't allow implicit conversion of ints to enums. If the API user ever passed anything other than 0 or 1, compatibility will still break, but I guess we have to live with this. Also extend the doxygen.
| * fontconfig: fix error checkingwm42015-08-281-3/+2
| | | | | | | | | | | | | | FcInitLoadConfig() could faul, leaving rc=1 and fc->config=NULL, making FcConfigBuildFonts() potentially crash. Also, the FcConfigBuildFonts() return value was not checked.
| * fontselect: minor cleanupwm42015-08-281-12/+11
| | | | | | | | | | Use a pointer to the selected font info, instead of an index. Makes the code a bit more readable.
| * fontselect: correctly match list of font substitutionswm42015-08-281-66/+72
| | | | | | | | | | | | | | | | | | | | | | | | This code prioritized fonts by scanning order, but the scanning order is essentially arbitrary. This resulted in suboptimal and indeterministic font selection by family name. Prefer the order as returned by the substitution callback. This requires some restructuring. The core algorithm is still exactly the same though; only the order of comparisons changes. If the font backend has no subtitution callback, nothing should change.
| * fontselect: deal with potential ASS_FontProvider.subst_font failurewm42015-08-281-2/+3
| | | | | | | | | | Don't assume it sets all fields. If it doesn't return any font names at all, go with the default.
| * fontconfig: implement substitutionsGrigori Goronzy2015-08-283-21/+67
| | | | | | | | Signed-off-by: wm4 <wm4@nowhere>
| * fontselect: check fontprovider constructors for failurewm42015-08-281-4/+4
| | | | | | | | Should fix the DirectWrite to Fontconfig fallback.
| * Rename dwrite.h, minor cleanupswm42015-08-053-7/+8
| | | | | | | | | | | | | | Rename dwrite.h to dwrite_c.h to make the difference between the official header and ours clearer. Also apply minor cleanups to it. Remove the patch against upstream MinGW; it's pointless now.
| * Fix typedefswm42015-08-041-3/+3
| |
| * directwrite: don't crash on unknown DWRITE_FONT_STRETCHwm42015-07-111-1/+1
| | | | | | | | | | The existing code doesn't even handle all currently defined values for it, and nothing says no new values are ever going to be added.
| * directwrite: convert to Cwm42015-07-113-189/+910
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, nobody ever tested the MinGW dwrite.h header in C. There are multiple glaring mistakes, and the header doesn't even compile by itself. The main issues are overloaded functions (which doesn't work in C), and broken COBJMACROS defines. dwrite.diff contains changes to dwrite.h which make libass work. Warning: the patch lacks a required change to the DrawInlineObject method of IDWriteTextRenderer (missing THIS_). Additionally, these definitions would ideally be provided by dwrite.h: DEFINE_GUID(IID_IDWriteFactory, 0xb859ee5a,0xd838,0x4b5b,0xa2,0xe8,0x1a,0xdc,0x7d,0x93,0xdb,0x48); DEFINE_GUID(IID_IDWritePixelSnapping, 0xeaf3a2da,0xecf4,0x4d24,0xb6,0x44,0xb3,0x4f,0x68,0x42,0x02,0x4b); DEFINE_GUID(IID_IDWriteTextRenderer, 0xef8a8135,0x5cc6,0x45fe,0x88,0x25,0xc5,0xa0,0x72,0x4e,0xb8,0x19); Also, in order to make libass compile out of the box with current MinGW/msys installations, a very stripped down in-tree copy of dwrite.h is provided.
| * directwrite: dynamically load dwrite.dllwm42015-07-111-11/+53
| |
| * directwrite: compile only on Windowswm42015-07-113-9/+7
| |
| * fontselect: prefer platform font providersGrigori Goronzy2015-07-101-3/+3
| | | | | | | | | | Prefer DirectWrite before the cross-platform fontconfig, so that DirectWrite is used by default if both are compiled into libass.
| * directwrite: add font fallback callbackGrigori Goronzy2015-07-101-1/+231
| | | | | | | | | | | | This uses a faux rendering with a high-level interface of DirectWrite to determine a suitable fallback. Choices are different from GDI, but reasonable.
| * 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 handling with callbackGrigori Goronzy2015-07-101-0/+19
| | | | | | | | | | If we can't find a matching font face (with glyph coverage), ask the default font provider for a fallback family. The callback is optional.
| * fontselect: improved face selection among a familyGrigori Goronzy2015-07-101-17/+27
| | | | | | | | | | We want the best variant, but if it doesn't have the glyph coverage, we may also use another variant from the same family.
| * Constify ass_msg format (NFC)Grigori Goronzy2015-07-102-2/+2
| |
| * directwrite: multiple improvements to font scanningGrigori Goronzy2015-07-101-29/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were various issues with font scanning. This addresses the following: - Synthesized font faces (bold/oblique) were