0

I use an embedded font in an apache fop 1.0 environment:

<fo:block-container  
  right="10mm" position="absolute">
  <fo:block font-family="hnlt57con" >
    my text
  </fo:block>
</fo:block-container>

The configfile looks like this:

<fop version="1.0">
  <renderers>
   <renderer mime="application/pdf">
   <fonts>
       <font kerning="no" embed-url="Y:/test/helvetica-neue-lt-std-57-condensed.ttf" embedding-mode="subset">
           <font-triplet name="hnlt57con" style="normal" weight="normal" />
       </font>         
   </fonts>
   </renderer>
</renderers>

This works fine, the text is rendered in the font hnlt57con.

What i want do now is render some text in bold:

<fo:block-container  
  right="10mm" position="absolute">
  <fo:block font-family="hnlt57conbold" font-weight="bold"  >
    my text
  </fo:block>
</fo:block-container>

The configfile looks like this:

<fop version="1.0">
  <renderers>
   <renderer mime="application/pdf">
   <fonts>
       <font kerning="no" embed-url="Y:/test/helvetica-neue-lt-std-57-condensed.ttf" embedding-mode="subset">
           <font-triplet name="hnlt57con" style="normal" weight="normal" />
       </font>
       <font kerning="no" embed-url="Y:/test/helvetica-neue-lt-std-57-condensed.ttf" embedding-mode="subset">
           <font-triplet name="hnlt57conbold" style="normal" weight="bold" />                 
       </font>       
   </fonts>
   </renderer>
</renderers>

Unfortunately a the text is not renderes in bold, but in the same way as in the example above.

Adding an additional font-triplet (as sugessted in http://www.scriptorium.com/whitepapers/fop_fonts/FOP_fonts5.html) does not change anything:

<fop version="1.0">
  <renderers>
   <renderer mime="application/pdf">
   <fonts>
       <font kerning="no" embed-url="Y:/test/helvetica-neue-lt-std-57-condensed.ttf" embedding-mode="subset">
           <font-triplet name="hnlt57con" style="normal" weight="normal" />
       </font>
       <font kerning="no" embed-url="Y:/test/helvetica-neue-lt-std-57-condensed.ttf" embedding-mode="subset">
           <font-triplet name="hnlt57conbold" style="normal" weight="bold" />
           <font-triplet name="hnlt57conbold" style="normal" weight="700" />
       </font>            
   </fonts>
   </renderer>
</renderers>

The helvetica-neue-lt-std-57-condensed.ttf is a font that i converted myself from helvetica-neue-lt-std-57-condensed.otf using fontforge.

My questions:

How can i render some text in bold in an embedded font?

Is it possible, that the font is not usable in bold, since it is converted from an otf? In MS-Word however i can use it in bold.

Am i missing something?

tyler
  • 193
  • 1
  • 3
  • 11

1 Answers1

2

Yes, you are missing the most important thing. A normal font is not a bold font, they are different things and hence different files. in your example, you are pointing the normal font and the bold font to the exact same TTF file (read: font file). Namely helvetica-neue-lt-std-57-condensed.ttf.

So you are telling FOP to use the exact same font file for both normal and bold and hence you see the same output.

To test this, try pointing the "bold" entry to a different TTF file you have. You will see the characters change to that font.

In short, "bold" fonts and "normal" fonts are not created from the same TTF font file, they are from two different files. You should be pointing the bold entry to a different file that has bolded glyphs.

Oh, and I should add, despite that fact that you think it works in Microsoft Word, you are truly mistaken. Word is either (1) using a different but similar font and not telling you or (2) :fake" bolding by bloating the pixels in the font. It is not using the exact different bold font unless you really have it installed in Windows and do not know it.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38
  • thank you for the answer, i was suspecting that, but was misled by ms word. obviously apache fop is not able to 'fake'. – tyler Jun 21 '13 at 10:05
  • @tyler: That is a good thing. Simulated bolding (or slanting for italic) can lead to really poor results in some fonts. IMHO, I would rather have a professionally designed font and not one ruined by some interpretation of bolding. – Kevin Brown Jun 22 '13 at 19:23
  • well, by now i got a bold version of the font in question, problem solved in the preferable way. thanks a lot! – tyler Jun 24 '13 at 07:19