]> granicus.if.org Git - libass/log
libass
9 years agocoretext: implement GetFallbackFunc
Stefano Pigozzi [Mon, 31 Aug 2015 22:18:03 +0000 (00:18 +0200)]
coretext: implement GetFallbackFunc

9 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

9 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.

9 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.

9 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.

9 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.

9 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.

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

I broke it.

9 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.

9 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.

9 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

9 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.

9 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.

9 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.

9 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.

9 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.

9 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>
9 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.

9 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.

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

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

9 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.

9 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.

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

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

9 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.

9 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.

9 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.

9 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.

9 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.

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

9 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.

9 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.

9 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.

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

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

9 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.

9 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.

9 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.

9 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.

9 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.

9 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.

9 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.

9 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.

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

9 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

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

9 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.

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

9 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.

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

9 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.

9 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.

9 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

9 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

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

9 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.

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

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

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

9 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.

9 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.

9 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.

9 years agocoretext: fix conversion from CFStringRef to utf8 buffer
Stefano Pigozzi [Fri, 6 Dec 2013 17:36:24 +0000 (18:36 +0100)]
coretext: fix conversion from CFStringRef to utf8 buffer

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.

9 years agocoretext: also lazy load fonts based on Family and PostScript names
Stefano Pigozzi [Thu, 5 Dec 2013 18:07:02 +0000 (19:07 +0100)]
coretext: also lazy load fonts based on Family and PostScript names

Previously, the lazy load of fonts was only using display name. Also use the
other names available through the CoreText API (FamilyName and PostScriptName).

9 years agofontselect: coretext: allow to match fontname using the provider
Stefano Pigozzi [Sat, 2 Nov 2013 21:01:37 +0000 (22:01 +0100)]
fontselect: coretext: allow to match fontname using the provider

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

9 years agofontselect: coretext: allow selection based on PostScript name
Stefano Pigozzi [Sat, 2 Nov 2013 11:07:07 +0000 (12:07 +0100)]
fontselect: coretext: allow selection based on PostScript name

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.

9 years agofontselect: implement a coretext font provider
Stefano Pigozzi [Fri, 1 Nov 2013 14:44:25 +0000 (15:44 +0100)]
fontselect: implement a coretext font provider

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.

9 years agoAdd todo comments
Grigori Goronzy [Tue, 18 Oct 2011 14:28:51 +0000 (16:28 +0200)]
Add todo comments

9 years agoSupport multiple font family names
Grigori Goronzy [Sun, 4 Sep 2011 13:54:38 +0000 (15:54 +0200)]
Support multiple font family names

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.

9 years agonit: add width to font_info_dump
Grigori Goronzy [Sun, 4 Sep 2011 13:33:09 +0000 (15:33 +0200)]
nit: add width to font_info_dump

9 years agoAdd support for font width property
Grigori Goronzy [Sat, 3 Sep 2011 13:20:00 +0000 (15:20 +0200)]
Add support for font width property

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.

9 years agoUse streamed access for memory fonts
Grigori Goronzy [Wed, 24 Aug 2011 12:23:01 +0000 (14:23 +0200)]
Use streamed access for memory fonts

This is faster in many cases, and more suitable for Windows' GetFontData
function.

9 years agoPass family name as path for memory fonts
Grigori Goronzy [Mon, 22 Aug 2011 04:30:37 +0000 (06:30 +0200)]
Pass family name as path for memory fonts

This is a bit nicer because we can actually see which physical font
has been selected for a certain logical font.

9 years agoExport font provider interface
Grigori Goronzy [Sat, 20 Aug 2011 16:19:25 +0000 (18:19 +0200)]
Export font provider interface

Add wrapper to the ASS_Renderer to create a font provider from
its internal font selector and shuffle some code around to export
everything that's needed for font providers to the public. Document
font provider functions.

9 years agoMemory font support
Grigori Goronzy [Sat, 20 Aug 2011 15:46:03 +0000 (17:46 +0200)]
Memory font support

Allow memory fonts with the get_face_data callback. This feature is
used for embedded fonts, but can be used by any font provider.

9 years agoMake sure font path is valid
Grigori Goronzy [Fri, 19 Aug 2011 03:23:26 +0000 (05:23 +0200)]
Make sure font path is valid

We do not support memory-based fonts yet, so a path is mandatory.

9 years agoFix weight validity check
Grigori Goronzy [Fri, 19 Aug 2011 03:05:55 +0000 (05:05 +0200)]
Fix weight validity check

9 years agoFree a provider's fonts when it is freed
Grigori Goronzy [Fri, 19 Aug 2011 03:03:45 +0000 (05:03 +0200)]
Free a provider's fonts when it is freed

When a provider is freed, iterate the font database, free all fonts
that belong to that provider and compact the database afterwards.

9 years agoAdd convenience defines for slant values
Grigori Goronzy [Fri, 19 Aug 2011 02:36:05 +0000 (04:36 +0200)]
Add convenience defines for slant values

There is no standard scale for slant. This is almost a boolean
attribute. However, a font can have a real italic variant, and/or a
simple oblique variant. fontconfig's notation supports both of these,
so it makes sense to reuse that notation for the sake of flexibility;
we might need to differentiate between them.

9 years agooops: remove debug output
Grigori Goronzy [Thu, 18 Aug 2011 23:27:21 +0000 (01:27 +0200)]
oops: remove debug output

9 years agoCheck weight and slant validity in font provider
Grigori Goronzy [Thu, 18 Aug 2011 23:24:13 +0000 (01:24 +0200)]
Check weight and slant validity in font provider

When adding a new font, check that weight and slant are valid. If
they're not, use reasonable defaults.

9 years agoUse TrueType font weight scale
Grigori Goronzy [Thu, 18 Aug 2011 23:16:24 +0000 (01:16 +0200)]
Use TrueType font weight scale

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.

9 years agoFix similarity calculations
Grigori Goronzy [Thu, 18 Aug 2011 22:40:40 +0000 (00:40 +0200)]
Fix similarity calculations

9 years agoAdd a fixed set of fallback fonts
Grigori Goronzy [Thu, 18 Aug 2011 05:24:42 +0000 (07:24 +0200)]
Add a fixed set of fallback fonts

Add a small set of fixed fallback fonts, some of them with very wide
glyph coverage.

9 years agoDon't match any font if there's no glyph coverage
Grigori Goronzy [Thu, 18 Aug 2011 04:36:15 +0000 (06:36 +0200)]
Don't match any font if there's no glyph coverage

Do not return a font face at all instead of using the last one. Fixes
fallback to the default font path.

9 years agoRestore fontconfig runtime configuration
Grigori Goronzy [Thu, 18 Aug 2011 04:19:33 +0000 (06:19 +0200)]
Restore fontconfig runtime configuration

Pass the fontconfig configuration file option and enable switch
through into the font selector. This restores some of the old
functionality related to fontconfig.

However, the functionality to delay the fontconfig database update will
not come back. This is not a big problem. Later it will be possible to
manually add the fontconfig provider, which will delay the update in a
comparable way.

9 years agoFix compilation without fontconfig
Grigori Goronzy [Thu, 18 Aug 2011 03:54:46 +0000 (05:54 +0200)]
Fix compilation without fontconfig

Conditionally add the fontconfig provider. We can actually run
without fontconfig now! That is, if embedded fonts or fallbacks are
good enough.

9 years agoFix off-by-one bug in font matching
Grigori Goronzy [Thu, 18 Aug 2011 03:48:56 +0000 (05:48 +0200)]
Fix off-by-one bug in font matching

9 years agoAdd reference to font provider in font database
Grigori Goronzy [Thu, 18 Aug 2011 03:33:00 +0000 (05:33 +0200)]
Add reference to font provider in font database

This provides more flexibility than just referencing the callbacks:
we can identify the font provider (useful for removing fonts when a
provider is freed) and possibly access the font provider private data.

9 years agoImprove font selector/provider documentation
Grigori Goronzy [Thu, 18 Aug 2011 03:02:51 +0000 (05:02 +0200)]
Improve font selector/provider documentation

9 years agoConvert embedded font handling to a real font provider
Grigori Goronzy [Thu, 18 Aug 2011 02:40:47 +0000 (04:40 +0200)]
Convert embedded font handling to a real font provider

9 years agoAdd glyph coverage map for embedded fonts
Grigori Goronzy [Wed, 17 Aug 2011 22:15:57 +0000 (00:15 +0200)]
Add glyph coverage map for embedded fonts

Introduce a simple glyph coverage map (created when the font is added)
and use it for checking glyph coverage in font selection. This uses a
simple linear search at the moment.

9 years agoNever add a face twice to an ASS_Font
Grigori Goronzy [Wed, 17 Aug 2011 16:59:00 +0000 (18:59 +0200)]
Never add a face twice to an ASS_Font

Introduce a unique ID per font face and check it in add_face to make
sure we never add a font face twice. This is useful in case the glyph
coverage report is unreliable.

9 years agoFix trimming function
Grigori Goronzy [Mon, 15 Aug 2011 22:26:16 +0000 (00:26 +0200)]
Fix trimming function

Did not correctly handle empty strings (only whitespace). Whoops.

9 years agoTrim spaces of font family strings
Grigori Goronzy [Mon, 15 Aug 2011 20:04:02 +0000 (22:04 +0200)]
Trim spaces of font family strings

This adds a trimming utility function that is used for trimming strings
of font requests in the font sorter.

9 years agoCustom font matching and font sources
Grigori Goronzy [Sun, 7 Aug 2011 00:21:09 +0000 (02:21 +0200)]
Custom font matching and font sources

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.

9 years agoImplement cascade gaussian blur
Dr.Smile [Sat, 4 Jul 2015 19:39:26 +0000 (22:39 +0300)]
Implement cascade gaussian blur

That's complete version with SSE2/AVX2 assembly.
Should be much faster than old algorithm even in pure C.

Algorithm description can be found in this article (PDF):
https://github.com/MrSmile/CascadeBlur/releases

Close #9

9 years agoFix code path of rasterization through FreeType
Dr.Smile [Wed, 1 Jul 2015 18:21:11 +0000 (21:21 +0300)]
Fix code path of rasterization through FreeType

9 years agoRelease 0.12.3 0.12.3
wm4 [Tue, 30 Jun 2015 10:27:59 +0000 (12:27 +0200)]
Release 0.12.3