docbook-apps

Expand all | Collapse all

XSL-FO and unicode

  • 1.  XSL-FO and unicode

    Posted 07-06-2010 13:58
    Hi.
    I am facing also an interesting problem with unicode entities.
    I have some special characters I encoded as Unicode, like α

    In the xsl-fo, I get
    <fo:block>α</fo:block>

    And in PDF, a wonderful "#"
    So, after some further readings, I found that I had to add some fonts,
    so in the XSL Customization, I added

    <xsl:param name="symbol.font.family" select="'Arial Sans
    Unicode,Symbol,ZapfDingbats'"/>

    But that does not change a thing.... though in the fo, I have <fo:root
    xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="serif,Arial
    Sans Unicode,Symbol,ZapfDingbats" font-size="10pt" text-align="justify"
    line-height="normal" font-selection-strategy="character-by-character"
    line-height-shift-adjustment="disregard-shifts" writing-mode="lr-tb"
    language="en">

    I must be doing something badly....

    Using saxon9he, FOP0.95, DB5
    Thanks in advance,
    Regards,
    Fabien







  • 2.  Re: [docbook-apps] XSL-FO and unicode

    Posted 07-06-2010 21:17
    On Tue, 2010-07-06 at 15:58 +0200, Fabien Tillier wrote:
    > Hi.
    > I am facing also an interesting problem with unicode entities.
    > I have some special characters I encoded as Unicode, like α
    >
    > In the xsl-fo, I get
    > <fo:block>α</fo:block>
    >
    > And in PDF, a wonderful "#"
    >
    Fabien,

    The problem is most likely either that the font fop is trying to use
    doesn't have this symbol, or that fop can't find the font and defaults
    to a font that doesn't have the symbol.

    I'd check the messages you get from fop; it should tell you if it can't
    find a font.

    Finally, I know that multiple fonts work in CSS strings (e.g.,
    "serif,Times"), but I have no idea if they work in fo. if they don't,
    that could be part of the problem. I'd be inclined, at least for
    testing, to name just one font to avoid any confusion.

    Best Regards,
    Dick Hamilton
    XML Press
    XML for Technical Communicators
    http://xmlpress.net





  • 3.  RE: [docbook-apps] XSL-FO and unicode

    Posted 07-06-2010 22:00
    |


  • 4.  RE: XSL-FO and unicode

    Posted 07-07-2010 16:57
    Fabien Tillier [mailto:f.tillier@cerep.fr] wrote:

    > In the xsl-fo, I get
    > <fo:block>α</fo:block>
    >
    > And in PDF, a wonderful "#"
    > So, after some further readings, I found that I had to add some fonts,
    > so in the XSL Customization, I added
    >
    > <xsl:param name="symbol.font.family" select="'Arial Sans
    > Unicode,Symbol,ZapfDingbats'"/>
    >
    > But that does not change a thing.... though in the fo, I have <fo:root
    > xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="serif,Arial
    > Sans Unicode,Symbol,ZapfDingbats" font-size="10pt" text-align="justify"
    > line-height="normal" font-selection-strategy="character-by-character"
    > line-height-shift-adjustment="disregard-shifts" writing-mode="lr-tb"
    > language="en">


    I don't know what OS you're working in, but I don't recognize the font name "Arial Sans Unicode". Do you mean "Arial Unicode MS"? The most current version of that font is available on Windows systems that have Office 2003 or later installed, and it does contain the character you specified, which is U+03B1 ("Greek Small Letter Alpha").

    The "Symbol" font also contains this character, and I recommend using that instead because it is one of the Base 14 fonts that will always be available in PDF. I think you'll find that if you put "Symbol" first in your font list, it will work. As Mauritz pointed out, FOP does not handle alternate font selections, so it will only use the first font you specify ("Arial Sans Unicode" in your list). If the glyph doesn't exist in that font or in the default fallback font (which I think is always "Times"), you'll get a "missing glyph" symbol.

    If you do want to load OS fonts such as "Arial Unicode MS", in addition to specifying the font name in the FO, you need to create a FOP configuration file and add the <auto-detect /> instruction, as documented here: http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics


    *************************
    Rob Cavicchio
    Principal Technical Writer & Information Architect
    EMC Captiva
    Information Intelligence Group
    EMC Corporation
    3721 Valley Centre Drive, Ste 200
    San Diego, CA 92130

    P: (858) 320-1208
    F: (858) 320-1010
    E: rob.cavicchio@emc.com

    The opinions expressed here are my personal opinions. Content published here is not read or approved in advance by EMC and does not necessarily reflect the views and opinions of EMC.
     





  • 5.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-08-2010 11:46
    Thanks rob.
    I still do have some troubles....
    I am using the same docbook xml to generate either HTML or PDF. Some characters (µ, °) are visible in PDF but not in HTML while others (alpha, beta) are visible in HTML but not in PDF....
    I am getting mad, as both are encoded the same way in the original XML...
    Maybe it is because I am using ISO-8859-1 ?
    If I try with UTF-8, I get correct display in HTML but the problem is still there in FOP(huh, PDF). When I look in the properties, only Helvetica font is used, not Symbol, which I indicate in the XSL-FO stylesheet with
    <xsl:param name="symbol.font.family" select="'Symbol'"/>
    <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>
    I have that strange feeling I am running in circles...
    As of inserting Arial Unicode in FOP, I hesitate, as the ttf file is 22Mb in size...

    Regards,
    Fabien




    -----Message d'origine-----
    De : rob.cavicchio@emc.com [mailto:rob.cavicchio@emc.com]
    Envoyé : mercredi 7 juillet 2010 18:57
    À : docbook-apps@lists.oasis-open.org
    Objet : [docbook-apps] RE: XSL-FO and unicode

    Fabien Tillier [mailto:f.tillier@cerep.fr] wrote:

    > In the xsl-fo, I get
    > <fo:block>α</fo:block>
    >
    > And in PDF, a wonderful "#"
    > So, after some further readings, I found that I had to add some fonts,
    > so in the XSL Customization, I added
    >
    > <xsl:param name="symbol.font.family" select="'Arial Sans
    > Unicode,Symbol,ZapfDingbats'"/>
    >
    > But that does not change a thing.... though in the fo, I have <fo:root
    > xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="serif,Arial
    > Sans Unicode,Symbol,ZapfDingbats" font-size="10pt" text-align="justify"
    > line-height="normal" font-selection-strategy="character-by-character"
    > line-height-shift-adjustment="disregard-shifts" writing-mode="lr-tb"
    > language="en">


    I don't know what OS you're working in, but I don't recognize the font name "Arial Sans Unicode". Do you mean "Arial Unicode MS"? The most current version of that font is available on Windows systems that have Office 2003 or later installed, and it does contain the character you specified, which is U+03B1 ("Greek Small Letter Alpha").

    The "Symbol" font also contains this character, and I recommend using that instead because it is one of the Base 14 fonts that will always be available in PDF. I think you'll find that if you put "Symbol" first in your font list, it will work. As Mauritz pointed out, FOP does not handle alternate font selections, so it will only use the first font you specify ("Arial Sans Unicode" in your list). If the glyph doesn't exist in that font or in the default fallback font (which I think is always "Times"), you'll get a "missing glyph" symbol.

    If you do want to load OS fonts such as "Arial Unicode MS", in addition to specifying the font name in the FO, you need to create a FOP configuration file and add the <auto-detect /> instruction, as documented here: http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics


    *************************
    Rob Cavicchio
    Principal Technical Writer & Information Architect
    EMC Captiva
    Information Intelligence Group
    EMC Corporation
    3721 Valley Centre Drive, Ste 200
    San Diego, CA 92130

    P: (858) 320-1208
    F: (858) 320-1010
    E: rob.cavicchio@emc.com

    The opinions expressed here are my personal opinions. Content published here is not read or approved in advance by EMC and does not necessarily reflect the views and opinions of EMC.
     



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org




  • 6.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-08-2010 14:31
    Hum...
    Even when getting the font to FOP, I get the "#"...

    -----Message d'origine-----
    De : Fabien Tillier [mailto:f.tillier@cerep.fr]
    Envoyé : jeudi 8 juillet 2010 13:46
    À : rob.cavicchio@emc.com; docbook-apps@lists.oasis-open.org
    Objet : RE: [docbook-apps] RE: XSL-FO and unicode

    Thanks rob.
    I still do have some troubles....
    I am using the same docbook xml to generate either HTML or PDF. Some characters (µ, °) are visible in PDF but not in HTML while others (alpha, beta) are visible in HTML but not in PDF....
    I am getting mad, as both are encoded the same way in the original XML...
    Maybe it is because I am using ISO-8859-1 ?
    If I try with UTF-8, I get correct display in HTML but the problem is still there in FOP(huh, PDF). When I look in the properties, only Helvetica font is used, not Symbol, which I indicate in the XSL-FO stylesheet with
    <xsl:param name="symbol.font.family" select="'Symbol'"/>
    <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>
    I have that strange feeling I am running in circles...
    As of inserting Arial Unicode in FOP, I hesitate, as the ttf file is 22Mb in size...

    Regards,
    Fabien




    -----Message d'origine-----
    De : rob.cavicchio@emc.com [mailto:rob.cavicchio@emc.com]
    Envoyé : mercredi 7 juillet 2010 18:57
    À : docbook-apps@lists.oasis-open.org
    Objet : [docbook-apps] RE: XSL-FO and unicode

    Fabien Tillier [mailto:f.tillier@cerep.fr] wrote:

    > In the xsl-fo, I get
    > <fo:block>α</fo:block>
    >
    > And in PDF, a wonderful "#"
    > So, after some further readings, I found that I had to add some fonts,
    > so in the XSL Customization, I added
    >
    > <xsl:param name="symbol.font.family" select="'Arial Sans
    > Unicode,Symbol,ZapfDingbats'"/>
    >
    > But that does not change a thing.... though in the fo, I have <fo:root
    > xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="serif,Arial
    > Sans Unicode,Symbol,ZapfDingbats" font-size="10pt" text-align="justify"
    > line-height="normal" font-selection-strategy="character-by-character"
    > line-height-shift-adjustment="disregard-shifts" writing-mode="lr-tb"
    > language="en">


    I don't know what OS you're working in, but I don't recognize the font name "Arial Sans Unicode". Do you mean "Arial Unicode MS"? The most current version of that font is available on Windows systems that have Office 2003 or later installed, and it does contain the character you specified, which is U+03B1 ("Greek Small Letter Alpha").

    The "Symbol" font also contains this character, and I recommend using that instead because it is one of the Base 14 fonts that will always be available in PDF. I think you'll find that if you put "Symbol" first in your font list, it will work. As Mauritz pointed out, FOP does not handle alternate font selections, so it will only use the first font you specify ("Arial Sans Unicode" in your list). If the glyph doesn't exist in that font or in the default fallback font (which I think is always "Times"), you'll get a "missing glyph" symbol.

    If you do want to load OS fonts such as "Arial Unicode MS", in addition to specifying the font name in the FO, you need to create a FOP configuration file and add the <auto-detect /> instruction, as documented here: http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics


    *************************
    Rob Cavicchio
    Principal Technical Writer & Information Architect
    EMC Captiva
    Information Intelligence Group
    EMC Corporation
    3721 Valley Centre Drive, Ste 200
    San Diego, CA 92130

    P: (858) 320-1208
    F: (858) 320-1010
    E: rob.cavicchio@emc.com

    The opinions expressed here are my personal opinions. Content published here is not read or approved in advance by EMC and does not necessarily reflect the views and opinions of EMC.
     



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org




  • 7.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-08-2010 14:57
    I understand your frustration. I happen to be dealing with a lot of these font/character issues myself right now, so my head's in it. Hopefully I can help further. The situation is very different for HTML vs. PDF.

    As far as HTML goes, unless you are publishing HTML Help (CHM), I recommend sticking with UTF-8 for HTML output, and if possible make sure all your font style declarations end with one of the standard font keywords ("monospace", "sans-serif", or "serif"). When the HTML output is displayed, for each character the browser should automatically select an available font if the font you explicitly specified doesn't contain that character.


    PDF has a much more limited fallback mechanism, and furthermore FOP itself does not even fully implement the XSL-FO 1.1 specification. As a result you have to jump through a lot more hoops to guarantee the correct display of all Unicode characters.


    > When I look in the properties, only
    > Helvetica font is used, not Symbol, which I indicate in the XSL-FO
    > stylesheet with
    > <xsl:param name="symbol.font.family" select="'Symbol'"/>
    > <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>

    Unfortunately I think you are running into a limitation of FOP that the DocBook stylesheets don't seem set up to let you circumvent. I went and looked at the DocBook stylesheet reference at http://docbook.sourceforge.net/release/xsl/current/doc/index.html (sorry I didn't do this before), and according to the documentation, the symbol font names "are automatically appended to the body or title font family name when fonts are specified in a font-family property in the FO output". But as we've said, FOP disregards all but the first font name, so appending more font names to the end of the list is not going to have any effect.


    > As of inserting Arial Unicode in FOP, I hesitate, as the ttf file is 22Mb
    > in size...

    I believe that FOP subsets all fonts, so you probably don't have to worry about the size. The font does only come with MS Office, but if you know that all systems you publish on will have MS Office installed, then the simplest solution is probably this:

    <xsl:param name="body.font.family" select="'Arial Unicode MS,Helvetica,Arial,Serif'"/>


    You might then run into a further limitation, however. My understanding is that "Arial Unicode MS" does not have bold and italic variations, so if you do this you might find that bold and italics do not show up in the PDF. I have not yet experimented to see what really happens here.



    >


  • 8.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-08-2010 15:42
    If I only set Arial Unicode MS <xsl:param name="body.font.family" select="'Arial Unicode MS'"/>, I get the symbols, but only those :( (and numbers...)
    And Acrobat tells me the used fonts are Helvetica and Symbol...
    As I like to try things, I set the fonts to
    <xsl:param name="symbol.font.family" select="'Arial Unicode MS'"/>
    <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>
    Thus, trying to use Arial Unicode MS for symbole (though I am completely sure it won't work)
    And I was right. So, I am afraid I am in a dead-end...

    -----Message d'origine-----
    De : rob.cavicchio@emc.com [mailto:rob.cavicchio@emc.com]
    Envoyé : jeudi 8 juillet 2010 16:57
    À : Fabien Tillier; docbook-apps@lists.oasis-open.org
    Objet : RE: [docbook-apps] RE: XSL-FO and unicode

    I understand your frustration. I happen to be dealing with a lot of these font/character issues myself right now, so my head's in it. Hopefully I can help further. The situation is very different for HTML vs. PDF.

    As far as HTML goes, unless you are publishing HTML Help (CHM), I recommend sticking with UTF-8 for HTML output, and if possible make sure all your font style declarations end with one of the standard font keywords ("monospace", "sans-serif", or "serif"). When the HTML output is displayed, for each character the browser should automatically select an available font if the font you explicitly specified doesn't contain that character.


    PDF has a much more limited fallback mechanism, and furthermore FOP itself does not even fully implement the XSL-FO 1.1 specification. As a result you have to jump through a lot more hoops to guarantee the correct display of all Unicode characters.


    > When I look in the properties, only
    > Helvetica font is used, not Symbol, which I indicate in the XSL-FO
    > stylesheet with
    > <xsl:param name="symbol.font.family" select="'Symbol'"/>
    > <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>

    Unfortunately I think you are running into a limitation of FOP that the DocBook stylesheets don't seem set up to let you circumvent. I went and looked at the DocBook stylesheet reference at http://docbook.sourceforge.net/release/xsl/current/doc/index.html (sorry I didn't do this before), and according to the documentation, the symbol font names "are automatically appended to the body or title font family name when fonts are specified in a font-family property in the FO output". But as we've said, FOP disregards all but the first font name, so appending more font names to the end of the list is not going to have any effect.


    > As of inserting Arial Unicode in FOP, I hesitate, as the ttf file is 22Mb
    > in size...

    I believe that FOP subsets all fonts, so you probably don't have to worry about the size. The font does only come with MS Office, but if you know that all systems you publish on will have MS Office installed, then the simplest solution is probably this:

    <xsl:param name="body.font.family" select="'Arial Unicode MS,Helvetica,Arial,Serif'"/>


    You might then run into a further limitation, however. My understanding is that "Arial Unicode MS" does not have bold and italic variations, so if you do this you might find that bold and italics do not show up in the PDF. I have not yet experimented to see what really happens here.



    >


  • 9.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-08-2010 16:23
    Hmm, did you configure FOP to auto-detect the system fonts?

    http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics


    Basically, you need an XML file that looks like this:



    <fop version="1.0">
    <renderers>
    <renderer mime="application/pdf">
    <fonts>
    <auto-detect />
    </fonts>
    </renderer>
    </renderers>
    </fop>


    Then you can run FOP with the -c command to use the configuration file. Say you called the file "fop.xconf" like the sample they provide. You'd run it like this:


    fop -c fop.xconf mydocument.fo mydocument.pdf



    >


  • 10.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-09-2010 06:47
    Hi Rob.
    Yes, I have done that. It founds my installed fonts, but nothing new...

    -----Message d'origine-----
    De : rob.cavicchio@emc.com [mailto:rob.cavicchio@emc.com]
    Envoyé : jeudi 8 juillet 2010 18:23
    À : Fabien Tillier; docbook-apps@lists.oasis-open.org
    Objet : RE: [docbook-apps] RE: XSL-FO and unicode

    Hmm, did you configure FOP to auto-detect the system fonts?

    http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics


    Basically, you need an XML file that looks like this:



    <fop version="1.0">
    <renderers>
    <renderer mime="application/pdf">
    <fonts>
    <auto-detect />
    </fonts>
    </renderer>
    </renderers>
    </fop>


    Then you can run FOP with the -c command to use the configuration file. Say you called the file "fop.xconf" like the sample they provide. You'd run it like this:


    fop -c fop.xconf mydocument.fo mydocument.pdf



    >


  • 11.  Re: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-08-2010 16:44

    Fabien

    Have you looked at the FOP config file? In my experience, it helped quite a bit to specify the fonts used in the FOP config file. Since I use the DejaVu fonts for that same reason, here is the FOP config file snippet from mine and notice I do not let FOP roam around my system looking for fonts ;-)

    <fonts>





































    <directory>../../doctools/dejavu-fonts-ttf/ttf</directory>





    </fonts>

    Then in my customization I use

    <xsl:param name="body.font.family" select="'DejaVuSans'"/>
    <xsl:param name="title.font.family" select="'DejaVuSans'"/>
    <xsl:param name="monospace.font.family" select="'DejaVuSansMono'"/>
    <xsl:param name="body.font.master" select="'10.1'"/>
    <xsl:param name="symbol.font.family" select="'DejaVuSansMono'"/>


    Maybe this example will jar something loose for you!

    Regards,
    Dean Nelson









    In a message dated 07/08/10 08:42:06 Pacific Daylight Time, f.tillier@cerep.fr writes:
    If I only set Arial Unicode MS <xsl:param name="body.font.family" select="'Arial Unicode MS'"/>, I get the symbols, but only those :( (and numbers...)
    And Acrobat tells me the used fonts are Helvetica and Symbol...
    As I like to try things, I set the fonts to
    <xsl:param name="symbol.font.family" select="'Arial Unicode MS'"/>
    <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>
    Thus, trying to use Arial Unicode MS for symbole (though I am completely sure it won't work)
    And I was right. So, I am afraid I am in a dead-end...

    -----Message d'origine-----
    De : rob.cavicchio@emc.com [mailto:rob.cavicchio@emc.com]
    Envoyé : jeudi 8 juillet 2010 16:57
    À : Fabien Tillier; docbook-apps@lists.oasis-open.org
    Objet : RE: [docbook-apps] RE: XSL-FO and unicode

    I understand your frustration. I happen to be dealing with a lot of these font/character issues myself right now, so my head's in it. Hopefully I can help further. The situation is very different for HTML vs. PDF.

    As far as HTML goes, unless you are publishing HTML Help (CHM), I recommend sticking with UTF-8 for HTML output, and if possible make sure all your font style declarations end with one of the standard font keywords ("monospace", "sans-serif", or "serif"). When the HTML output is displayed, for each character the browser should automatically select an available font if the font you explicitly specified doesn't contain that character.


    PDF has a much more limited fallback mechanism, and furthermore FOP itself does not even fully implement the XSL-FO 1.1 specification. As a result you have to jump through a lot more hoops to guarantee the correct display of all Unicode characters.


    > When I look in the properties, only
    > Helvetica font is used, not Symbol, which I indicate in the XSL-FO
    > stylesheet with
    > <xsl:param name="symbol.font.family" select="'Symbol'"/>
    > <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>

    Unfortunately I think you are running into a limitation of FOP that the DocBook stylesheets don't seem set up to let you circumvent. I went and looked at the DocBook stylesheet reference at http://docbook.sourceforge.net/release/xsl/current/doc/index.html (sorry I didn't do this before), and according to the documentation, the symbol font names "are automatically appended to the body or title font family name when fonts are specified in a font-family property in the FO output". But as we've said, FOP disregards all but the first font name, so appending more font names to the end of the list is not going to have any effect.


    > As of inserting Arial Unicode in FOP, I hesitate, as the ttf file is 22Mb
    > in size...

    I believe that FOP subsets all fonts, so you probably don't have to worry about the size. The font does only come with MS Office, but if you know that all systems you publish on will have MS Office installed, then the simplest solution is probably this:

    <xsl:param name="body.font.family" select="'Arial Unicode MS,Helvetica,Arial,Serif'"/>


    You might then run into a further limitation, however. My understanding is that "Arial Unicode MS" does not have bold and italic variations, so if you do this you might find that bold and italics do not show up in the PDF. I have not yet experimented to see what really happens here.



    >


  • 12.  RE: [docbook-apps] RE: XSL-FO and unicode

    Posted 07-09-2010 06:48
    Hi Dean.

    Thanks for sharing.

    This is a good exemple so I will try this way, to see if it gets me somewhere ?

    Regards,

    Fabien



    De : deannelson [mailto:deannelson@aol.com]
    Envoyé : jeudi 8 juillet 2010 18:44
    À : Fabien Tillier; docbook-apps@lists.oasis-open.org
    Objet : Re: [docbook-apps] RE: XSL-FO and unicode





    Fabien



    Have you looked at the FOP config file? In my experience, it helped quite a bit to specify the fonts used in the FOP config file. Since I use the DejaVu fonts for that same reason, here is the FOP config file snippet from mine and notice I do not let FOP roam around my system looking for fonts ;-)



    <fonts>












    &nbs p;












    ;













    ; <directory>../../doctools/dejavu-fonts-ttf/ttf</directory>





    </fonts>


    Then in my customization I use


    <xsl:param name="body.font.family" select="'DejaVuSans'"/>
    <xsl:param name="title.font.family" select="'DejaVuSans'"/>
    <xsl:param name="monospace.font.family" select="'DejaVuSansMono'"/>
    <xsl:param name="body.font.master" select="'10.1'"/>
    <xsl:param name="symbol.font.family" select="'DejaVuSansMono'"/>



    Maybe this example will jar something loose for you!



    Regards,

    Dean Nelson



















    In a message dated 07/08/10 08:42:06 Pacific Daylight Time, f.tillier@cerep.fr writes:

    If I only set Arial Unicode MS <xsl:param name="body.font.family" select="'Arial Unicode MS'"/>, I get the symbols, but only those :( (and numbers...)
    And Acrobat tells me the used fonts are Helvetica and Symbol...
    As I like to try things, I set the fonts to
    <xsl:param name="symbol.font.family" select="'Arial Unicode MS'"/>
    <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>
    Thus, trying to use Arial Unicode MS for symbole (though I am completely sure it won't work)
    And I was right. So, I am afraid I am in a dead-end...

    -----Message d'origine-----
    De : rob.cavicchio@emc.com [mailto:rob.cavicchio@emc.com]
    Envoyé : jeudi 8 juillet 2010 16:57
    À : Fabien Tillier; docbook-apps@lists.oasis-open.org
    Objet : RE: [docbook-apps] RE: XSL-FO and unicode

    I understand your frustration. I happen to be dealing with a lot of these font/character issues myself right now, so my head 's in it. Hopefully I can help further. The situation is very different for HTML vs. PDF.

    As far as HTML goes, unless you are publishing HTML Help (CHM), I recommend sticking with UTF-8 for HTML output, and if possible make sure all your font style declarations end with one of the standard font keywords ("monospace", "sans-serif", or "serif"). When the HTML output is displayed, for each character the browser should automatically select an available font if the font you explicitly specified doesn't contain that character.


    PDF has a much more limited fallback mechanism, and furthermore FOP itself does not even fully implement the XSL-FO 1.1 specification. As a result you have to jump through a lot more hoops to guarantee the correct display of all Unicode characters.


    > When I look in the properties, only
    > Helvetica font is used, not Symbol, which I indicate in the XSL-FO
    > stylesheet with
    > <xsl:param name="symbol.fon t.family" select="'Symbol'"/>
    > <xsl:param name="body.font.family" select="'Helvetica,Arial,Serif'"/>

    Unfortunately I think you are running into a limitation of FOP that the DocBook stylesheets don't seem set up to let you circumvent. I went and looked at the DocBook stylesheet reference at http://docbook.sourceforge.net/release/xsl/current/doc/index.html (sorry I didn't do this before), and according to the documentation, the symbol font names "are automatically appended to the body or title font family name when fonts are specified in a font-family property in the FO output". But as we've said, FOP disregards all but the first font name, so appending more font names to the end of the list is not going to have any effect.


    > As of inserting Arial Unicode in FOP, I hesitate, as the ttf file is 22Mb
    > in size...

    I believe that FOP subsets all fonts, so you probably don't have to worry about the size. The font does only come with MS Office, but if you know that all systems you publish on will have MS Office installed, then the simplest solution is probably this:

    <xsl:param name="body.font.family" select="'Arial Unicode MS,Helvetica,Arial,Serif'"/>


    You might then run into a further limitation, however. My understanding is that "Arial Unicode MS" does not have bold and italic variations, so if you do this you might find that bold and italics do not show up in the PDF. I have not yet experimented to see what really happens here.



    >


  • 13.  RE: [docbook-apps] RE: XSL-FO and unicode - SOLVED

    Posted 07-09-2010 07:54
    It works !
    Here are the steps taken
    1) Configuration of the font folder in the embedded java part. The fonts are in my web application folder (under tomcat) webapp/mywebapp/fonts, the FOP configuration file in webapp/mywebapp/xml/fop.xconf

    DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
    Configuration cfg;
    try {
    cfg = cfgBuilder.buildFromFile(new File(cfgFolder+File.separator+ "xml" + File.separator + "fop.xconf"));
    fopFactory.setUserConfig(cfg);
    File fontRoot = new File(cfgFolder+File.separator+ "fonts");
    try {
    System.out.println("Setting font folder to " + fontRoot.toURI().toURL().toExternalForm());
    fopFactory.setFontBaseURL(fontRoot.toURI().toURL().toExternalForm());
    } catch (MalformedURLException e) {
    e.printStackTrace();
    }
    ...

    2) Change fonts in fop.xconf
    <fonts>
    <directory>.</directory>


    </fonts>

    3) In the custom XSLFO stylesheet
    <xsl:param name="body.font.family" select="'Arial Unicode MS'"/>
    <xsl:param name="title.font.family" select="'Arial Unicode MS'"/>
    <xsl:param name="monospace.font.family" select="'Arial Unicode MS'"/>
    <xsl:param name="symbol.font.family" select="'Arial Unicode MS'"/>


    And now, I get my symbols correctly in the PDF file ! (without embedding the complete font)
    Thanks a lot to everyone and particularly to Dean !
    The only thing is that I have little customization on the document I can do because I have only Arial normal weight available...
    Regards,
    Fabien


    De : Fabien Tillier [mailto:f.tillier@cerep.fr]
    Envoyé : vendredi 9 juillet 2010 08:48
    À : deannelson; docbook-apps@lists.oasis-open.org
    Objet : RE: [docbook-apps] RE: XSL-FO and unicode

    Hi Dean.
    Thanks for sharing.
    This is a good exemple so I will try this way, to see if it gets me somewhere ?
    Regards,
    Fabien

    De : deannelson [mailto:deannelson@aol.com]
    Envoyé : jeudi 8 juillet 2010 18:44
    À : Fabien Tillier; docbook-apps@lists.oasis-open.org
    Objet : Re: [docbook-apps] RE: XSL-FO and unicode

     
    Fabien
     
    Have you looked at the FOP config file? In my experience, it helped quite a bit to specify the fonts used in the FOP config file. Since I use the DejaVu fonts for that same reason, here is the FOP config file snippet from mine and notice I do not let FOP roam around my system looking for fonts ;-)
     
          <fonts>