You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by qnob <ku...@elca.ch> on 2009/07/15 09:45:36 UTC

Custom Type1 Font with Postscript Renderer

Hello,

there is already a similar thread about this issue, however, I've created a
new one, since the other  seems to be mixed up with other issues.

Anyway, I've been trying to configure a custom Type 1 font in order to
support Arial font for the Postscript renderer. Though, I don't get it work.
I use Ubuntu, SUN JDK 6 and FOP 0.95. By the way, I reproduced the same
problem with the FOP trunk.

First, I converted the TrueType Font:

$ sudo ttf2pt1 -a -b /usr/share/fonts/truetype/msttcorefonts/arial.ttf
/usr/share/fonts/type1/converted-mscore-fonts/arial


This results to the files arial.afm and  arial.pfb.

Second, I've added  the directory to the fop.xconfig:

      <fonts>
        <directory>/usr/share/fonts/type1/converted-mscore-fonts</directory>
      </fonts>

Nevertheless, the Arial font isn't applied by the ps renderer. When I run 
it, I get following error:

      [fop] Jul 13, 2009 8:42:37 AM
org.apache.fop.fonts.autodetect.FontInfoFinder find
      [fop] SEVERE: Unable to load font file:
file:/usr/share/fonts/type1/converted-mscore-fonts/arial.pfb. Reason: No PFM
file was found for
file:/usr/share/fonts/type1/converted-mscore-fonts/arial.pfb
      [fop] Jul 13, 2009 8:42:37 AM org.apache.fop.fonts.FontInfo
notifyFontReplacement
      [fop] WARNING: Font 'Arial,normal,400' not found. Substituting with
'any,normal,400'.
      [fop] Jul 13, 2009 8:42:37 AM org.apache.fop.fonts.FontInfo
notifyFontReplacement
      [fop] WARNING: Font 'Arial,normal,700' not found. Substituting with
'any,normal,700'.

The SEVERE message I only get in the first run after the conversion. For
FOP-trunk I don't get at all.

How do I have to configure this font in order to make it work correctly?

Thanks
Kuno

-- 
View this message in context: http://www.nabble.com/Custom-Type1-Font-with-Postscript-Renderer-tp24493320p24493320.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Custom Type1 Font with Postscript Renderer

Posted by juanmf <ju...@gmail.com>.


Vincent Hennebert-2 wrote:
> 
> In my experience the <directory> element in the config file doesn’t work
> well. The safest way to configure fonts is to do it ‘by hand’:
>   <fop version="1.0">
>     <font-base>file:///usr/share/fonts/</font-base>
>     <renderers>
>       <renderer mime="application/postscript">
>         <fonts>
>           
>             <font-triplet name="NimbusSansL" style="normal"
> weight="normal"/>
>           
>           
>             <font-triplet name="NimbusSansL" style="italic"
> weight="normal"/>
>           
>           
>             <font-triplet name="NimbusSansL" style="normal"
> weight="bold"/>
>           
>           
>             <font-triplet name="NimbusSansL" style="italic"
> weight="bold"/>
>           
>         </fonts>
>       </renderer>
>     </renderers>
>   </fop>
> 
> With the above config file, the Nimbus Sans L font should work for
> PostScript output in all its variants, both with FOP 0.95 (since PFM
> files are present in the same directory) and FOP Trunk.
> 
> ::
> HTH,
> Vincent
> 
> 
I had a similar issue, the <fonts><Directory></Directory></fonts> tags
didn't work for me (arch Linux, with the svn 0.95 version). With the format
that Vincent specified it worked perfectly with arial.ttf (yes, i didnt
pre-process the font files since I read that since 0.95 it wasn't
necessary).
Thanks for your post Vincent.
Here is my conf:


 <fop version="1.0">
    <font-base>file:///home/juan/dev/java/lib/fop/fonts/</font-base>
    <renderers>
      <renderer mime="application/postscript">
        <fonts>
          
            <font-triplet name="arial" style="normal" weight="normal"/>
          
          
            <font-triplet name="arial" style="normal" weight="bold"/>
          
          
            <font-triplet name="arial" style="italic" weight="bold"/>
          
          
            <font-triplet name="arial" style="italic" weight="normal"/>
          
        </fonts>
      </renderer>
      <renderer mime="application/pdf">
        <fonts>
          
            <font-triplet name="arial" style="normal" weight="normal"/>
          
          
            <font-triplet name="arial" style="normal" weight="bold"/>
          
          
            <font-triplet name="arial" style="italic" weight="bold"/>
          
          
            <font-triplet name="arial" style="italic" weight="normal"/>
          
        </fonts>
      </renderer>
    </renderers>
  </fop> 

Cheers.
Juan.

-- 
View this message in context: http://old.nabble.com/Custom-Type1-Font-with-Postscript-Renderer-tp24493320p27331359.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Custom Type1 Font with Postscript Renderer

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Kuno,

qnob wrote:
> Vincent,
> 
> thanks you for the complementary information, that I was missing in the
> actual documentation. It seams that this part of FOP is in development. 
> 
> The reason why I stick on Arial is, that I need to support different output
> renderer with an identical layout. And the Arial font is a requirement.
> Therefore, I want to try the different possibilities in order to achieve the
> best result. Anyway, after a few tests, Helvetica seams to me a reasonable
> alternative. 

When Arial was created, a requirement was that it have compatible
metrics with Helvetica. Although it’s not a clone (glyphs look slightly
different, for exemple ‘t’ and ‘a’), it’s close enough that people who
are not in the know don’t notice the difference. Nimbus Sans L, OTOH,
really is a clone of Helvetica, which means that its glyphs should look
identical.

So if you don’t use the additional glyphs available with the modern
Arial, you can probably safely switch between the two.


> I might investigate more time in order to get custom fonts working. So far,
> I didn't success, even with the trunk version.

In my experience the <directory> element in the config file doesn’t work
well. The safest way to configure fonts is to do it ‘by hand’:
  <fop version="1.0">
    <font-base>file:///usr/share/fonts/</font-base>
    <renderers>
      <renderer mime="application/postscript">
        <fonts>
          <font embed-url="type1/gsfonts/n019003l.pfb">
            <font-triplet name="NimbusSansL" style="normal" weight="normal"/>
          </font>
          <font embed-url="type1/gsfonts/n019023l.pfb">
            <font-triplet name="NimbusSansL" style="italic" weight="normal"/>
          </font>
          <font embed-url="type1/gsfonts/n019004l.pfb">
            <font-triplet name="NimbusSansL" style="normal" weight="bold"/>
          </font>
          <font embed-url="type1/gsfonts/n019024l.pfb">
            <font-triplet name="NimbusSansL" style="italic" weight="bold"/>
          </font>
        </fonts>
      </renderer>
    </renderers>
  </fop>

With the above config file, the Nimbus Sans L font should work for
PostScript output in all its variants, both with FOP 0.95 (since PFM
files are present in the same directory) and FOP Trunk.


> How to generate PFM file, I
> don't know at the moment.
> 
> Thanks a lot for your help.
> 
> Greets
> Kuno

HTH,
Vincent

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Custom Type1 Font with Postscript Renderer

Posted by qnob <ku...@elca.ch>.
Vincent,

thanks you for the complementary information, that I was missing in the
actual documentation. It seams that this part of FOP is in development. 

The reason why I stick on Arial is, that I need to support different output
renderer with an identical layout. And the Arial font is a requirement.
Therefore, I want to try the different possibilities in order to achieve the
best result. Anyway, after a few tests, Helvetica seams to me a reasonable
alternative. 

I might investigate more time in order to get custom fonts working. So far,
I didn't success, even with the trunk version. How to generate PFM file, I
don't know at the moment.

Thanks a lot for your help.

Greets
Kuno




Vincent Hennebert-2 wrote:
> 
> Hi Kuno,
> 
> FOP 0.95 can’t read AFM files, so it needs to get the font metrics
> through a PFM file. Maybe you can generate a PFM file instead of an AFM
> one with your conversion utility.
> 
> FOP Trunk can read AFM files, so the above should work with it. I’ve
> just tried with a Type 1 font and it correctly appears in the PostScript
> file.
> 
> But, do you really need to convert the Arial font in the first place? Do
> you use glyphs that aren’t available in the Helvetica clone provided
> with any Linux system? (This is the Nimbus Sans L font, have a look at
> /usr/share/fonts/type1/gsfonts/n019003l.{pfb,pfm,afm}.)
> 
> HTH,
> Vincent
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Custom-Type1-Font-with-Postscript-Renderer-tp24493320p24514766.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Custom Type1 Font with Postscript Renderer

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Kuno,

qnob wrote:
> Hello,
> 
> there is already a similar thread about this issue, however, I've created a
> new one, since the other  seems to be mixed up with other issues.
> 
> Anyway, I've been trying to configure a custom Type 1 font in order to
> support Arial font for the Postscript renderer. Though, I don't get it work.
> I use Ubuntu, SUN JDK 6 and FOP 0.95. By the way, I reproduced the same
> problem with the FOP trunk.
> 
> First, I converted the TrueType Font:
> 
<snip/>
> 
>       [fop] Jul 13, 2009 8:42:37 AM
> org.apache.fop.fonts.autodetect.FontInfoFinder find
>       [fop] SEVERE: Unable to load font file:
> file:/usr/share/fonts/type1/converted-mscore-fonts/arial.pfb. Reason: No PFM
> file was found for
> file:/usr/share/fonts/type1/converted-mscore-fonts/arial.pfb

FOP 0.95 can’t read AFM files, so it needs to get the font metrics
through a PFM file. Maybe you can generate a PFM file instead of an AFM
one with your conversion utility.

FOP Trunk can read AFM files, so the above should work with it. I’ve
just tried with a Type 1 font and it correctly appears in the PostScript
file.

But, do you really need to convert the Arial font in the first place? Do
you use glyphs that aren’t available in the Helvetica clone provided
with any Linux system? (This is the Nimbus Sans L font, have a look at
/usr/share/fonts/type1/gsfonts/n019003l.{pfb,pfm,afm}.)

HTH,
Vincent

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org