Forum How do I...?

Arabic fonts / how to find what fonts contain a given glyph

euler
Hi All

I'm having some difficulty getting a couple of characters to render in prince PDFs:

ر.س

My normal process for getting new glyphs working goes something like this (I'm in centos linux, using prince 7):

1) Guess at and install the fonts RPM (in this case, I tried fonts-arabic; also tried linux libertine, both no luck)
2) use fc-list to show what fonts are available on the server
3) add the new fonts to /usr/lib/prince/style/fonts.css

This has worked for me in the past with chinese, korean, and thai, but not with these characters.
The hard part is that initial guess. So, I have a couple of questions:

1) Does anyone know of a way to determine if a given glyph exists in a given font - or better, to scan all of the fonts available on the system and tell me which font it's in?
2) If it's not found, is there someplace I can go on the internet to basically ask "what font provides this glyph"?

Thanks!
jim_albright
SIL ViewGlyph — Font Viewing Program
Author: Bob Hallissy, NRSI
Version: 1.81
Date: 2009-10-01

You should be able to google to find this program. It may be of help to you. Free.

Jim Albright
Wycliffe Bible Translators

euler
That looks handy; anyone know of something similar for Linux?
mikeday
How about "fc-list :lang=ar"?
euler
mikeday wrote:
How about "fc-list :lang=ar"?


Thanks for the input, but that just provides a list of all the fonts for that lang; it doesn't tell me if a given glyph is contained in any of them -- which is really the problem I'm having.

So, I get:

KacstArt:style=KacstArt
KacstBook:style=KacstBook
KacstDecorative:style=KacstDecorative
KacstDigital:style=KacstDigital
KacstFarsi:style=KacstFarsi
KacstLetter:style=KacstLetter
KacstPoster:style=KacstPoster
KacstQura:style=KacstQura
KacstQuran:style=KacstQuran
KacstTitle:style=KacstTitle
KacstTitleL:style=KacstTitleL
PakTypeNaqsh:style=Regular
PakTypeTehreer:style=Regular

But I've tried them all and prince is still not rendering "ر.س" correctly.

Any help greatly appreciated.
mikeday
Are you getting error messages resulting in ? question mark characters in the PDF? Or does it just look wrong? I've tried using Times New Roman and KacstBook, and it looks okay to me, the same as in the browser. I'm not an Arabic expert, though.
euler
Thanks for the reply.

What I'm getting is ر.Ø3

I've tried a few different things; I noticed that originally, the prince debug output looked like this:

prince: debug: font request: serif
prince: debug: font scan: Times New Roman
prince: debug: font scan: Times New Roman, 4 matches
prince: debug: font scan: KacstBook
prince: debug: font scan: KacstBook, 1 matches
prince: debug: font scan: Kinnari
prince: debug: font scan: Kinnari, 6 matches
prince: debug: font scan: Norasi
prince: debug: font scan: Norasi, 6 matches
prince: debug: font scan: DejaVu LGC Serif
prince: debug: font scan: DejaVu LGC Serif, 4 matches
prince: debug: font scan: Sazanami Mincho
prince: debug: font scan: Sazanami Mincho, 2 matches
prince: debug: font scan: AR PL ShanHeiSun Uni
prince: debug: font scan: AR PL ShanHeiSun Uni, 2 matches
prince: debug: font scan: Baekmuk Dotum
prince: debug: font scan: Baekmuk Dotum, 1 matches
prince: used font: Times New Roman, Regular


So I assume prince is not using the arabic font at all. If I remove the TimesNewRoman from my /usr/lib/prince/style/fonts.css, I get:

prince: debug: font request: serif
prince: debug: font scan: KacstBook
prince: debug: font scan: KacstBook, 1 matches
prince: debug: font scan: Kinnari
prince: debug: font scan: Kinnari, 6 matches
prince: debug: font scan: Norasi
prince: debug: font scan: Norasi, 6 matches
prince: debug: font scan: DejaVu LGC Serif
prince: debug: font scan: DejaVu LGC Serif, 4 matches
prince: debug: font scan: Sazanami Mincho
prince: debug: font scan: Sazanami Mincho, 2 matches
prince: debug: font scan: AR PL ShanHeiSun Uni
prince: debug: font scan: AR PL ShanHeiSun Uni, 2 matches
prince: debug: font scan: Baekmuk Dotum
prince: debug: font scan: Baekmuk Dotum, 1 matches
prince: used font: KacstBook, KacstBook
prince: used font: DejaVu LGC Serif, Book


so, it at least appears to be using that font, but I still get garbage ( ر.Ø3 instead of ﺭ.ﺱ ) in the PDF.

I don't have any control over the content of what is being sent to prince, so I can't wrap sections of text to force a given font...but thus far I haven't needed to, as prince seems to use the appropriate font, assuming I order them correctly in /usr/lib/prince/style/fonts.css .

Any additional thoughts? Again, greatly appreciated.
mikeday
That looks like a character encoding issue, not a font issue. If you are using HTML, try adding this at the beginning of the document head:
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
euler
Thanks Mike -
That did the trick in my test.
euler
(Also, for those looking for a utility that provides a list of possible fonts given a character, try http://www.fileformat.info/info/unicode/char/search.htm )