xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Register font to generate PDF/A-1b file
Date Thu, 27 Aug 2009 06:16:05 GMT
"Times-Roman" is clearly the base 14 font which seems to be triggered
somewhere for some reason. On first sight (and with the information
available) I'd say you did everything right. Have you tried to do the
same on the command-line just for comparison? On the command-line you
can also run the "-at out.at.xml" option (instead of "-pdf out.pdf") to
generate the area tree XML file which could give you some indication
where FOP doesn't use the TrueType font. Using SVG files inside the FO
document could also be a source of the problem.

Another possibility is to add additional font-triplet elements to the
font configuration to override the defaults:

<font metrics-url="tnr.xml" kerning="yes" embed-url="Times_New_Roman.ttf">
  <font-triplet name="Times New Roman" style="normal" weight="normal"/>
  <font-triplet name="Times" style="normal" weight="normal"/>
  <font-triplet name="serif" style="normal" weight="normal"/>
  <font-triplet name="any" style="normal" weight="normal"/>
</font>

BTW, if you use FOP 0.95 you don't need to do the TTFReader step and can
skip the metrics-url attribute in the configuration.

HTH

On 26.08.2009 18:02:09 ale.marino78 wrote:
> I'm trying to do generate a PDF/A-1b from xml and xsl. 
> 
> To do that first I creted a font metrics file with org.apache.fop.fonts.apps.TTFReader
as described in http://xmlgraphics.apache.org/fop/0.94/fonts.html#register. 
> Then I copied both the font file and the metrics file in the directory from which I'm
running the program. I'm using the font /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf
provided by the Ubuntu package msttcorefonts.
> 
> In the config file there are the following entries:
> ...
>   <base>/home/alexyz/workspace</base>
> ...
>    <font metrics-url="tnr.xml" kerning="yes" embed-url="Times_New_Roman.ttf">
>       <font-triplet name="Times New Roman" style="normal" weight="normal"/>
>    </font>
> 
> I put the attribute font-family="Times New Roman" in the tag fo:root to be sure to set
Times New Roman as default font, then in the xsl there's always the triplet:
> 
> 	font-family="Times New Roman" font-weight="normal" font-style="normal"
> 
> I took the Java code from http://www.mail-archive.com/fop-users@xmlgraphics.apache.org/msg08341.html
for the program that generates the pdf file. Unfortunately I get the exception:
> 
> WARNING: Font 'Times New Roman,normal,400' not found. Substituting with 'any,normal,400'.
> ERROR:  'For PDF/A-1b, all fonts, even the base 14 fonts, have to be embedded! Offending
font: /Times-Roman'
> javax.xml.transform.TransformerException: org.apache.fop.pdf.PDFConformanceException:
For PDF/A-1b, all fonts, even the base 14 fonts, have to be embedded! Offending font: /Times-Roman
>         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:718)
>         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
>         at it.alessandro.pdf.ExampleXML2PDF.main(ExampleXML2PDF.java:89)
> Caused by: org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all fonts, even
the base 14 fonts, have to be embedded! Offending font: /Times-Roman
>         at org.apache.fop.pdf.PDFFont.validate(PDFFont.java:161)
>         at org.apache.fop.pdf.PDFFont.output(PDFFont.java:170)
>         at org.apache.fop.pdf.PDFDocument.output(PDFDocument.java:937)
>         at org.apache.fop.pdf.PDFDocument.outputTrailer(PDFDocument.java:1010)
>         at org.apache.fop.render.pdf.PDFRenderer.stopRenderer(PDFRenderer.java:516)
>         at org.apache.fop.area.RenderPagesModel.endDocument(RenderPagesModel.java:240)
>         at org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:305)
>         at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:156)
>         at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endDocument(ToXMLSAXHandler.java:181)
> 
> It seems that the font is correctly registered. Am I doing something wrong ? Why is there
"/Times-Roman" instead of "/Times New Roman" ?
> 
> The file tnr.xml contains:
> 
>   <font-name>TimesNewRomanPSMT</font-name>
>   <full-name>Times New Roman</full-name>
>   <family-name>Times New Roman</family-name>
> 
> 
> Thanks and regards,
> Alessandro




Jeremias Maerki


---------------------------------------------------------------------
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