Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] Getting special characters in FO

Expand Messages
  • Harm Kok
    Geurt, Thanks, for the answer. What is the solution? Can I change these font mappings in any way? Or should I purchase another font? Harm
    Message 1 of 4 , Jun 2, 2003
    • 0 Attachment
      Geurt,

      Thanks, for the answer. What is the solution? Can I change these font
      mappings in any way? Or should I purchase another font?

      Harm


      Geurt Lagemaat wrote:

      >Harm,
      >
      >
      >
      >>My first action was to look for a font that did support this
      >>
      >>
      >characters
      >
      >
      >>(Arial) and put that as second one in the font-family like:
      >>font-family="Avenir, Arial"
      >>
      >>
      >
      >I had the same problem sometime ago. I think you're problem is the
      >Avenir font. Open the charmap utility if you have this font installed on
      >a MS Windows machine. Find the U+2264 and U+2265 positions. You will see
      >a dot to illustrate that there is no glyph available for this position.
      >The problem you described happens when a font lists the positions (in
      >you're case U+2264 and U+2265) but does not provide a glyph for these
      >characters. This will cause the XSL FO formatter to "think" that the
      >font is providing a glyph when it is not. The result is that XEP does
      >not switch to the Arial font and use the proper glyph from the Arial
      >font.
      >
      >
      >
      >Regards,
      >
      >
      >Geurt Lagemaat
      >Oriana Automatisering
      >
      >
      >
      >>-----Oorspronkelijk bericht-----
      >>Van: Harm Kok [mailto:h.kok@...]
      >>Verzonden: maandag 2 juni 2003 16:17
      >>Aan: XSL-FO@yahoogroups.com
      >>Onderwerp: [XSL-FO] Getting special characters in FO
      >>
      >>Hi,
      >>
      >>I am trying to get special characters (like ≤ <= sign or
      >>
      >>
      >≥
      >
      >
      >>is the >= sign) in my document. The font I am using is not supporting
      >>these families (Avenir).
      >>
      >>My first action was to look for a font that did support this
      >>
      >>
      >characters
      >
      >
      >>(Arial) and put that as second one in the font-family like:
      >>font-family="Avenir, Arial"
      >>
      >>This did not work on Antenna House (and XEP).
      >>
      >>Antennahouse replied that I had to wait until the
      >>font-selections-strategy was implemented. Or I shoul specify the
      >>font-family for every special character that comes along.
      >>
      >>What I would like is a stylesheet that takes a list of characters and
      >>
      >>
      >a
      >
      >
      >>backup font. Every time a character from this list is encountered it
      >>puts a fo:inline or fo:character around this and specifies the backup
      >>font as font-family.
      >>
      >>So:
      >><fo:block>
      >>This is some text with x ≤ y ≤ z
      >><fo:block>
      >>
      >>becomes
      >>This is some text with x <fo:inline
      >>font-family="Arial">≤</fo:inline> y <fo:inline
      >>font-family="Arial">≤</fo:inline> z
      >>
      >>I hope somebody can help me.
      >>
      >>Regards,
      >>
      >>Harm Kok
      >>
      >>
      >>------------------------ Yahoo! Groups Sponsor
      >>
      >>To unsubscribe from this group, send an email to:
      >>XSL-FO-unsubscribe@egroups.com
      >>
      >>
      >>
      >>Your use of Yahoo! Groups is subject to
      >>
      >>
      >http://docs.yahoo.com/info/terms/
      >
      >
      >
      >
      >
      >
      >To unsubscribe from this group, send an email to:
      >XSL-FO-unsubscribe@egroups.com
      >
      >
      >
      >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
      >
      >
    • Harm Kok
      Hi, I found the solution to my problem in the the book of Jeni Tennison. You can use this for formatters that don t support the font-family as FOP and
      Message 2 of 4 , Jun 5, 2003
      • 0 Attachment
        Hi,

        I found the solution to my problem in the the book of Jeni Tennison. You
        can use this for formatters that don't support the font-family as FOP
        and Antennahouse.

        You can put the characters you want to replace in an XML file that looks
        like this:

        <root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <replace>
        <from>≤</from>
        <to><fo:inline font-family="Arial">≤</fo:inline></to>
        </replace><!-- smaller than or equal -->
        <replace>
        <from>≥</from>
        <to><fo:inline font-family="Arial">≥</fo:inline></to>
        </replace><!-- Larger than or equal -->
        </root>

        Than you can use the following stylesheet which I copied from Jeni her
        book. It replaces a string (in the "from" node) into a node (in the "to"
        node)

        <xsl:template match="text()">
        <xsl:call-template name="replace">
        <xsl:with-param name="string">
        <xsl:value-of select="."/>
        </xsl:with-param>
        </xsl:call-template>
        </xsl:template>

        <xsl:template name="replace">
        <xsl:param name="string" />
        <xsl:apply-templates
        select="document('character.xml')/root/replace[1]" mode="replace">
        <xsl:with-param name="string" select="$string"/>
        </xsl:apply-templates>
        </xsl:template>

        <xsl:template match="root/replace" mode="replace">
        <xsl:param name="string" />
        <xsl:variable name="next"
        select="following-sibling::replace[contains($string, from)][1]"/>
        <xsl:choose>
        <xsl:when test="contains($string, from)">
        <xsl:choose>
        <xsl:when test="$next">
        <xsl:apply-templates select="$next" mode="replace">
        <xsl:with-param name="string"
        select="substring-before($string, from)"/>
        </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
        <xsl:value-of select="substring-before($string, from)"/>
        </xsl:otherwise>
        </xsl:choose>
        <xsl:copy-of select="to/node()"/>
        <xsl:apply-templates select="." mode="replace">
        <xsl:with-param name="string"
        select="substring-after($string, from)"/>
        </xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$next">
        <xsl:apply-templates select="$next" mode="replace">
        <xsl:with-param name="string" select="$string"/>
        </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
        <xsl:value-of select="$string"/>
        </xsl:otherwise>
        </xsl:choose>
        </xsl:template>

        Works like a charm.

        Regards,

        Harm
      Your message has been successfully submitted and would be delivered to recipients shortly.