View Full Version : Problem embedding font for Sanskrit


northstar7
05-14-2012, 11:30 PM
I have been trying to embed the Liberation font in an ebook that includes quotations in Sanskrit, which include a lot of diacritical marks.

The marks appear in a few readers, but not in ADE. I have tried many different things, but the letters with diacriticals appear as rectangles with X's inside or they're just blank.

I have read that the Liberation font includes a large number of unicode glyphs and that it should work for this application. However, when I have downloaded the font -- multiple times -- I sometimes see that only about 700 glyphs are included. I am wondering if it could be that I'm not getting the glyphs I need.

If anyone can help me figure this one out, I'd be very grateful. I'd be happy to post what I'm doing if it seems like it would help.

Does it matter whether I use ttf or otf version?

Thanks a lot.

Toxaris
05-15-2012, 03:42 AM
The first action would be making sure the font contains the glyphs you need. Then, if you embed the font correctly, it will work in ADE.
A few pointers:
1. mind the case of font-name. Not only the file, but also the name and family itself.
2. make sure you specify the @font-face correctly
3. make sure you specify the font in a class attached to the text

Doitsu
05-15-2012, 04:07 AM
ADE can handle combined glyphs. Most likely your problems were caused by the font. For example Annapurna SIL (http://scripts.sil.org/AnnapurnaSIL) works fine, but contains only basic Devanagari characters.

northstar7
05-20-2012, 01:15 PM
Hi. Thanks very much for your replies. They are very helpful.

However, there are two points you mention that I have been unable to figure out. I've googled them both with no luck.

The first is: How do you confirm that a particular glyph exists in a font? The best I've been able to do on this is to open Word, choose the font and enter the unicode for the glyph. Unfortunately, I've found that while the glyph appears in Word, it's still missing in ADE.

Second: Where can I find the exact name of the font that should be used in the CSS. The only approach I've been able to find is to open the font in a text editor. However, this doesn't reveal very much.

Any suggestions as to how to carry out these two tasks would be much appreciated.

Thanks

Jellby
05-20-2012, 02:05 PM
The first is: How do you confirm that a particular glyph exists in a font? The best I've been able to do on this is to open Word, choose the font and enter the unicode for the glyph. Unfortunately, I've found that while the glyph appears in Word, it's still missing in ADE.

I guess the best way is to open the font with a font editor such as FontForge

Second: Where can I find the exact name of the font that should be used in the CSS. The only approach I've been able to find is to open the font in a text editor. However, this doesn't reveal very much.

You can use whichever name you want, but you have to define it and embed the font file(s) in the ePub, like this:

@font-face {
font-family: "Roman Antique";
font-weight: bold;
font-style: normal;
src: url("../fonts/RomanAntique-Italic.otf") format("opentype");
}

h1, h2, h3 {
font-family: "Roman Antique";
font-weight: bold;
}

The bold parts have to match, but they could say "foobar" or whatever. Note that in the @font-face block I'm defining the "Roman Antique" bold upright (not italic) font to use the RomanAntique-Italic.otf file, if I have different files for regular and italic variants, I should define each of them, all with the same font-family.

Doitsu
05-20-2012, 02:08 PM
The first is: How do you confirm that a particular glyph exists in a font?
You can use BabelMap (http://www.babelstone.co.uk/Software/BabelMap.html) to see all glyphs or simply use the Annapurna SIL Devanagari font that I suggested.

The best I've been able to do on this is to open Word, choose the font and enter the unicode for the glyph. Unfortunately, I've found that while the glyph appears in Word, it's still missing in ADE.
ADE, will only display the glyph if you correctly embed it in the ePub. Open your ePub with Sigil (http://code.google.com/p/sigil/) and click the green checkmark to find out, if your font is actually correctly referenced.

Second: Where can I find the exact name of the font that should be used in the CSS. The only approach I've been able to find is to open the font in a text editor. However, this doesn't reveal very much.
You can use any name that you like. The only thing that ADE cares about is that the font path is correct. For an example, open my Devanagari ePub with Sigil.

caraka
07-09-2012, 10:51 AM
@northstar7

I too am working on an ebook that embeds romanized sanskrit with lots of diacriticals. I have embedded Libertine successfully and the Sigil validation passes the epub and the embedding works in my Nook and other android readers I use, but not ADE. Have you had any joy?
FYI, the devanagari script isn't included in Linux Libertine, but the Latin Extended Additional segement IS included. (It contains all the less common diacriticals you may be searching for, such as ṛ, ḥ, ṅ etc.)

caraka
07-09-2012, 10:53 AM
Lol @northstar7
lets just say that was n-dot-above, h-dot-below and s-dot-below!
It will be useful when forum software supports unicode too!

Jellby
07-10-2012, 05:05 AM
You mean ṅ, ḥ, ṣ? Those are supported all right by the forum, it must be something with your copy-pasting...

Toxaris
07-10-2012, 09:37 AM
@northstar7

I have embedded Libertine successfully and the Sigil validation passes the epub and the embedding works in my Nook and other android readers I use, but not ADE.

I doubt that it has been embedded correctly to be honest. ADE supports embedding fonts quite well, so if it doesn't work on ADE either the font doesn't work on ADE (which is rare, but happens) or the font-embedding is not quite correct.

With ADE you must really mind you p's and q's with regards to the stylesheet. A small mistake in the stylesheet will make ADE ignore the stylesheet and thus font embedding. Try to validate your stylesheet.

caraka
07-18-2012, 12:10 AM
Thanks Toxaris. I have validated with http://jigsaw.w3.org/css-validator/validator and all is well with the css, but not withing ADE. Any other suggestions? (Or perhaps another validator to suggest?)

Toxaris
07-18-2012, 03:47 AM
Can you post your stylesheet and a part of the XHTML which you want to display in that font? Please note, I would like to see the code of the XHTML page.