OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] embedding fonts in generated pdf


Hi,

Am Montag, 16. Juli 2012, 13:55:56 schrieb Stefan Seefeld:
> [...]
> 
> Ah ! I sense slowly a consistent picture forming in my mind. :-)

That's good. :-)

 
> Still, I seem to be missing some missing link. For example: Who or what
> caused the generated pdf to reference Type 1 fonts, and what would it
> take to switch to TrueType ?

Well, let me give you a short explanation. You start with the idea that you 
want to use a different font in your document. Here are the usual steps that I 
take:

1. Look for some fonts that seem to fit into your document. 
In practise, a serif font should "match" with a sans serif and also with a 
monospace font. 
Also take into account the license. Commercial fonts allow ONLY to embed the 
glyphs that are used, but NOT to include the complete font. 

2. Download or install the font.

3. Open the font in FontForge[1].
After you've opened the font, click Element > Font Info. That is needed to get 
the "real font name". For example, the normal Linux Libertine font file is 
named LinLibertine_R.otf, but the font name is "LinLibertineO".
I always have to try if I need the entry from the "Fontname" or the "Family 
Name". 
Maybe there is a better solution, but I found out this always worked for me.

4. Use the font name from the previous step.
Insert the font name(s) in the font-family attribute of your FO file:

  <fo:block font-family="LinLibertineO"> The quick brown fox ... </fo:block>

Usually, you don't do this step manually, but set the DocBook parameters 
body.font.family etc.

The FO spec allows also to "cascade" fonts, so in theory it is allowed to 
write this:

  <fo:block font-family="LinLibertineO,DejaVu"> The quick brown fox ...
  </fo:block>

That means, if a requested glyph cannot be found in Linux Libertine, FOP will 
search in the DejaVu font. I'm not sure, if FOP supports this. You have to try 
it out.

Be aware: If your font name from step 3 contains a space, wrap it in single 
quotes, for example font-family="'Foo Regular'"

5. Create a new FOP configuration file as described in 
http://xmlgraphics.apache.org/fop/trunk/fonts.html#basics

6. Format your document with FOP by using your configuration file from step 5, 
for example:
  $ fop -c myconfig.xml Book.fo Book.pdf


Hope the above steps makes it clearer for you.


Good luck! :-)


------
[1] http://fontforge.sourceforge.net/

-- 
Gruß/Regards
  Thomas Schraitle



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]