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?

4

1 回答 1

2

是的,你错过了最重要的事情。普通字体不是粗体字体,它们是不同的东西,因此是不同的文件。在您的示例中,您将普通字体和粗体字体指向完全相同的 TTF 文件(阅读:字体文件)。即 helvetica-neue-lt-std-57-condensed.ttf。

因此,您告诉 FOP 对普通和粗体使用完全相同的字体文件,因此您会看到相同的输出。

要对此进行测试,请尝试将“粗体”条目指向您拥有的不同 TTF 文件。您将看到字符更改为该字体。

简而言之,“粗体”字体和“普通”字体不是从同一个 TTF 字体文件创建的,它们来自两个不同的文件。您应该将粗体条目指向具有粗体字形的不同文件。

哦,我应该补充一点,尽管您认为它在 Microsoft Word 中有效,但您确实错了。Word 要么 (1) 使用不同但相似的字体并且不告诉你,要么 (2) :fake" 通过膨胀字体中的像素来加粗。它没有使用完全不同的粗体字体,除非你真的在 Windows 中安装了它并且不知道。

于 2013-06-21T05:27:51.263 回答