[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-user
Subject:    Re: # problem
From:       Teus Benschop <teus () teusbenschop ! nl>
Date:       2005-12-26 8:34:02
Message-ID: 43AFAAFA.1060901 () teusbenschop ! nl
[Download RAW message or body]

You are lucky, because somebody just mailed the below information to me.

Teus.


I have figured out how to get FOP to use a Unicode font so it will 
include the Unicode characters.
I can do it manually by telling it to load a user configuration file.  
I've attached the user config file which works for using the Charis SIL 
font family. You also have to create font metrics files for your fonts 
with the TTF reader utility, as described on the FOP web site
http://xmlgraphics.apache.org/fop/0.20.5/fonts.html

------------------------------------------------------------------------

<!--<!DOCTYPE configuration SYSTEM "config.dtd">-->
<!-- 
     this file contains templates which allow an user easy 
     configuration of Fop. Actually normally you don't need this configuration 
     file, but if you need to change configuration, you should
     always use this file and *not* config.xml. 
     Usage: java org.apache.fop.apps.Fop -c userconfig.xml -fo fo-file -pdf pdf-file
-->


<configuration>

<!--  
baseDir: normally the base directory is the directory where the fo file is 
         located. if you want to specify your own, uncomment this entry.
         This value can also be a URL. Actually, the value is converted to 
         a URL.
-->
<!-- 
  <entry>
    <key>baseDir</key>
    <value></value>
  </entry>
-->

<!--  
fontBaseDir: Similar to baseDir, except that this value is used for fonts. If
         it isn't specified, the value from baseDir is used.
-->
<!-- 
  <entry>
    <key>fontBaseDir</key>
    <value></value>
  </entry>
-->

<!--
************************************************************************
                        HYPHENATION 
************************************************************************
-->
  
<!--
   hyphenation directory 
   if you want to specify your own directory with hyphenation pattern
   then uncomment the next entry and add the directory name
-->

<!--
  <entry>
    <key>hyphenation-dir</key>
    <value>/java/xml-fop/hyph</value>
  </entry>
-->

<!--
************************************************************************
  Add fonts here
************************************************************************
-->

<fonts>
<font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILR.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILR.ttf">  <font-triplet name="Charis \
SIL" style="normal" weight="normal"/>  </font>
 <font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILB.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILB.ttf">  <font-triplet name="Charis \
SIL" style="normal" weight="bold"/>  </font>
 <font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILI.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILI.ttf">  <font-triplet name="Charis \
SIL" style="italic" weight="normal"/>  </font>
 <font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILBI.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILBI.ttf">  <font-triplet name="Charis \
SIL" style="italic" weight="bold"/>  </font>
<font metrics-file="/usr/X11R6/lib/x11/fonts/lucsansu.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/l_0646.ttf">  <font-triplet name="Lucida Sans \
Unicode" style="normal" weight="normal"/>  </font>
 <!-- example -->
 <!--
 <font metrics-file="arial.xml" kerning="yes" embed-file="arial.ttf">
    <font-triplet name="Arial" style="normal" weight="normal"/>
    <font-triplet name="ArialMT" style="normal" weight="normal"/>
 </font>
 <font metrics-file="arialb.xml" kerning="yes" embed-file="arialb.ttf">
    <font-triplet name="Arial" style="normal" weight="bold"/>
    <font-triplet name="ArialMT" style="normal" weight="bold"/>
 </font>
 <font metrics-file="ariali.xml" kerning="yes" embed-file="ariali.ttf">
    <font-triplet name="Arial" style="italic" weight="normal"/>
    <font-triplet name="ArialMT" style="italic" weight="normal"/>
 </font>
 <font metrics-file="arialbi.xml" kerning="yes" embed-file="arialbi.ttf">
    <font-triplet name="Arial" style="italic" weight="bold"/>
    <font-triplet name="ArialMT" style="italic" weight="bold"/>
 </font>
 -->
 <!-- Example Japanese fonts
 <font metrics-file="msgothic.xml" embed-file="D:\winnt\font\msgothic.ttc" \
kerning="yes">  <font-triplet name="Gothic" style="normal" weight="normal"/>
    <font-triplet name="Gothic" style="normal" weight="bold"/>
    <font-triplet name="Gothic" style="italic" weight="normal"/>
    <font-triplet name="Gothic" style="italic" weight="bold"/>
 </font>
 <font metrics-file="msmincho.xml" embed-file="Cyberbit.ttf" kerning="yes">
    <font-triplet name="Mincho" style="normal" weight="normal"/>
    <font-triplet name="Mincho" style="normal" weight="bold"/>
    <font-triplet name="Mincho" style="italic" weight="normal"/>
    <font-triplet name="Mincho" style="italic" weight="bold"/>
   </font>
  -->
</fonts>


</configuration>




------------------------------------------------------------------------


To make FOP read the userconfig.xml file,  on the command line I have to 
specify the -c option followed by the userconfig file name.



Sheraz Bashir wrote:
> 
> Hi everyone,
> 
> 
> 
> Some Unicode characters appear as '# ' in pdf. My guess is that 
> probably FOP does not find the character mapping of that character 
> which causes FOP to render # instead of that character. For example, 
> the square root symbol appears as # in output pdf.
> 
> 
> 
> Is there a way in which we can manually add these mappings in FOP?
> 
> 
> 
> Thanks,
> 
> babz
> 


[Attachment #3 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You are lucky, because somebody just mailed the below information to me.<br>
<br>
Teus.<br>
<br>
<br>
I have figured out how to get FOP to use a Unicode font so it will
include the Unicode characters.
<br>
I can do it manually by telling it to load a user configuration
file.&nbsp; I've attached the user config file which works for using the
Charis SIL font family. You also have to create font metrics files for
your fonts with the TTF reader utility, as described on the FOP web
site
<br>
<a class="moz-txt-link-freetext"
 href="http://xmlgraphics.apache.org/fop/0.20.5/fonts.html">http://xmlgraphics.apache.org/fop/0.20.5/fonts.html</a>
 <br>
<div class="moz-text-plain" wrap="true" graphical-quote="true"
 style="font-family: -moz-fixed; font-size: 12px;" lang="x-unicode">
<pre wrap="">
<hr size="4" width="90%">
&lt;!--&lt;!DOCTYPE configuration SYSTEM "config.dtd"&gt;--&gt;
&lt;!-- 
     this file contains templates which allow an user easy 
     configuration of Fop. Actually normally you don't need this configuration 
     file, but if you need to change configuration, you should
     always use this file and <b class="moz-txt-star"><span
 class="moz-txt-tag">*</span>not<span class="moz-txt-tag">*</span></b> config.xml. 
     Usage: java org.apache.fop.apps.Fop -c userconfig.xml -fo fo-file -pdf pdf-file
--&gt;


&lt;configuration&gt;

&lt;!--  
baseDir: normally the base directory is the directory where the fo file is 
         located. if you want to specify your own, uncomment this entry.
         This value can also be a URL. Actually, the value is converted to 
         a URL.
--&gt;
&lt;!-- 
  &lt;entry&gt;
    &lt;key&gt;baseDir&lt;/key&gt;
    &lt;value&gt;&lt;/value&gt;
  &lt;/entry&gt;
--&gt;

&lt;!--  
fontBaseDir: Similar to baseDir, except that this value is used for fonts. If
         it isn't specified, the value from baseDir is used.
--&gt;
&lt;!-- 
  &lt;entry&gt;
    &lt;key&gt;fontBaseDir&lt;/key&gt;
    &lt;value&gt;&lt;/value&gt;
  &lt;/entry&gt;
--&gt;

&lt;!--
************************************************************************
                        HYPHENATION 
************************************************************************
--&gt;
  
&lt;!--
   hyphenation directory 
   if you want to specify your own directory with hyphenation pattern
   then uncomment the next entry and add the directory name
--&gt;

&lt;!--
  &lt;entry&gt;
    &lt;key&gt;hyphenation-dir&lt;/key&gt;
    &lt;value&gt;/java/xml-fop/hyph&lt;/value&gt;
  &lt;/entry&gt;
--&gt;

&lt;!--
************************************************************************
  Add fonts here
************************************************************************
--&gt;

&lt;fonts&gt;
&lt;font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILR.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILR.ttf"&gt;  &lt;font-triplet \
name="Charis SIL" style="normal" weight="normal"/&gt;  &lt;/font&gt;
 &lt;font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILB.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILB.ttf"&gt;  &lt;font-triplet \
name="Charis SIL" style="normal" weight="bold"/&gt;  &lt;/font&gt;
 &lt;font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILI.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILI.ttf"&gt;  &lt;font-triplet \
name="Charis SIL" style="italic" weight="normal"/&gt;  &lt;/font&gt;
 &lt;font metrics-file="/usr/X11R6/lib/x11/fonts/CharisSILBI.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/CharisSILBI.ttf"&gt;  &lt;font-triplet \
name="Charis SIL" style="italic" weight="bold"/&gt;  &lt;/font&gt;
&lt;font metrics-file="/usr/X11R6/lib/x11/fonts/lucsansu.xml" kerning="yes" \
embed-file="/usr/X11R6/lib/x11/fonts/l_0646.ttf"&gt;  &lt;font-triplet name="Lucida \
Sans Unicode" style="normal" weight="normal"/&gt;  &lt;/font&gt;
 &lt;!-- example --&gt;
 &lt;!--
 &lt;font metrics-file="arial.xml" kerning="yes" embed-file="arial.ttf"&gt;
    &lt;font-triplet name="Arial" style="normal" weight="normal"/&gt;
    &lt;font-triplet name="ArialMT" style="normal" weight="normal"/&gt;
 &lt;/font&gt;
 &lt;font metrics-file="arialb.xml" kerning="yes" embed-file="arialb.ttf"&gt;
    &lt;font-triplet name="Arial" style="normal" weight="bold"/&gt;
    &lt;font-triplet name="ArialMT" style="normal" weight="bold"/&gt;
 &lt;/font&gt;
 &lt;font metrics-file="ariali.xml" kerning="yes" embed-file="ariali.ttf"&gt;
    &lt;font-triplet name="Arial" style="italic" weight="normal"/&gt;
    &lt;font-triplet name="ArialMT" style="italic" weight="normal"/&gt;
 &lt;/font&gt;
 &lt;font metrics-file="arialbi.xml" kerning="yes" embed-file="arialbi.ttf"&gt;
    &lt;font-triplet name="Arial" style="italic" weight="bold"/&gt;
    &lt;font-triplet name="ArialMT" style="italic" weight="bold"/&gt;
 &lt;/font&gt;
 --&gt;
 &lt;!-- Example Japanese fonts
 &lt;font metrics-file="msgothic.xml" embed-file="D:\winnt\font\msgothic.ttc" \
kerning="yes"&gt;  &lt;font-triplet name="Gothic" style="normal" weight="normal"/&gt;
    &lt;font-triplet name="Gothic" style="normal" weight="bold"/&gt;
    &lt;font-triplet name="Gothic" style="italic" weight="normal"/&gt;
    &lt;font-triplet name="Gothic" style="italic" weight="bold"/&gt;
 &lt;/font&gt;
 &lt;font metrics-file="msmincho.xml" embed-file="Cyberbit.ttf" kerning="yes"&gt;
    &lt;font-triplet name="Mincho" style="normal" weight="normal"/&gt;
    &lt;font-triplet name="Mincho" style="normal" weight="bold"/&gt;
    &lt;font-triplet name="Mincho" style="italic" weight="normal"/&gt;
    &lt;font-triplet name="Mincho" style="italic" weight="bold"/&gt;
   &lt;/font&gt;
  --&gt;
&lt;/fonts&gt;


&lt;/configuration&gt;



</pre>
</div>
<br>
<hr size="4" width="90%"><br>
<div class="moz-text-flowed"
 style="font-family: -moz-fixed; font-size: 12px;" lang="x-western"><br>
To make FOP read the userconfig.xml file,&nbsp; on the command line I
have to specify the -c option followed by the userconfig file name. <br>
<br>
</div>
<br>
<br>
Sheraz Bashir wrote:
<blockquote cite="midCA8C8C1D4098D34EBFC3CE486D7A6E3D608341@MAIL007"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
  <style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0pt;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
	{page:Section1;}
-->
  </style>
  <div class="Section1">
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Hi \
everyone,<o:p></o:p></span></font></p>  <p class="MsoNormal"><font face="Arial" \
size="2"><span  style="font-size: 10pt; font-family: \
Arial;"><o:p>&nbsp;</o:p></span></font></p>  <p class="MsoNormal"><font face="Arial" \
size="2"><span  style="font-size: 10pt; font-family: Arial;">Some Unicode characters
appear as &#8216;# &#8216; in pdf.
My guess is that probably FOP does not find the character mapping of
that
character which causes FOP to render # instead of that character. For
example,
the square root symbol appears as # in output pdf.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Is there a way in which
we can manually add these mappings
in FOP?<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Thanks,<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">babz<o:p></o:p></span></font></p>
  </div>
</blockquote>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic