TTF Reader on Mac OS X

Here should go questions about transforming XML with XSLT and FOP.
Ron Stone
Posts: 3
Joined: Thu Dec 07, 2006 10:43 am
Contact:

TTF Reader on Mac OS X

Post by Ron Stone »

Hi,

I'm new to this forum. Just wanted to say that I was finally able to generate XML font metrics files for some of the fonts in a Mac OS X environment with the fop-0.92beta.

---------- /fop-0.92beta/ java classpath options and aguments ----------

build/fop.jar
lib/avalon-framework-4.2.0.jar
lib/commons-io-1.1.jar
lib/commons-logging-1.0.4.jar
lib/serializer-2.7.0.jar
lib/xml-apis-1.3.02.jar
lib/xercesImpl-2.7.1.jar
lib/xalan-2.7.0.jar org.apache.fop.fonts.apps.TTFReader /MyFonts/Verdana.ttf Verdana.xml

---------- end fop-0.92 options and arguments----------

---------- begin generated font metrics file ----------

TTF Reader for Apache FOP 0.92beta

Parsing font...
Reading /MyFonts/Verdana.ttf...
Number of glyphs in font: 893
3 cmap tables
CMAP format: 4
Creating xml font file...
Creating CID encoded metrics...
Writing xml font file Verdana.xml...
This font contains no embedding license restrictions.

XML font metrics file successfullly created.

---------- end generated file ----------

However a number of fonts would not generate the file (despite a conflicting confirmation) and I don't know particularly why.

Pre-FOP format? Licensing restriction? FOP Beta issue?

---------- begin no font metrics file ----------

TTF Reader for Apache FOP 0.92beta

Parsing font...
Reading /Users/doxanax/Documents/fomage/TimesRoman.ttf...
Number of glyphs in font: 1443
10 cmap tables
Unicode cmap table not present
Unsupported format: Aborting

XML font metrics file successfullly created.

---------- end no file ----------

I post a transformation question in the following post 'Docbook font customization'.
Ron Stone
Posts: 3
Joined: Thu Dec 07, 2006 10:43 am
Contact:

Docbook font customization

Post by Ron Stone »

Hi, I am new to Docbook. After setting up a custom Docbook PDF Scenario I tried to change a body font with

<xsl:param name="body.font.family">Arial</xsl:param>

and then saw the error

[ERROR] unknown font ZapfDingbats,normal,bold so defaulted font to any

Then a search for ZapfDingbats suggested the following parameters.

<xsl:param name="callout.unicode.font">Arial,regular,normal</xsl:param>
<xsl:param name="symbol.font.family">Arial,regular,normal</xsl:param>

At some point many of the characters in a table displayed as ##### however now they are all showing up as Times.

Right now my custom.xsl has the following parameters:

<xsl:param name="callout.unicode.font">Arial</xsl:param>
<xsl:param name="symbol.font.family">Arial</xsl:param>
<xsl:param name="body.font.family">Arial</xsl:param>

<xsl:attribute-set name="table.table.properties">
<xsl:attribute name="font-family">Mistral</xsl:attribute>
</xsl:attribute-set>

Yet the Configure Transformation Scenario for Docbook PDF v8.0 custom.xsl XSLT>Parameters>Configure parameters plist has saved the following preferences independent of custom.xsl:

body.font.family 'Arial'
callout.unicode.font 'TimesNewRoman'
symbol.font.family 'TimesNewRoman'

the XSL URL is custom.xsl

The FO Processor preference is also set for the fopConfiguration.xml font metrics file. I have re-checked the document Add font to FOP pdf a number of times. A ttfConvert.sh file is in the Oxygen installation directory, yet that shell script did not generate any font metrics files. So I tried fop-0.92beta which did generate many font metrics files.

I am getting many of the following font errors upon FOP, and the pdf displays Times font.

[ERROR] unknown font Mistral,normal,normal so defaulted font to any
[ERROR] unknown font TimesNewRoman,normal,normal so defaulted font to any

So why is the transformation generating unknown font errors?

Ron
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Docbook font customization

Post by sorin_ristache »

Hello,
Ron Stone wrote:However a number of fonts would not generate the file (despite a conflicting confirmation) and I don't know particularly why.

...

Unicode cmap table not present
Unsupported format: Aborting
This was discussed here. The TTF Reader can extract the metrics data only from Unicode enabled font files.
Ron Stone wrote:Right now my custom.xsl has the following parameters:

<xsl:param name="callout.unicode.font">Arial</xsl:param>
<xsl:param name="symbol.font.family">Arial</xsl:param>
<xsl:param name="body.font.family">Arial</xsl:param>

<xsl:attribute-set name="table.table.properties">
<xsl:attribute name="font-family">Mistral</xsl:attribute>
</xsl:attribute-set>

Yet the Configure Transformation Scenario for Docbook PDF v8.0 custom.xsl XSLT>Parameters>Configure parameters plist has saved the following preferences independent of custom.xsl:

body.font.family 'Arial'
callout.unicode.font 'TimesNewRoman'
symbol.font.family 'TimesNewRoman'

the XSL URL is custom.xsl
Do you mean that the Configure Transformation Scenario for Docbook PDF v8.0 scenario is associated with the custom.xsl file that contains

Code: Select all

<xsl:param name="callout.unicode.font">Arial</xsl:param>
and the Configure Parameters dialog for that scenario displays

Code: Select all

callout.unicode.font   'TimesNewRoman'
instead of the following ?

Code: Select all

callout.unicode.font   'Arial'
I cannot reproduce that. Please send us the custom.xsl file.
Ron Stone wrote:The FO Processor preference is also set for the fopConfiguration.xml font metrics file. ... I am getting many of the following font errors upon FOP, and the pdf displays Times font.

[ERROR] unknown font Mistral,normal,normal so defaulted font to any
[ERROR] unknown font TimesNewRoman,normal,normal so defaulted font to any

So why is the transformation generating unknown font errors?
The FOP config file that you sent by email contained wrong files in the embed-file attribute. Please specify the correct font files in the embed-file attribute and try again.


Regards,
Sorin
Ron Stone
Posts: 3
Joined: Thu Dec 07, 2006 10:43 am
Contact:

font unknown persists

Post by Ron Stone »

Sorin,

I was away for some weeks and have finally found some time to check on the unknown font issue again.

I changed the FOPconfig.xml file for Arial as follows:

<font metrics-file="Arial.xml" kerning="yes" embed-file="file://Users/Comet/Documents/MyFonts/Arial.xml">
<font-triplet name="Arial" style="normal" weight="normal"/></font>

The XSL stylesheet contains the following parameters:

------ begin xsl ------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">

<xsl:import href="/Applications/oxygen/frameworks/docbook/xsl/fo/docbook.xsl"/>

<xsl:param name="callout.unicode.font">/Users/Comet/Documents/MyFonts/Arial</xsl:param>
<xsl:param name="symbol.font.family">/Users/Comet/Documents/MyFonts/Arial</xsl:param>
<xsl:param name="body.font.family">/Users/Comet/Documents/MyFonts/Arial</xsl:param>

</xsl:stylesheet>

------ end xsl ------

And then upon transformation the following FOP error was thrown:

[ERROR] unknown font /Users/Comet/Documents/MyFonts/Arial,normal,normal so defaulted font to any

I have tried setting the xsl param as Arial, Arial.ttf, and Arial.xml however an unknown font error is thrown in each case. And in each case the resulting pdf is displayed in Times.

And the previous error without the filepath (<xsl:attribute name="font-family">Arial</xsl:attribute>) had caused transformation to stop completely:

[ERROR] Failed to read font metrics file file://Users/Comet/Documents/projects/docbook/ArialBlack.xml: //Users/Comet/Documents/projects/docbook/ArialBlack.xml (No such file or directory)
[ERROR] null
Process ended with exit code: 2

So far I have not yet found the information from apache xmlgraphics FOP documents either.

So I am still wondering why the FOP can't find the font specified in the xsl param?

Ron
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Ron Stone wrote:<xsl:param name="callout.unicode.font">/Users/Comet/Documents/MyFonts/Arial</xsl:param>
<xsl:param name="symbol.font.family">/Users/Comet/Documents/MyFonts/Arial</xsl:param>
<xsl:param name="body.font.family">/Users/Comet/Documents/MyFonts/Arial</xsl:param>
In the XSLT param you have to use the name of the font triplet (Arial, or ArialBlack) as specified in the article, not the path to the font file:

Code: Select all

<xsl:param name="body.font.family">Arial</xsl:param>
Ron Stone wrote:[ERROR] Failed to read font metrics file file://Users/Comet/Documents/projects/docbook/ArialBlack.xml: //Users/Comet/Documents/projects/docbook/ArialBlack.xml (No such file or directory)
As specified in the article a path specified in the FOP config file in the embed-file attribute must be a normal URL, that is file:/Users/Comet/... instead of file://Users/Comet/ ...


Regards,
Sorin
Post Reply