Pango/Cairo/Fontconfig: Making unicode font fallback/linking work properly in Windows

Viewed 1794

Recently, a windows user made us aware that Japanese (and other unicode) characters in our app don't display properly under Windows. He just gets boxes with numbers instead.

We're using Pango, Fontconfig/freetype and rendering with Cairo. In Unix (that is, both Linux and macOS) it works perfectly. However, under Windows we just can't seem to get it to work.

I imagine it has to do with how font fallback/linking works under Windows, but I have no idea even where to begin looking into making this work properly.

2 Answers

Linux systems are built around fontconfig and font substitution, so fonts available under Linux are curated to work well in that scenario.

It is very common to encounter in other systems fonts that do stupid stuff like mapping all the glyphs the font designer has not drawn yet to a placeholder symbol (typically squarish). When fontconfig encounters such a font it won't replace the missing glyphs with material from other fonts, since the font already declares something to display for those codepoints.

Another common case is non-latin fonts shipping quick and dirty latin glyphs so software that can not substitute fonts still displays errors in English. They require specific rules in fontconfig, to promote the useful part of the font, but not the fill-in one.

Related