cairo


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/
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:
To get proper error messages from pango register a glib log handler, see below.
Pango assumes a specific folder-structure relative to the pango dll to look for some files. If the pango dll is located in /foo/bin or /foo it will try to locate "pango.modules" under /foo/etc/pango. That file contains information about where to find the pango module dlls. The easiest way I found was to place the pango module dlls under /foo/lib/pango/1.8.0/modules and then execute "pango-querymodules.exe > pango.modules" to generate the contents of the modules file and then manually remove the path, except for the actual dll filename. See below for the contents on my machine.
The actual problem which took me days to find out was this: I used SVGs which were exported from Adobe Illustrator and these contain text elements like this
<text style="font-family:'Arial'; font-size:20;">Foo Bar</text>
which looked fine to me, but the single quotation marks around the font family seem to be included and cause Pango to be unable to find the font 'Arial', because the fonts name is of course actually Arial and not 'Arial', if you know what I mean.
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:*

Related Links

Filling a custom-shaped Clutter Actor with a Cairo-drawn canvas
Why does Cairo.set_source_rgb paint the whole canvas?
Howto sub class a Clutter.Actor (involves Cairo/Clutter.Canvas)
'CAIRO_GOBJECT_TYPE_SURFACE' undeclared
Drawing in a Clutter Texture with Cairo
can't render text in cairo
Why when painting one source to another am i getting the wrong colors
Can I automatically flow two font styles in a Pango Cairo Layout?
Cairo Radial Gradient
How to create gradient between two curves?
Cairo in scrollable drawing area
Can cairo load a PDF?
How to get Pango Cairo to word wrap properly?
Using named colors with Cairo graphics
How does compositor work on X?
Getting started with cairo using java bindings on windows

Categories

HOME
sharepoint
spring
numpy
project-management
websphere
voip
ocaml
angular2-routing
label
playframework
hana
ubuntu-12.04
h2
rebol
quill
vsftpd
i2c
subquery
ipfs
powershell-v3.0
ndis
gatsby
public-key-encryption
activesync
rebol2
cloudflare
riak
bootstrap-popover
android-toolbar
yeoman-generator
saiku
jpeg2000
ms-access-2007
cython
sensu
apply
fop
jenkins-job-dsl
reactivemongo
phpspreadsheet
gettext
vmd
poco-libraries
topic-modeling
installshield-2012
floating-accuracy
android-maps-v2
spring-bean
pytest-django
startapp
spell-checking
in-memory-database
sqlexception
efxclipse
packagemaker
gameanalytics
dts
multiple-file-upload
scriptlet
altbeacon
acm
self-hosting
coldfusion-7
wikitext
fabric-twitter
textkit
apigee-baas
pyrocms
team-build
rx-groovy
coypu
java-melody
alphablending
yahoo-boss-api
late-static-binding
opensocial
sim900
osx-snow-leopard
astyanax
jqmobi
shortcuts
cgpath
mvccontrib
responsetext
hinstance
phpcrawl
libavformat
drawtext
open-graph-beta
aio
rtsp-client
graph-layout
system-codedom-compiler
project-lifecycle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App