Sonntag, 21. August 2011

System fonts without fontconfig

I've uploaded a new version of my win32 VLC test build. This new download includes an experimental Windows GDI font collector (patch), so system fonts can be used now! The interface for that (FontProvider) is now publicly exposed in the libass library as well.

Not actually that horrible.

GDI is a bad API for what I need to do, so there are some limitations. I can't get all "full names" for a font, only the localized or often English name. More importantly, fonts are accessed with the GetFontData call that buffers them into memory. This can be quite slow, especially for big CJK fonts or Unicode fonts like "Arial Unicode MS".

Still, for most purposes, this should work fine.

Download the test build

Freitag, 19. August 2011

VLC win32 test build

I've built VLC for Windows against the latest code of the fonts branch, and of course with the FriBidi and HarfBuzz support from mainline. This means:

  • Arabic and Hebrew text works correctly (but no HarfBuzz support)
  • OpenType shaping works
  • The annoying "Building font cache" message is gone
However, currently only embedded fonts are supported. Usually most fonts are embedded in Matroska files, so this often is not a big issue.

Download the test build

Update: Download replaced by a new build with HarfBuzz support.

Donnerstag, 18. August 2011

--disable-fontconfig

With the latest commits to the fonts branch, I can say with some excitement that libass does reasonably work without fontconfig now. Embedded fonts work perfectly, and so does the fallback font (if specified).

Next stop: a public interface for providing information about system fonts.

Montag, 8. August 2011

Font handling: it's hard!

So far libass uses FontConfig for collecting font metadata and matching fonts. However, fontconfig isn't ideal for matching fonts in the way the ASS/SSA formats need it. These formats primarily use the "full name" for matching the font, that is, a name including style, such as "Arial Bold Italic". FontConfig does not match against this name at all, and there are various hacks in libass to work around that (badly).

If you dig deeper into it, you'll find out that font naming is a big and complicated mess. Let's sum up the facts:
  • Various different names exist, such as family name, full name, PostScript name, subfamily name, etc.
  • Most of these can be localized
  • Different platforms (such as Windows or Mac) can have individual names
So there's no such thing as a single name for a font at all! Gladly we don't really need to support all of these names (family name and full name seems to be good enough).

As a first step to get away from the FontConfig dependency I've implemented my own font sorter and matcher that is optimized for the needs of ASS/SSA. I've also begun to work on an interface (FontProvider) that allows various font sources (such as Windows DirectWrite or container-embedded fonts) to plug into libass. At the moment, this already allows libass to work without fontconfig when only embedded fonts are needed.

There are still some problems to solve with this new code, but in the meantime, it will live in the fonts branch, until it is ready for general consumption.

Sonntag, 31. Juli 2011

libass 0.9.13 released

A few days ago FreeType 2.4.6 was released, which contains the new stroker code, which unfortunately crashes with libass 0.9.12 under some circumstances. I've released a new bugfix release, 0.9.13, to remedy this. Get it at Google Code!

Note: this release does not contain the recent complex text layout work. It's 0.9.12 plus bugfixes.

Donnerstag, 28. Juli 2011

libass git repo on Google Code

Google Code recently introduced Git support, and at the same time repo.or.cz suffered from some reliability problems. Thus I've mirrored the repository at Google Code now. I will keep both repositories up to date.

Sonntag, 17. Juli 2011

New outline stroker from FreeType

FreeType recently received an update to its stroker, which supposedly fixes many rendering issues. And indeed it does! However, first I needed to fix the outline preprocessing in libass, since it wasn't very cleanly handling outline modifications. Now that this is fixed, here's a quick comparison of old vs. new stroker.

One font that has been very problematic for FreeType's stroker is Comiquita Sans. Previously, the outlines generated by the stroker were broken in pretty funny ways and this was clearly visible in the rendering:



The new stroker fixes these issues completely:


The new stroker is available in FreeType git master and will appear in the next FreeType release (2.4.6).