cairopangolibrsvg

Pango unable to find fonts with librsvg


I'm using librsvg to render an SVG file to a Cairo context. Afterwards I "manually" render some text on top using Pango.

When rendering the SVG I get Pango warnings that it could not load the fonts:
"couldn't load font "'Calibri' Not-Rotated 16", falling back to "Sans Not-Rotated 16", expect ugly output."

The manual text rendering via Pango afterwards works perfectly fine. I tried multiple different font families and they all render just fine without any warnings.

I even skimmed through the librsvg source to see how it is using Pango but I couldn't see any major differences to what I am doing.

I have no idea left how to continue debugging this issue, any advice on how Pango is locating the fonts under Windows and what may influence its ability to find them is greatly appreciated.

If that matters:
I downloaded all needed binaries from here: http://sourceforge.net/projects/ezwinports/files/


Solution

  • I must concentrate to not think about the amount of time wasted on this issue or my brain would melt.

    Anyways, in case someone comes across this post I will share what I had to figure out till it worked:

    Pango message handler

    void PangoMessageHandler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
    {
        //TODO: handle log message
    }
    g_log_set_handler("Pango", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, PangoMessageHandler, NULL);
    

    pango.modules

    "pango-arabic-lang.dll" ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:*
    "pango-basic-win32.dll" BasicScriptEngineWin32 PangoEngineShape PangoRenderWin32 common:
    "pango-indic-lang.dll" devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:*
    "pango-indic-lang.dll" bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:*
    "pango-indic-lang.dll" guruIndicScriptEngineLang PangoEngineLang PangoRenderNone gurmukhi:*
    "pango-indic-lang.dll" gujrIndicScriptEngineLang PangoEngineLang PangoRenderNone gujarati:*
    "pango-indic-lang.dll" oryaIndicScriptEngineLang PangoEngineLang PangoRenderNone oriya:*
    "pango-indic-lang.dll" tamlIndicScriptEngineLang PangoEngineLang PangoRenderNone tamil:*
    "pango-indic-lang.dll" teluIndicScriptEngineLang PangoEngineLang PangoRenderNone telugu:*
    "pango-indic-lang.dll" kndaIndicScriptEngineLang PangoEngineLang PangoRenderNone kannada:*
    "pango-indic-lang.dll" mlymIndicScriptEngineLang PangoEngineLang PangoRenderNone malayalam:*
    "pango-indic-lang.dll" sinhIndicScriptEngineLang PangoEngineLang PangoRenderNone sinhala:*