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 Dobri Kitipov <dk...@vereo.bg> on 2005/07/26 13:53:17 UTC
Problems with embedded font
Hi everybody,
My question looks long but it is not =)
I have to generate pdf from xml. The pdf contains Cyrillic, so I generated the needed font with:
java -cp build\fop.jar;lib\avalon-framework.jar org.apache.fop.fonts.apps.TTFReader C:\WINNT\Fonts\arial.ttf ttfcyrillic.xml
I adopted the example related to XML2PDF case, shipped with fop (embedding.ExampleXML2PDF.java). I have changed some of the text in the projectteam.xml with Bulgarian text. In addition I have edited the projectteam2fo.xsl and added font-family="Cyrillic" :
Excerpt 1:
<!-- ========================= -->
<!-- child element: member -->
<!-- ========================= -->
<xsl:template match="member">
<fo:table-row>
<xsl:if test="function = 'lead'">
<xsl:attribute name="font-weight">bold</xsl:attribute>
</xsl:if>
<fo:table-cell>
<fo:block font-family="Cyrillic">
<xsl:value-of select="name"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="Cyrillic">
<xsl:value-of select="function"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="Cyrillic">
<xsl:value-of select="email"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
In userconfig.xml I have:
Excerpt 2:
<font metrics-file="ttfcyrillic.xml" kerning="yes" embed-file="file:///C:/WINNT/Fonts/arial.ttf">
<font-triplet name="Cyrillic" style="normal" weight="normal"/>
</font>
Here is the configuration code added in the examples:
Excerpt 3:
//Setup font configuration
File baseDir = new File(".");
File userConfiguration = new File(baseDir, "xml/config/userconfig.xml");
Options options = new Options(userConfiguration);
String fontBaseDir = "D:/Project/IdeaProjects/FOPTest/classes/config";
org.apache.fop.configuration.Configuration.put("fontBaseDir", fontBaseDir);
I have edited and set properly the userconfig.xml and the font in the above example. I am sure it is correct because when do the same with the simpler example FO2PDF ExampleFO2PDF.java everything work fine! The generated pdf properly display Cyrillic alphabets. When I open it in AdobeAcrobat and get file's properties there is only on font set - the one I have generated: Arial(Embedded).
The problem is when I do that in embedding.ExampleXML2PDF.java (with additionally added Excerpt 3). The generated pdf does not properly display Cyrillic alphabets. When I open it in AdobeAcrobat and get file's properties there are some additional fonts to the one I have generated(Arial(Embedded)). The additional fonts are: Times-Bold, Helvetica-Bold, Helvetica.
This is my real case I have xml and xsl and I want to generate pdf. When I run the modified example I see in the console ([ERROR] unknown font Cyrillic,normal,bold so defaulted font to any):
Real transformation strats ...
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
[ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
[ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
[ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
[ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
[ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[DEBUG] Last page-sequence produced 1 pages.
[INFO] Parsing of document complete, stopping renderer
[DEBUG] Initial heap size: 1013Kb
[DEBUG] Current heap size: 2786Kb
[DEBUG] Total memory used: 1772Kb
[DEBUG] Memory use is indicative; no GC was performed
[DEBUG] These figures should not be used comparatively
[DEBUG] Total time used: 734ms
[DEBUG] Pages rendered: 1
[DEBUG] Avg render time: 734ms/page
Real transformation ends ...
This is strange because it works fine when FO2PDF is used. Something wrong happens when transformation over xml with xsl take place.
Do anyone knows what the problem is?!?
PS The same is when I do that in the console.
Thank you in advance!
Dobri Kitipov
Software Expert
Vereo Technologies, Ltd.
mobile.:+359.88.806.1918
phone.:+359.2.854.8030
fax: +359.2.854.8010
HYPERLINK "http://www.vereo.bg/"www.vereo.bg
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.5/58 - Release Date: 25.07.2005
Re: Problems with embedded font
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Dobri Kitipov wrote:
> [ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
You don't seem to have a triple for a bold font in your userconfig.
FOP wont generate a bold weigth font from a normal font for you,
you have to supply one explicitely.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Problems with embedded font
Posted by Jeremias Maerki <de...@greenmail.ch>.
I think your problem simply is about not having a font-triplet for the
bold variant of the font (see error message). You will need to create an
additional XML font metric file from arialbd.ttf and register it
separately like this.
<font metrics-file="ttfcyrillic-bold.xml" kerning="yes" embed-file="file:///C:/WINNT/Fonts/arialbd.ttf">
<font-triplet name="Cyrillic" style="normal" weight="bold"/>
</font>
On 26.07.2005 13:53:17 Dobri Kitipov wrote:
<snip/>
> <font metrics-file="ttfcyrillic.xml" kerning="yes" embed-file="file:///C:/WINNT/Fonts/arial.ttf">
>
> <font-triplet name="Cyrillic" style="normal" weight="normal"/>
>
> </font>
<snip/>
> [ERROR] unknown font Cyrillic,normal,bold so defaulted font to any
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org