]> granicus.if.org Git - libass/log
libass
8 years agoconfigure: make fontconfig optional configure
wm4 [Mon, 7 Sep 2015 12:54:33 +0000 (14:54 +0200)]
configure: make fontconfig optional

8 years agoass_fontselect: log the selected font provider
wm4 [Mon, 7 Sep 2015 11:55:07 +0000 (13:55 +0200)]
ass_fontselect: log the selected font provider

8 years agoass_shaper: raise shaper info log level
wm4 [Mon, 7 Sep 2015 11:51:52 +0000 (13:51 +0200)]
ass_shaper: raise shaper info log level

MSGL_V is usually for far noisier messages, such as those printed per
subtitle event.

8 years agoass_bitmap: fix potential NULL deref
wm4 [Mon, 7 Sep 2015 11:43:00 +0000 (13:43 +0200)]
ass_bitmap: fix potential NULL deref

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.

8 years agoass_render: fix potential NULL deref
wm4 [Mon, 7 Sep 2015 11:36:23 +0000 (13:36 +0200)]
ass_render: fix potential NULL deref

Fixes CID 146421.

8 years agotravis: run on OSX too
wm4 [Mon, 7 Sep 2015 10:50:38 +0000 (12:50 +0200)]
travis: run on OSX too

8 years agoass_drawing: make ass_drawing_new() fail properly on OOM
wm4 [Mon, 7 Sep 2015 10:48:34 +0000 (12:48 +0200)]
ass_drawing: make ass_drawing_new() fail properly on OOM

Fixes CID 146124.

8 years agoass_parse: add check against ass_drawing_new() failure
wm4 [Mon, 7 Sep 2015 10:45:51 +0000 (12:45 +0200)]
ass_parse: add check against ass_drawing_new() failure

Also move the argument parsing part to the top of the function. IT's
easier to read this way.

8 years agoass_render: fix potential NULL deref
wm4 [Mon, 7 Sep 2015 10:43:40 +0000 (12:43 +0200)]
ass_render: fix potential NULL deref

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.

8 years agofontselect: initialize postscript name
Grigori Goronzy [Mon, 7 Sep 2015 10:13:33 +0000 (12:13 +0200)]
fontselect: initialize postscript name

Bad things can happen otherwise. Found by coverity scan.

8 years agofontselect: fix memory leak
Grigori Goronzy [Mon, 7 Sep 2015 10:08:08 +0000 (12:08 +0200)]
fontselect: fix memory leak

Introduced by commit d6bb9af6. Found by coverity scan.

8 years agoMerge branch 'fonts'
Grigori Goronzy [Mon, 7 Sep 2015 09:40:54 +0000 (11:40 +0200)]
Merge branch 'fonts'

8 years agoMerge pull request #190 from grigorig/fonts
Grigori Goronzy [Mon, 7 Sep 2015 09:32:49 +0000 (11:32 +0200)]
Merge pull request #190 from grigorig/fonts

Substitutions and some fixes

8 years agofontselect: get rid of strdup for display name
Grigori Goronzy [Mon, 7 Sep 2015 09:06:17 +0000 (11:06 +0200)]
fontselect: get rid of strdup for display name

The name is always pulled from the font info, which is static, so
there is no need to strdup.

8 years agofontselect: improve font display name choice
Grigori Goronzy [Mon, 7 Sep 2015 09:03:28 +0000 (11:03 +0200)]
fontselect: improve font display name choice

8 years agofontselect: remove outdated remark
Grigori Goronzy [Mon, 7 Sep 2015 08:56:59 +0000 (10:56 +0200)]
fontselect: remove outdated remark

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.

8 years agofontconfig: fix memory leak in error path
Grigori Goronzy [Mon, 7 Sep 2015 08:48:17 +0000 (10:48 +0200)]
fontconfig: fix memory leak in error path

Found by clang static analysis.

8 years agofontselect: call match_fonts for each alias
Grigori Goronzy [Mon, 7 Sep 2015 08:27:26 +0000 (10:27 +0200)]
fontselect: call match_fonts for each alias

In case a font provider actually uses more than one substitution.

8 years agotest: use proper fallback name
Grigori Goronzy [Mon, 7 Sep 2015 00:12:43 +0000 (02:12 +0200)]
test: use proper fallback name

The correct generic family name is "sans-serif", the short form "Sans"
is specific to fontconfig only.

8 years agofontselect: fix fallback family fallback
Grigori Goronzy [Sun, 6 Sep 2015 23:34:48 +0000 (01:34 +0200)]
fontselect: fix fallback family fallback

8 years agofontconfig: handle fallback corner cases
Grigori Goronzy [Sun, 6 Sep 2015 23:29:27 +0000 (01:29 +0200)]
fontconfig: handle fallback corner cases

If no particular codepoint is requested (codepoint == 0), just return
the first font family. Additionally, handle fontconfig errors, albeit
they're unlikely to happen.

8 years agofontselect: fix match_fonts semantics
Grigori Goronzy [Wed, 2 Sep 2015 22:04:59 +0000 (00:04 +0200)]
fontselect: fix match_fonts semantics

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.

8 years agodirectwrite, coretext: implement substitutions
Grigori Goronzy [Tue, 1 Sep 2015 13:47:40 +0000 (15:47 +0200)]
directwrite, coretext: implement substitutions

This adds simple and sensible substitutions for generic font family
names. A helper function is introduced to reduce code duplication.

8 years agodirectwrite: fix fallback for codepoint 0
Grigori Goronzy [Tue, 1 Sep 2015 14:33:33 +0000 (16:33 +0200)]
directwrite: fix fallback for codepoint 0

8 years agodirectwrite: fix compilation
Grigori Goronzy [Tue, 1 Sep 2015 14:29:49 +0000 (16:29 +0200)]
directwrite: fix compilation

A name clash was introduced by commit ab08d079.

8 years agocoretext: use SAFE_CFRelease() for robustness
wm4 [Tue, 1 Sep 2015 12:50:36 +0000 (14:50 +0200)]
coretext: use SAFE_CFRelease() for robustness

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.

8 years agofontselect: fix yet another memory leak
Grigori Goronzy [Tue, 1 Sep 2015 12:37:57 +0000 (14:37 +0200)]
fontselect: fix yet another memory leak

8 years agofontselect: stop font selection after first match
Grigori Goronzy [Tue, 1 Sep 2015 00:12:19 +0000 (02:12 +0200)]
fontselect: stop font selection after first match

8 years agofontselect: remove static fallback font list
Grigori Goronzy [Mon, 31 Aug 2015 23:17:53 +0000 (01:17 +0200)]
fontselect: remove static fallback font list

The default font provider needs to provide a GetFallbackFunc callback
instead.

8 years agofontselect: add const
wm4 [Tue, 1 Sep 2015 12:33:51 +0000 (14:33 +0200)]
fontselect: add const

8 years agofontselect: never pass family=NULL to get_fallback()
wm4 [Tue, 1 Sep 2015 12:33:08 +0000 (14:33 +0200)]
fontselect: never pass family=NULL to get_fallback()

The CoreText backend doesn't like this, and in fact there's no reason to
pass NULL.

8 years agocoretext: fix sizeof vs. strlen
wm4 [Tue, 1 Sep 2015 12:31:21 +0000 (14:31 +0200)]
coretext: fix sizeof vs. strlen

8 years agocoretext: always use lazy loading
wm4 [Tue, 1 Sep 2015 12:21:31 +0000 (14:21 +0200)]
coretext: always use lazy loading

We already decided that eager loading is too slow. No need to keep
multiple code paths around.

8 years agofontselect: simplify get_fallback signature
wm4 [Tue, 1 Sep 2015 12:18:51 +0000 (14:18 +0200)]
fontselect: simplify get_fallback signature

Apparently we only need the font family (and even that isn't used in all
font providers). Drop the others.

8 years agofontselect: use designated initializers
wm4 [Tue, 1 Sep 2015 12:08:47 +0000 (14:08 +0200)]
fontselect: use designated initializers

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.

8 years agocoretext: implement GetFallbackFunc
Stefano Pigozzi [Mon, 31 Aug 2015 22:18:03 +0000 (00:18 +0200)]
coretext: implement GetFallbackFunc

8 years agofontselect: add bounds checking for memory font stream reads
wm4 [Mon, 31 Aug 2015 10:15:01 +0000 (12:15 +0200)]
fontselect: add bounds checking for memory font stream reads

8 years agofont: fix double frees if opening memory font fails
wm4 [Mon, 31 Aug 2015 10:03:37 +0000 (12:03 +0200)]
font: fix double frees if opening memory font fails

Apparently, libfreetype calls close_stream_font through the
FT_Stream.close callback.

8 years agofontselect: fix a memory leak
wm4 [Mon, 31 Aug 2015 09:56:15 +0000 (11:56 +0200)]
fontselect: fix a memory leak

The result of the subst_font callback was not freed.

8 years agofontselect: reimplement ass_set_fonts_dir() functionality
wm4 [Fri, 28 Aug 2015 17:32:46 +0000 (19:32 +0200)]
fontselect: reimplement ass_set_fonts_dir() functionality

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.

8 years agorender_api: fix crash when calling ass_set_fonts() after rendering
wm4 [Fri, 28 Aug 2015 16:34:36 +0000 (18:34 +0200)]
render_api: fix crash when calling ass_set_fonts() after rendering

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.

8 years agofont: fix broken charmap fallback handling
wm4 [Fri, 28 Aug 2015 15:39:08 +0000 (17:39 +0200)]
font: fix broken charmap fallback handling

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.

8 years agofontselect: fix fallbacks
wm4 [Fri, 28 Aug 2015 14:29:06 +0000 (16:29 +0200)]
fontselect: fix fallbacks

I broke it.

8 years agoconfigure: proper configure switches for DirectWrite and CoreText
wm4 [Fri, 28 Aug 2015 13:39:32 +0000 (15:39 +0200)]
configure: proper configure switches for DirectWrite and CoreText

Also, remove the ass_coretext.c conditional compilation hack, and fix
Makefile.am instead.

8 years agoass: make font_provider API private
wm4 [Fri, 28 Aug 2015 12:51:09 +0000 (14:51 +0200)]
ass: make font_provider API private

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.

8 years agoass: ass_fonts_update() is a stub
wm4 [Fri, 28 Aug 2015 12:38:16 +0000 (14:38 +0200)]
ass: ass_fonts_update() is a stub

8 years agoass: restore ABI compatibility with older versions (more or less)
wm4 [Fri, 28 Aug 2015 12:35:41 +0000 (14:35 +0200)]
ass: restore ABI compatibility with older versions (more or less)

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.

8 years agofontconfig: fix error checking
wm4 [Fri, 28 Aug 2015 12:02:19 +0000 (14:02 +0200)]
fontconfig: fix error checking

FcInitLoadConfig() could faul, leaving rc=1 and fc->config=NULL, making
FcConfigBuildFonts() potentially crash.

Also, the FcConfigBuildFonts() return value was not checked.

8 years agofontselect: minor cleanup
wm4 [Fri, 28 Aug 2015 11:56:51 +0000 (13:56 +0200)]
fontselect: minor cleanup

Use a pointer to the selected font info, instead of an index. Makes the
code a bit more readable.

8 years agofontselect: correctly match list of font substitutions
wm4 [Fri, 28 Aug 2015 11:54:33 +0000 (13:54 +0200)]
fontselect: correctly match list of font substitutions

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.

8 years agofontselect: deal with potential ASS_FontProvider.subst_font failure
wm4 [Fri, 28 Aug 2015 10:52:31 +0000 (12:52 +0200)]
fontselect: deal with potential ASS_FontProvider.subst_font failure

Don't assume it sets all fields. If it doesn't return any font names at
all, go with the default.

8 years agofontconfig: implement substitutions
Grigori Goronzy [Thu, 6 Aug 2015 02:35:56 +0000 (04:35 +0200)]
fontconfig: implement substitutions

Signed-off-by: wm4 <wm4@nowhere>
8 years agofontselect: check fontprovider constructors for failure
wm4 [Thu, 27 Aug 2015 18:46:11 +0000 (20:46 +0200)]
fontselect: check fontprovider constructors for failure

Should fix the DirectWrite to Fontconfig fallback.

8 years agoRename dwrite.h, minor cleanups
wm4 [Wed, 5 Aug 2015 20:05:36 +0000 (22:05 +0200)]
Rename dwrite.h, minor cleanups

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.

8 years agoFix typedefs
wm4 [Tue, 4 Aug 2015 09:33:40 +0000 (11:33 +0200)]
Fix typedefs

8 years agoProperly skip glyphs for multiple consecutive line breaks
Oleg Oshmyan [Sun, 2 Aug 2015 21:40:16 +0000 (00:40 +0300)]
Properly skip glyphs for multiple consecutive line breaks

This corrects the calculated width of events that contain \N\N,
which previously included the width of the glyph corresponding
to '\n' (more generally, for n consecutive line breaks, only
the first glyph was skipped and n-1 glyphs were included).

Reported on IRC.

8 years agoFix crash when the OS doesn't support AVX2
Rodger Combs [Mon, 27 Jul 2015 22:53:21 +0000 (17:53 -0500)]
Fix crash when the OS doesn't support AVX2

8 years agoconfigure: remove some unneeded checks
wm4 [Sat, 11 Jul 2015 21:06:52 +0000 (23:06 +0200)]
configure: remove some unneeded checks

8 years agodirectwrite: don't crash on unknown DWRITE_FONT_STRETCH
wm4 [Sat, 11 Jul 2015 21:00:26 +0000 (23:00 +0200)]
directwrite: don't crash on unknown DWRITE_FONT_STRETCH

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.

8 years agodirectwrite: convert to C
wm4 [Sat, 11 Jul 2015 18:33:15 +0000 (20:33 +0200)]
directwrite: convert to C

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.

8 years agodirectwrite: dynamically load dwrite.dll
wm4 [Sat, 11 Jul 2015 17:33:44 +0000 (19:33 +0200)]
directwrite: dynamically load dwrite.dll

8 years agodirectwrite: compile only on Windows
wm4 [Sat, 11 Jul 2015 16:51:54 +0000 (18:51 +0200)]
directwrite: compile only on Windows

8 years agofontselect: prefer platform font providers
Grigori Goronzy [Sun, 14 Jun 2015 10:49:31 +0000 (12:49 +0200)]
fontselect: prefer platform font providers

Prefer DirectWrite before the cross-platform fontconfig, so that
DirectWrite is used by default if both are compiled into libass.

8 years agodirectwrite: add font fallback callback
Grigori Goronzy [Sun, 14 Jun 2015 10:34:09 +0000 (12:34 +0200)]
directwrite: add font fallback callback

This uses a faux rendering with a high-level interface of DirectWrite
to determine a suitable fallback. Choices are different from GDI,
but reasonable.

8 years agofontconfig: add font fallback callback
Grigori Goronzy [Sun, 14 Jun 2015 01:13:37 +0000 (03:13 +0200)]
fontconfig: add font fallback callback

This creates a sorted list of fallback fonts and reuses it, for speed.
Font sorting is very slow.

8 years agofontselect: add fallback handling with callback
Grigori Goronzy [Sun, 14 Jun 2015 01:11:50 +0000 (03:11 +0200)]
fontselect: add fallback handling with callback

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.

8 years agofontselect: improved face selection among a family
Grigori Goronzy [Sun, 14 Jun 2015 01:09:10 +0000 (03:09 +0200)]
fontselect: improved face selection among a family

We want the best variant, but if it doesn't have the glyph coverage,
we may also use another variant from the same family.

8 years agoConstify ass_msg format (NFC)
Grigori Goronzy [Sat, 13 Jun 2015 15:32:59 +0000 (17:32 +0200)]
Constify ass_msg format (NFC)

8 years agodirectwrite: multiple improvements to font scanning
Grigori Goronzy [Sat, 13 Jun 2015 14:29:10 +0000 (16:29 +0200)]
directwrite: multiple improvements to font scanning

There were various issues with font scanning. This addresses the following:

- Synthesized font faces (bold/oblique) were added to the list. Just skip
  those, this is handled internally by libass.
- Use the win32 font family names, if available. Traditionally, Windows
  groups font families in a different way, so that the number of
  variants is small (<= 4). With this, Arial Narrow and Arial Black
  appear as a separate family, which is what we want.
- Full names are not mandatory. Correctly handle the case that there
  are no full names.
- Don't use the bogus LOCALE_NAME_MAX_LENGTH constant to determine the
  size of the name buffer. Names can be almost arbitrarily long.
  Handle names up to 256 characters correctly and truncate longer names.

8 years agofontselect: fix oblique/italic mixup
Grigori Goronzy [Sat, 13 Jun 2015 14:25:41 +0000 (16:25 +0200)]
fontselect: fix oblique/italic mixup

The constants were swapped. In some cases this lead to incorrect matching.

8 years agofontselect: fix undefined behavior with calloc
Grigori Goronzy [Fri, 12 Jun 2015 19:14:53 +0000 (21:14 +0200)]
fontselect: fix undefined behavior with calloc

If allocations have the size zero, malloc/calloc implementations
can return a zero-size buffer or NULL. The earlier introduced malloc
checking blows up if an implementation returns NULL. Fix that by only
allocating and checking when it's actually needed.

Also fix a minor problem with iconv deinitialization in an error path.

8 years agodirectwrite: fix linking
Grigori Goronzy [Fri, 12 Jun 2015 19:13:29 +0000 (21:13 +0200)]
directwrite: fix linking

8 years agofontselect: replace magic numbers (NFC)
Grigori Goronzy [Fri, 12 Jun 2015 01:31:35 +0000 (03:31 +0200)]
fontselect: replace magic numbers (NFC)

8 years agofontselect: trim names of embedded fonts
Grigori Goronzy [Fri, 12 Jun 2015 01:20:49 +0000 (03:20 +0200)]
fontselect: trim names of embedded fonts

Embedded fonts tend to be extra bad, so trim the names. I have
encountered fonts faces with untrimmed names.

Leave this at the discretion of the font provider for platform-specific
font providers.

8 years agofontselect: add and use strdup_trimmed
Grigori Goronzy [Fri, 12 Jun 2015 00:53:09 +0000 (02:53 +0200)]
fontselect: add and use strdup_trimmed

This is just a cleaner and safer interface for string trimming.

8 years agofontselect: simplify lookup of embedded fonts
Grigori Goronzy [Fri, 12 Jun 2015 00:04:43 +0000 (02:04 +0200)]
fontselect: simplify lookup of embedded fonts

Currently, it is not safe to change the embedded fonts
(ass_add_font/ass_clear_fonts) while an ASS_Renderer exists. We can
simplify how embedded fonts are looked up because of that.

At some point, ASS_Library and ASS_Renderer should be merged and we
can then implement a more flexible approach.

8 years agofontselect: malloc and error checking
Grigori Goronzy [Thu, 11 Jun 2015 23:35:40 +0000 (01:35 +0200)]
fontselect: malloc and error checking

Add malloc checks with useful semantics and error checks in some
specific cases. This should hopefully make fontselect more robust.

The platform-specific font providers (DirectWrite/CoreText/FontConfig)
still need to be checked for proper memory management.

8 years agofontselect: simplify cmap lookup for embedded fonts
Grigori Goronzy [Thu, 11 Jun 2015 20:46:10 +0000 (22:46 +0200)]
fontselect: simplify cmap lookup for embedded fonts

FreeType can do it for us and is probably more efficient. Also fixes
deinitialization order of ASS_Renderer to make this work.

8 years agofontselect: improved and simplified matching
Grigori Goronzy [Thu, 11 Jun 2015 19:29:35 +0000 (21:29 +0200)]
fontselect: improved and simplified matching

Sorting the font list is overkill and not very useful. We are
interested in *exact* name matches only; all other font families don't
matter and we'll use another fallback mechanism for glyph fallbacks
(TBD).

Replace the sorting and glyph fallback search with a simple linear
scan.  Fonts are first matched against family name first (to allow
further comparison against style attributes) and if that fails,
the fullname is considered.

8 years agofontselect: add fallback and substitution callbacks
Grigori Goronzy [Mon, 8 Jun 2015 23:20:28 +0000 (01:20 +0200)]
fontselect: add fallback and substitution callbacks

Add callbacks to introduce more sane fallback handling and font
alias substitutions.

8 years agofontselect: add documentation
Grigori Goronzy [Mon, 8 Jun 2015 21:21:50 +0000 (23:21 +0200)]
fontselect: add documentation

Add some documentation to the font provider callbacks and metadata
struct.

8 years agodirectwrite: fix indentation
Stephan Vedder [Fri, 29 May 2015 09:23:23 +0000 (11:23 +0200)]
directwrite: fix indentation

8 years agodirectwrite: add missing memory release in case of failure
Stephan Vedder [Sun, 24 May 2015 17:31:23 +0000 (19:31 +0200)]
directwrite: add missing memory release in case of failure

8 years agodirectwrite: release localizedStrings
Stephan Vedder [Sat, 23 May 2015 20:43:57 +0000 (22:43 +0200)]
directwrite: release localizedStrings

8 years agodirectwrite: fix error handling in font scanning
Stephan Vedder [Sat, 23 May 2015 12:06:54 +0000 (14:06 +0200)]
directwrite: fix error handling in font scanning

Fix that a single broken font could mess up the entire font scanning.

8 years agodirectwrite: use standard malloc
Grigori Goronzy [Sat, 23 May 2015 11:21:41 +0000 (13:21 +0200)]
directwrite: use standard malloc

8 years agodirectwrite: add 'width' attribute
Grigori Goronzy [Sat, 23 May 2015 11:20:55 +0000 (13:20 +0200)]
directwrite: add 'width' attribute

This is required for proper font matching.

8 years agodirectwrite: wire up destroy callbacks
Grigori Goronzy [Sat, 23 May 2015 11:20:14 +0000 (13:20 +0200)]
directwrite: wire up destroy callbacks

8 years agodirectwrite: cache FontFileStream
Grigori Goronzy [Sat, 23 May 2015 11:12:43 +0000 (13:12 +0200)]
directwrite: cache FontFileStream

Extract a function to set up FontFileStream and store it in a newly
introduced private struct. Fix memory management as well.

8 years agodirectwrite: add initial fontselect implementation
feliwir [Tue, 19 May 2015 09:46:37 +0000 (11:46 +0200)]
directwrite: add initial fontselect implementation

Incomplete, leaks memory, but capable of rendering something.

8 years agoChanged configure.ac to work with c++ files
feliwir [Tue, 19 May 2015 09:47:51 +0000 (11:47 +0200)]
Changed configure.ac to work with c++ files

8 years agoCompile the check with the g++ compiler now
Stephan Vedder [Mon, 18 May 2015 20:55:28 +0000 (22:55 +0200)]
Compile the check with the g++ compiler now

8 years agoAdded directwrite check
Stephan Vedder [Mon, 18 May 2015 20:21:05 +0000 (22:21 +0200)]
Added directwrite check

8 years agofontselect: fix NULL dereference
Stefano Pigozzi [Tue, 29 Apr 2014 19:58:49 +0000 (21:58 +0200)]
fontselect: fix NULL dereference

Apparently on some broken fonts, FreeType can return a NULL family name. Avoid
to crash in these cases.

8 years agoProvisional support for libiconv
Grigori Goronzy [Tue, 25 Feb 2014 01:33:40 +0000 (02:33 +0100)]
Provisional support for libiconv

8 years agoFix compiler compatibility
Grigori Goronzy [Tue, 25 Feb 2014 01:33:04 +0000 (02:33 +0100)]
Fix compiler compatibility

8 years agoFix warnings
Grigori Goronzy [Mon, 24 Feb 2014 19:29:11 +0000 (20:29 +0100)]
Fix warnings

8 years agofontselect: expose a fontprovider listing API
Stefano Pigozzi [Fri, 13 Dec 2013 07:14:43 +0000 (08:14 +0100)]
fontselect: expose a fontprovider listing API

This allows client code to query libass for the font providers it was compiled
with. It can be useful for clients so that they can show selection interfaces
to their users.

8 years agofontselect: expose a fontprovider selection API
Stefano Pigozzi [Tue, 10 Dec 2013 17:45:54 +0000 (18:45 +0100)]
fontselect: expose a fontprovider selection API

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.

8 years agofontselect: use fallback fonts when querying font providers
Stefano Pigozzi [Mon, 9 Dec 2013 18:09:09 +0000 (19:09 +0100)]
fontselect: use fallback fonts when querying font providers

51f9e80b added a MatchFontsFunc callback which allows to lookup font names
directly on the font provider. This approach broke support for font fallback
which worked only with lookups from libass in-memory font database.

This commit moves the font fallback code in the font lookup function, so that
it is available for all font providers.