Getting special characters in PDF output.
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Getting special characters in PDF output.
Post by PeterRobertson »
I need to get some special characters in my PDF output.
In particular, I need to generate a line that starts with a solid right-pointing triangle. I have tried the following in my xml file:
and
both of which generate PDF output that gives a line starting with #.
How do I get the correct character?
In particular, I need to generate a line that starts with a solid right-pointing triangle. I have tried the following in my xml file:
Code: Select all
<screen>
▸
</screen>
Code: Select all
<screen>
▸
<\screen>
How do I get the correct character?
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
I have two problems when trying to follow your suggestion:
1: It seems to be replacing the font for the whole document.
All I want to do is to be able to use ONE character from a different
font. The actual character is unicode ► (a solid, right-pointing
triangle).
2: I have used "impact.ttf" as a font that includes the character I want.
When trying to display the output PDF, Acrobat gives the errors:
"A font required for font substitution is missing" and then "Cannot find or
create the font '1Ef314Impact'". I have no idea where this strange name
is being generated.
1: It seems to be replacing the font for the whole document.
All I want to do is to be able to use ONE character from a different
font. The actual character is unicode ► (a solid, right-pointing
triangle).
2: I have used "impact.ttf" as a font that includes the character I want.
When trying to display the output PDF, Acrobat gives the errors:
"A font required for font substitution is missing" and then "Cannot find or
create the font '1Ef314Impact'". I have no idea where this strange name
is being generated.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
The procedure explained in the article replaces the font for the whole document. To use a font only for a character in the PDF output you have to manually enclose that character alone in a <fo:block> element with the desired font-family in the intermediate FO document generated by the DocBook XSL stylesheet for FO output and received as input by the FOP processor. This manual modification is necessary because the DocBook stylesheet does not allow such a level of output control. In <oXygen/> you can do that by disabling FO processing in the transformation scenario - the FO Processor tab of the Edit scenario dialog, applying the scenario, modifying the generated FO document, then creating and applying a new transformation scenario on the FO document. In this scenario FO processing must be enabled and the radio button Edited document as input must be selected.
Best Regards,
Sorin
The procedure explained in the article replaces the font for the whole document. To use a font only for a character in the PDF output you have to manually enclose that character alone in a <fo:block> element with the desired font-family in the intermediate FO document generated by the DocBook XSL stylesheet for FO output and received as input by the FOP processor. This manual modification is necessary because the DocBook stylesheet does not allow such a level of output control. In <oXygen/> you can do that by disabling FO processing in the transformation scenario - the FO Processor tab of the Edit scenario dialog, applying the scenario, modifying the generated FO document, then creating and applying a new transformation scenario on the FO document. In this scenario FO processing must be enabled and the radio button Edited document as input must be selected.
Best Regards,
Sorin
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
If I understand what you have said, I would have to change each appearance of the character manually whenever I wish to generate the PDF file. The character appears over 200 times! This would render Docbook useless for any large project.
I hope I have misunderstood.
I hope I have misunderstood.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Finally I reproduced the error. You can see the error messagePeterRobertson wrote:When trying to display the output PDF, Acrobat gives the errors: "A font required for font substitution is missing" and then "Cannot find or create the font '1Ef314Impact'". I have no idea where this strange name is being generated.
Code: Select all
[ERROR] Failed to embed font [19] Impact: etc.
http://www.oxygenxml.com/doc/ug-oxygen/ ... arted.html
The path to the file impact.ttf is wrong in your FOP configuration file. This path must be specified relative to the source DocBook XML document. For example if docbook.xml is located in C:\Program Files\Oxygen 5.1\test\ and impact.ttf is located in C:\Windows\Fonts then you must specify in the FOP configuration file
Code: Select all
embed-file="../../../Windows/Fonts/impact.ttf"
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Probably enclosing the special character in a <para> tag with a role attribute and providing special handling for all these para elements in a DocBook customization layer is enough and no manual modification of the FO document is needed.PeterRobertson wrote:I would have to change each appearance of the character manually whenever I wish to generate the PDF file. The character appears over 200 times! This would render Docbook useless for any large project.
I hope this helps,
Sorin
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Post by PeterRobertson »
Thanks. That sounds more like it. I shall look into using "role".
On the question of finding the ttf files, if the path is relative to the original
Docbook document, (i.e., the one containing "<!DOCTYPE book ...") it
implies that I must have separate copies of the fonts for every different
document I am creating, either that, or I can only put my documents in
one directory, neither of which is very pleasant.
On the question of finding the ttf files, if the path is relative to the original
Docbook document, (i.e., the one containing "<!DOCTYPE book ...") it
implies that I must have separate copies of the fonts for every different
document I am creating, either that, or I can only put my documents in
one directory, neither of which is very pleasant.
-
- Posts: 47
- Joined: Mon Apr 18, 2005 2:22 pm
Characters from different fonts
Post by PeterRobertson »
Thanks to your help I have now managed to get the character from a different font into my document.
To do this I have added the new font to my FOP configuration:
I now define a 'special' role for a para:
and then create an entity:
I can now include the special character in text using:
To do this I have added the new font to my FOP configuration:
Code: Select all
<configuration>
<fonts>
<font metrics-file="impact.xml" kerning="yes"
embed-file="../../Windows/fonts/impact.TTF">
<font-triplet name="impact" style="normal" weight="normal"/>
</font>
</fonts>
</configuration>
Code: Select all
<xsl:template match="para[@role = 'special']">
<fo:inline>
<xsl:attribute name="font-family">impact</xsl:attribute>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
Code: Select all
<!ENTITY THING '<para role = "special">►</para>'>
Code: Select all
<para> The special character &THING; is used for ...</para>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Or you can specify an absolute path in the embed-file attribute so you don't have to put your documents in one directory or have copies of the fonts:PeterRobertson wrote:On the question of finding the ttf files, if the path is relative to the original Docbook document, (i.e., the one containing "<!DOCTYPE book ...") it implies that I must have separate copies of the fonts for every different document I am creating, either that, or I can only put my documents in one directory, neither of which is very pleasant.
Code: Select all
embed-file="file:/C:/Windows/Fonts/impact.ttf"
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service