You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Holger Prause <h....@gmx.net> on 2002/07/09 16:30:10 UTC

Unicode problem ?

Hello,



I want to use Unicode for displaying an pound character in my pdf.


For this reason i created an dummy xml file

<?xml version="1.0" encoding="ISO-8859-1"?>

<a>
  <b>&#163;</b>
  <c>&#x20A4;</c>
</a>

and an dummy xsl stylesheet


<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
               xmlns:fo="http://www.w3.org/1999/XSL/Format"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


  <!-- the formatting of the region-body in a list view-->
 <xsl:attribute-set name="regionbefore">
  <xsl:attribute name="extent">15mm</xsl:attribute>
 </xsl:attribute-set>

 <!-- the formatting of the region-body in a list view-->
 <xsl:attribute-set name="regionbody">
  <xsl:attribute name="margin-top">15mm</xsl:attribute>
  <xsl:attribute name="extent">232mm</xsl:attribute>
  <xsl:attribute name="margin-bottom">16mm</xsl:attribute>

 </xsl:attribute-set>

 <!-- the formatting of the region-after-->
 <xsl:attribute-set name="regionafter">
  <xsl:attribute name="extent">5mm</xsl:attribute>
 </xsl:attribute-set>

 <xsl:attribute-set name="simple-page-master">
  <xsl:attribute name="page-height">29.7cm</xsl:attribute>
  <xsl:attribute name="page-width">21cm</xsl:attribute>
  <xsl:attribute name="margin-top">2.5cm</xsl:attribute>
  <xsl:attribute name="margin-bottom">2cm</xsl:attribute>
  <xsl:attribute name="margin-left">2.5cm</xsl:attribute>
  <xsl:attribute name="margin-right">2cm</xsl:attribute>
  <xsl:attribute name="master-name">simple</xsl:attribute>
 </xsl:attribute-set>

 <xsl:template match="/">
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <fo:layout-master-set>
    <!-- fo:layout-master-set defines in its children the page layout:
           the pagination and layout specifications
          - page-masters: have the role of describing the intended
subdivisions
                           of a page and the geometry of these subdivisions
                          In this case there is only a simple-page-master
which defines the
                          layout for all pages of the text
     -->
    <!-- layout information -->
    <fo:simple-page-master xsl:use-attribute-sets="simple-page-master">
     <fo:region-before xsl:use-attribute-sets="regionbefore" />
        <fo:region-body xsl:use-attribute-sets="regionbody" />
        <fo:region-after xsl:use-attribute-sets="regionafter" />
    </fo:simple-page-master>
   </fo:layout-master-set>

    <fo:page-sequence master-reference="simple">
      <fo:flow flow-name="xsl-region-body">
     <fo:block>
       Character: <xsl:value-of select="//a/b" />
     </fo:block>
     <fo:block>
       Character UNICODE: <xsl:value-of select="//a/c" />
     </fo:block>
      </fo:flow> <!-- closes the flow element-->
    </fo:page-sequence> <!-- closes the page-sequence -->
  </fo:root>
 </xsl:template>


</xsl:stylesheet>


I read the FAQ for FOP and thers written:
"All the characters you need are available at
http://www.unicode.org/charts/. If you need a character it will be there.
Once you have found the hex or decimal code for the character then you can
use this in you xml document. It will be in the form &#<decimal value>; or
&#x<hex value>;.

You must have a font that supports the character you need otherwise it will
replace it with a "#" in the output. "



Ok, now i browsed the unicode page , searched for the pound character and
found it.

http://www.unicode.org/charts/PDF/U20A0.pdf - it has the sequence 20A4 (see
dummy xml file above)



But i dont get it to work , the resulting pdf alwys displays the # character
for unicode but for the sequence &#163;(which i have taken from a html
reference) he displays

the pound sign.What did i wrong ? (It cant be he wrong font i think, because
he can display pound signs at all).



Tank you very much,



Holger






















---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Unicode problem ?

Posted by Holger Prause <h....@gmx.net>.
----- Original Message -----
From: "patrick andries" <pa...@videotron.ca>
To: <fo...@xml.apache.org>
Sent: Tuesday, July 09, 2002 5:08 PM
Subject: Re: Unicode problem ?


>
> ----- Original Message -----
> From: "Holger Prause" <h....@gmx.net>
>
>
>
> >
> > I want to use Unicode for displaying an pound character in my pdf.
> >
> > For this reason i created an dummy xml file
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >
> > <a>
> >   <b>&#163;</b>
> >   <c>&#x20A4;</c>
>
> U+20A4...this is the Italian lira or the Turkish pound.

Yes your are right,i should take close look at the unicode table.

Thers written:
20A4 LIRA SIGN· Italy, Turkey→ 00A3 pound sign




>
> > </a>
> >
> > and an dummy xsl stylesheet
> >
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >
> > <xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
> >                xmlns:fo="http://www.w3.org/1999/XSL/Format"
> >                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >
>
> > Ok, now i browsed the unicode page , searched for the pound character
and
> > found it.
>
> Well, maybe. U+00A3 is the British pound.

>
> >
> > http://www.unicode.org/charts/PDF/U20A0.pdf - it has the sequence 20A4
> (see
> > dummy xml file above)
> >
> >
> >
> > But i dont get it to work , the resulting pdf alwys displays the #
> character
> > for unicode but for the sequence &#163;(which i have taken from a html
> > reference) he displays
> > the pound sign.What did i wrong ? (It cant be he wrong font i think,
> because
> > he can display pound signs at all).
>
> These are two different glyphs, I suspect your font does not contain the
> Turkish/Italian variant or -- I do not know the details of FOP here -- the
> cmap (character to glyph mapping table) FOP implements for the default 14
> fonts does not include a mapping between this Unicode number and a glyph
> actually found in the font.

Thank your very much u saved my day :-).
Now i can went home and relax :-)

Bye,

Holger :-)




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Unicode problem ?

Posted by patrick andries <pa...@videotron.ca>.
----- Original Message -----
From: "Holger Prause" <h....@gmx.net>



>
> I want to use Unicode for displaying an pound character in my pdf.
>
> For this reason i created an dummy xml file
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <a>
>   <b>&#163;</b>
>   <c>&#x20A4;</c>

U+20A4...this is the Italian lira or the Turkish pound.

> </a>
>
> and an dummy xsl stylesheet
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
>                xmlns:fo="http://www.w3.org/1999/XSL/Format"
>                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>

> Ok, now i browsed the unicode page , searched for the pound character and
> found it.

Well, maybe. U+00A3 is the British pound.

>
> http://www.unicode.org/charts/PDF/U20A0.pdf - it has the sequence 20A4
(see
> dummy xml file above)
>
>
>
> But i dont get it to work , the resulting pdf alwys displays the #
character
> for unicode but for the sequence &#163;(which i have taken from a html
> reference) he displays
> the pound sign.What did i wrong ? (It cant be he wrong font i think,
because
> he can display pound signs at all).

These are two different glyphs, I suspect your font does not contain the
Turkish/Italian variant or -- I do not know the details of FOP here -- the
cmap (character to glyph mapping table) FOP implements for the default 14
fonts does not include a mapping between this Unicode number and a glyph
actually found in the font.


-----
Tout Unicode en français
(noms des caractères, tout le texte normatif, annotations, etc.)
http://hapax.iquebec.com




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org