[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Problem with displaying vertex's label text in Chinese char
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Problem with displaying vertex's label text in Chinese characters |
Date: |
Mon, 5 May 2014 21:36:10 +0200 |
> This is most likely a font problem. The default font igraph is using to
> draw the text labels does not have the characters present.
Indeed this is the case. Apparently, the default font in Cairo (the rendering
library that igraph uses) does not contain Chinese characters on Linux and Mac
OS X, although it seems to use an appropriate font on Windows. For Linux and
Mac OS X, the solution is to load a Chinese TrueType font using FreeType,
construct a Cairo context that uses this font by default, and then make igraph
draw on that context. The following example shows how to load a TrueType font
using FreeType:
http://cairographics.org/freetypepython/
The entire process is very fragile and depends a lot on the internals of Cairo
and FreeType. I tried it a few years ago and it worked at that time but since
both Cairo and FreeType have been developed further since then, I don’t know
whether it actually works now or not.
--Â
T.