docbook-apps

  • 1.  Generating font metricss file for Helvetica-Bold, Helvetica and Times-Roman?

    Posted 09-20-2007 00:47
    It looks like if I want to have embedded fonts I need to generate a
    "font matrics file".
    Here how I have been trying to do that ...

    [plankton@dell002 BOOKS]$ cat MakeFontMatrixFile.sh
    #!/bin/sh
    JAVA_HOME=/usr/java/jre1.6.0_02
    JAVA=$JAVA_HOME/bin/java
    FOP_HOME=/usr/share/java
    CP=$FOP_HOME/fop.jar:\
    $FOP_HOME/avalon-framework.jar

    #PFM_FILE=/usr/share/texmf/fonts/type1/urw/helvetic/uhvb8a.pfb
    PFM_FILE=/usr/share/texmf/fonts/type1/public/lm/lmb10.pfm
    $JAVA -cp $CP \
    org.apache.fop.fonts.apps.PFMReader -enc ansi $PFM_FILE my_font_matrix_file.xml

    ... the problem I am having is that lmb10.pfm is not the pfm file for
    Helvetic-Bold, Helvetica or Times-Roman. Where are the pfm files for
    these fonts?

    Thanks



  • 2.  Re: Generating font metricss file for Helvetica-Bold, Helvetica and Times-Roman?

    Posted 09-20-2007 04:24
    I have had a minor success. I realized that I do not have to use
    Helvetic-Bold, Helvetica or Times-Roman (At least I hope I do not.)
    Because I was able to subsitutue Times-Roman for
    LMRomanDemi10-Regular. This is the font in the lmb10.pfm PFM file.
    What I had to do was this ...

    Edit my userconfig.xml like so ...

    # cd /usr/share/fop/conf/
    # cp userconfig.xml userconfig.xml_20070919
    # vim userconfig.xml
    # diff userconfig.xml userconfig.xml_20070919
    30c30
    <
    ---
    >
    ---
    > -->
    63,65d62
    <
    <


    Go to the directory where I have my stuff ...

    [plankton@dell002 ~]$ cd NOTES/COOP/LULU_BOOKS/

    Add this line to my customization style sheet file ...

    <xsl:param name="body.font.family">LMRomanDemi10-Regular</xsl:param>

    ... here's my complete customization style sheet ....

    [plankton@dell002 LULU_BOOKS]$ cat style_pdf.xsl

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

    <xsl:import href="/usr/share/sgml/docbook/xsl-stylesheets/fo/docbook.xsl"/>
    <xsl:param name="body.font.family">LMRomanDemi10-Regular</xsl:param>

    <xsl:param name="shade.verbatim" select="1"></xsl:param>
    <xsl:attribute-set name="shade.verbatim.style">
    <xsl:attribute name="background-color">#FFFFCC</xsl:attribute>
    </xsl:attribute-set>
    <xsl:attribute-set name="toc.margin.properties">
    <xsl:attribute name="background-color">#EFF8F8</xsl:attribute>
    </xsl:attribute-set>
    <xsl:param name="hyphenate">false</xsl:param>
    </xsl:stylesheet>

    Now I generate my font matrix file:

    [plankton@dell002 LULU_BOOKS]$ ./MakeFontMatrixFile.sh
    lmb10.xml
    [INFO] PFM Reader v1.1
    [INFO]
    [INFO] Reading /usr/share/texmf/fonts/type1/public/lm/lmb10.pfm...
    [INFO]
    [INFO] 512 kerning pairs
    [INFO] Font: LMRomanDemi10
    [INFO] Name: LMRomanDemi10-Regular
    [INFO] CharSet: Unknown
    [INFO] CapHeight: 686
    [INFO] XHeight: 444
    [INFO] LowerCaseAscent: 694
    [INFO] LowerCaseDescent: 194
    [INFO] Having widths for 255 characters (0-255).
    [INFO] for example: Char 0 has a width of 756
    [INFO]
    [INFO] Creating xml font file...
    [INFO]
    [INFO] Writing xml font file lmb10.xml...
    [INFO]
    [plankton@dell002 LULU_BOOKS]$ cat MakeFontMatrixFile.sh
    #!/bin/sh
    JAVA_HOME=/usr/java/jre1.6.0_02
    JAVA=$JAVA_HOME/bin/java
    FOP_HOME=/usr/share/java
    CP=$FOP_HOME/fop.jar:\
    $FOP_HOME/avalon-framework.jar

    PFM_FILE=/usr/share/texmf/fonts/type1/public/lm/lmb10.pfm
    FONT_MATRIX_FILE=`basename $PFM_FILE .pfm`.xml
    echo $FONT_MATRIX_FILE

    $JAVA -cp $CP \
    org.apache.fop.fonts.apps.PFMReader -enc ansi $PFM_FILE
    $FONT_MATRIX_FILE

    ... now I make my fo and pdf files ...

    [plankton@dell002 LULU_BOOKS]$ make
    xsltproc --output ideal_bartender_g.fo --stringparam fop.extensions 1
    --stringparam ulink.footnotes 1 --stringparam admon.graphics 1
    ./style_pdf.xsl ideal_bartender_g.xml
    Making portrait pages on USletter paper (8.5inx11in)
    export CLASSPATH=/usr/share/java/jai-1_1_2_01/lib/jai_core.jar:/usr/share/java/jai-1_1_2_01/lib/jai_codec.jar:/usr/share/java/jai-1_1_2_01/lib/mlibwrapper_jai.jar:/usr/share/java/lib/saxon.jar:/usr/share/java/fop-0.20.5/examples/servlet/lib/servlet-2.2.jar:/usr/share/java/fop-0.20.5/build/fop.jar:/usr/share/java/avalon-framework.jar:/usr/share/java/fop-0.20.5/lib/batik.jar:/usr/share/java/fop-0.20.5/lib/xalan-2.4.1.jar:/usr/share/java/fop-0.20.5/lib/xercesImpl-2.2.1.jar:/usr/share/java/fop-0.20.5/lib/jai_linuxi586.jar:/usr/share/java/fop-0.20.5/lib/xml-apis.jar
    ; export JAVA_HOME=/usr/share/java ; /usr/bin/fop -c
    /usr/share/fop/conf/userconfig.xml -fo ideal_bartender_g.fo -pdf
    ideal_bartender_g.pdf
    [INFO] Using org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser as SAX2 Parser
    [INFO] Using org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser as SAX2 Parser
    [INFO] FOP 0.20.5
    [INFO] Using org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser as SAX2 Parser
    [INFO] building formatting object tree
    [INFO] setting up fonts
    [ERROR] property - "background-position-horizontal" is not implemented yet.
    ... bunch of noising error message that don't seem to matter ....
    [INFO] [41]
    [INFO] Parsing of document complete, stopping renderer
    w3m -T test/html -S -dump -cols 80 ideal_bartender_g.html >
    ideal_bartender_g.txt
    /bin/sh: w3m: command not found
    make: [ideal_bartender_g.txt] Error 127 (ignored)
    [plankton@dell002 LULU_BOOKS]$ pdffonts ideal_bartender_g.pdf
    name type emb sub uni object ID
    ------------------------------------ ------------ --- --- --- ---------
    Helvetica-Bold Type 1 no no no 114 0
    Helvetica Type 1 no no no 115 0
    LMRomanDemi10-Regular Type 1 yes no no 118 0

    Now I need to know how to replace the Helvetica fonts ... anyone have
    any good suggestions on which font and how I need to edit my
    customization style sheet file?

    Thanks.
    Also I would like to thank
    http://www.getnet.com/~swhitlat/DocBook/XSL_Project_XSL_FOP.php
    for providing a example of the customized style sheet and Bob for
    pointing me to http://xmlgraphics.apache.org/fop/0.20.5/fonts.html

    On 9/19/07, Sheldon Plankton <sheldon.plankton@gmail.com> wrote:
    > It looks like if I want to have embedded fonts I need to generate a
    > "font matrics file".
    > Here how I have been trying to do that ...
    >
    > [plankton@dell002 BOOKS]$ cat MakeFontMatrixFile.sh
    > #!/bin/sh
    > JAVA_HOME=/usr/java/jre1.6.0_02
    > JAVA=$JAVA_HOME/bin/java
    > FOP_HOME=/usr/share/java
    > CP=$FOP_HOME/fop.jar:\
    > $FOP_HOME/avalon-framework.jar
    >
    > #PFM_FILE=/usr/share/texmf/fonts/type1/urw/helvetic/uhvb8a.pfb
    > PFM_FILE=/usr/share/texmf/fonts/type1/public/lm/lmb10.pfm
    > $JAVA -cp $CP \
    > org.apache.fop.fonts.apps.PFMReader -enc ansi $PFM_FILE my_font_matrix_file.xml
    >
    > ... the problem I am having is that lmb10.pfm is not the pfm file for
    > Helvetic-Bold, Helvetica or Times-Roman. Where are the pfm files for
    > these fonts?
    >
    > Thanks
    >



  • 3.  Re: [docbook-apps] Re: Generating font metricss file for Helvetica-Bold, Helvetica and Times-Roman?

    Posted 09-21-2007 08:08
    Hi,

    You appear to be on a Linux box. Install the gsfonts package (“Fonts for
    the Ghostscript interpreter(s)”). You will get clones of the 35
    well-known Postscript fonts, among which the base 14 PDF fonts (Times,
    Helvetica, Courier...).
    Go to the directory where these fonts are installed (probably
    /usr/share/fonts/type1/gsfonts)
    $ grep FullName *.afm
    You will get, for each file, the name of the font described in it.
    “Nimbus Roman No9 L” corresponds to Times, ”Nimbus Sans L” to Helvetica,
    “Nimbus Mono L” to Courier. Pick up the corresponding pfm files and
    generate the xml metrics like you did. You’re done.

    HTH,
    Vincent


    Sheldon Plankton a écrit :
    > I have had a minor success. I realized that I do not have to use
    > Helvetic-Bold, Helvetica or Times-Roman (At least I hope I do not.)
    > Because I was able to subsitutue Times-Roman for
    > LMRomanDemi10-Regular. This is the font in the lmb10.pfm PFM file.
    > What I had to do was this ...
    <snip/>
    >> ... the problem I am having is that lmb10.pfm is not the pfm file for
    >> Helvetic-Bold, Helvetica or Times-Roman. Where are the pfm files for
    >> these fonts?
    >>
    >> Thanks



  • 4.  Re: [docbook-apps] Re: Generating font metricss file for Helvetica-Bold, Helvetica and Times-Roman?

    Posted 09-21-2007 16:54
    Thanks Vincent,

    I am using FC6 and there does seem to be a gsfonts rpm available on my
    yum server.
    There is a ghostscript rpm and I have that installed but it doesn't seem to have
    files for the Helvetica fonts. I decided to give up on Helvetica fonts and just
    use the the Roman font I found. To make sure that all fonts used in my PDF
    I did this in my custome style sheet ...

    <xsl:param name="body.font.family">LMRomanDemi10-Regular</xsl:param>
    <xsl:param name="title.font.family">LMRomanDemi10-Regular</xsl:param>

    and this in my userconf.xml file ...

    <fonts>




    </fonts>
    ... now when I make my PDF I get this output from pdffonts ...

    [plankton@dell002 LULU_BOOKS]$ pdffonts ideal_bartender_g.pdf
    name type emb sub uni object ID
    ------------------------------------ ------------ --- --- --- ---------
    LMRomanDemi10-Regular Type 1 yes no no 116 0
    LMRomanDemi10-Regular Type 1 yes no no 120 0

    ... and this acceptable to lulu.com so its ok by me :)


    On 9/21/07, Vincent Hennebert <vincent.hennebert@anyware-tech.com> wrote:
    > Hi,
    >
    > You appear to be on a Linux box. Install the gsfonts package ("Fonts for
    > the Ghostscript interpreter(s)"). You will get clones of the 35
    > well-known Postscript fonts, among which the base 14 PDF fonts (Times,
    > Helvetica, Courier...).
    > Go to the directory where these fonts are installed (probably
    > /usr/share/fonts/type1/gsfonts)
    > $ grep FullName *.afm
    > You will get, for each file, the name of the font described in it.
    > "Nimbus Roman No9 L" corresponds to Times, "Nimbus Sans L" to Helvetica,
    > "Nimbus Mono L" to Courier. Pick up the corresponding pfm files and
    > generate the xml metrics like you did. You're done.
    >
    > HTH,
    > Vincent
    >
    >
    > Sheldon Plankton a écrit :
    > > I have had a minor success. I realized that I do not have to use
    > > Helvetic-Bold, Helvetica or Times-Roman (At least I hope I do not.)
    > > Because I was able to subsitutue Times-Roman for
    > > LMRomanDemi10-Regular. This is the font in the lmb10.pfm PFM file.
    > > What I had to do was this ...
    > <snip/>
    > >> ... the problem I am having is that lmb10.pfm is not the pfm file for
    > >> Helvetic-Bold, Helvetica or Times-Roman. Where are the pfm files for
    > >> these fonts?
    > >>
    > >> Thanks
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >