xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Meyer <rme...@hotmail.co.uk>
Subject RE: Fonts and PDF/A: An epic struggle
Date Fri, 28 Jun 2013 13:45:19 GMT
Hi Hakan,

There is this section dealing with font substitutions with FOP:

http://xmlgraphics.apache.org/fop/trunk/fonts.html#font_substitution

That should explain most of what you asked, but I'll run through a quick example of how FOP
fonts are roughly configured and can be substituted.

In the *.xconf file, you'll have fonts in each section that configured like the following
for TTF:

    <font kerning="yes" embed-url="SomeFont.ttf">
      <font-triplet name="SomeFont" style="normal" weight="normal"/>
    </font>
SomeFont (in bold) will be the name by which the font can now be referred. It doesn't have
to match the name of the font, but can be anything. To reference that font from the FO, you
would use 

<fo:block font-family="SomeFont">Hello World</fo:block>

Therefore, to substitute that with another font, you can declare the following in the xconf:

<fop version="1.0">
  <fonts>
    <substitutions>
      <substitution>
        <from font-family="SomeFont"/>
        <to font-family="Times" font-weight="bold" font-style="italic"/>
      </substitution>
    </substitutions>
  </fonts>
</fop>
Times in this case would be the replacement font. The replacement can either be a base 14
(system font) or one that is declared like SomeFont is in the xconf.

Hope this helps,

Robert Meyer

> Date: Fri, 28 Jun 2013 06:12:43 -0700
> From: programvaruverkstad@yahoo.se
> To: fop-users@xmlgraphics.apache.org
> Subject: Fonts and PDF/A: An epic struggle
> 
> Hi,
> 
> I have problems generating PDF/A. The questions are at the end. I've had an
> intense struggle with fonts.
> 
> 1. Generating a plain PDF is no problem.
> 2. Add -pdfprofile PDF/A-1b and FOP tells you: /all fonts, even the base 14
> fonts, have to be embedded! Offending font: /Helvetica/ (the exclamation
> mark means it yells)
> 3. Why is there a slash in the font name in the exception message? Is it
> significant?
> 4. The exception and the doco seem to say, go get yourself the 14 base fonts
> and have them embedded.
> 5. I don't want to license the original fonts so I write a fop.config with
> the fonts I wish to use (Liberation) + a set of substitution elements,
> substituting Helvetica, Times (and Times-Roman), Courier to the
> corresponding Liberation.
> 6. No improvement, FOP still yells about embedding the base 14 fonts.
> 7. Gradually I discover that embedding the base 14 fonts may not be
> necessary at all. A more accurate requirement is: You have to embed whatever
> fonts are found in your FO file.
> 8. Originally the FO file contained generic font names like "serif" and
> "sans-serif". I tried to configure substitutions for them, but no luck.
> 9. After making sure the FO only contains Liberation fonts everything JUST
> WORKS.
> 
> Even though I have spent too many hours on this, I still don't have the big
> picture. I wish somebody could tell the story from beginning to end. The FOP
> documentation is bits and pieces. It's a pity because FOP itself is awesome.
> Questions:
> 
> -- Given a FO file, is there any way to configure FOP to substitute fonts
> for those defined in the FO?
> -- If the FO contains generic names like "serif" how does FOP select a
> specific font? Is it possible to configure substitutions for them?
> -- What is font substitution in the FOP config used for? Does it have any
> effect?
> 
> /Hakan
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Fonts-and-PDF-A-An-epic-struggle-tp38827.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
> 
 		 	   		  
Mime
View raw message