docbook-apps

  • 1.  Re: [docbook-apps] embedding fonts in generated pdf

    Posted 07-16-2012 17:29
    I second the suggestion of using fonts other than the "standard" fonts for embedding
    in PDFs. The Type 1 fonts you list are not embeddable unless you purchase the font
    outlines from Adobe and install them on your system. The font outlines (the code that
    draws the letter shapes) are not included in any operating system that I know of
    because of that licensing fee. They were originally built into every printing device,
    and so the operating system only needed to the font metric files to set type in those
    fonts. Windows substitutes Arial and Times New Roman TrueType fonts, which are
    embeddable.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    ----- Original Message -----
    From: "Thomas Schraitle" <tom_schr@web.de>
    To: <docbook-apps@lists.oasis-open.org>
    Cc: "Stefan Seefeld" <stefan@seefeld.name>
    Sent: Monday, July 16, 2012 9:25 AM
    Subject: Re: [docbook-apps] embedding fonts in generated pdf


    Hi Stefan,

    Am Montag, 16. Juli 2012, 10:55:48 schrieb Stefan Seefeld:
    >
    > [...] I hope that the question is
    > common enough in this community that someone may actually be able to help.

    But it's related to DocBook. ;-)


    > For an IEEE paper submission I need to embed the used fonts into the
    > pdf. I'm using fop, and `pdffonts paper.pdf` reports
    >
    > name type emb sub uni object ID
    > --------------------- ----------------- --- --- --- ---------
    > Helvetica Type 1 no no no 181 0
    > Times-Roman Type 1 no no no 182 0
    > Times-BoldItalic Type 1 no no no 183 0
    > Courier Type 1 no no no 184 0
    > Times-Italic Type 1 no no no 185 0
    > Times-Bold Type 1 no no no 186 0
    >
    > http://www.sagehill.net/docbookxsl/AddFont.html suggests that I need to
    > generate a font metrics file for the fonts I'd like to embed. So I'm
    > looking for the above fonts on my system (Fedora 17).

    I don't think you need the font metric files anymore. FOP can automatically
    detect any font, see [1]. You just need to tell FOP what directory it needs to
    be searched:

    <renderers>
    <renderer mime="application/pdf">
    <fonts>

    <directory>/usr/share/fonts/truetype</directory>


    <auto-detect/>
    </fonts>
    </renderer>
    </renderers>


    > Any suggestion as to how to embed the standard (default) fonts when
    > generating pdf from DocBook ?

    Does it really need to be the "standard" fonts? There are so many fonts out
    there that are more legible and aesthetically more pleasant than these boring
    "standard" fonts.

    I've collected a small, but incomplete list in my book's project[2].
    Unfortunately, the topic isn't finished yet and contains some FIXMEs and TBDs.
    :) Maybe you find some fonts which is for your needs.

    If you have found some, make sure to set the font parameters in [3]. Set at
    least body.font.family, sans.font.family, and monospace.font.family.


    Have fun!


    ------ References
    [1] http://xmlgraphics.apache.org/fop/trunk/fonts.html
    [2] http://doccookbook.sf.net/html/en/dbc.common.fonts.html
    [3] http://docbook.sourceforge.net/release/xsl/current/doc/fo/fonts.html

    --
    Gruß/Regards
    Thomas Schraitle


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






  • 2.  Re: [docbook-apps] embedding fonts in generated pdf

    Posted 07-16-2012 17:56
    On 2012-07-16 13:28, Bob Stayton wrote:
    > I second the suggestion of using fonts other than the "standard" fonts
    > for embedding in PDFs. The Type 1 fonts you list are not embeddable
    > unless you purchase the font outlines from Adobe and install them on
    > your system. The font outlines (the code that draws the letter
    > shapes) are not included in any operating system that I know of
    > because of that licensing fee. They were originally built into every
    > printing device, and so the operating system only needed to the font
    > metric files to set type in those fonts. Windows substitutes Arial
    > and Times New Roman TrueType fonts, which are embeddable.

    Ah ! I sense slowly a consistent picture forming in my mind. :-)

    Still, I seem to be missing some missing link. For example: Who or what
    caused the generated pdf to reference Type 1 fonts, and what would it
    take to switch to TrueType ?

    Thanks,
    Stefan

    --

    ...ich hab' noch einen Koffer in Berlin...




  • 3.  Re: [docbook-apps] embedding fonts in generated pdf

    Posted 07-16-2012 18:49
    Hi,

    Am Montag, 16. Juli 2012, 13:55:56 schrieb Stefan Seefeld:
    > [...]
    >
    > Ah ! I sense slowly a consistent picture forming in my mind. :-)

    That's good. :-)


    > Still, I seem to be missing some missing link. For example: Who or what
    > caused the generated pdf to reference Type 1 fonts, and what would it
    > take to switch to TrueType ?

    Well, let me give you a short explanation. You start with the idea that you
    want to use a different font in your document. Here are the usual steps that I
    take:

    1. Look for some fonts that seem to fit into your document.
    In practise, a serif font should "match" with a sans serif and also with a
    monospace font.
    Also take into account the license. Commercial fonts allow ONLY to embed the
    glyphs that are used, but NOT to include the complete font.

    2. Download or install the font.

    3. Open the font in FontForge[1].
    After you've opened the font, click Element > Font Info. That is needed to get
    the "real font name". For example, the normal Linux Libertine font file is
    named LinLibertine_R.otf, but the font name is "LinLibertineO".
    I always have to try if I need the entry from the "Fontname" or the "Family
    Name".
    Maybe there is a better solution, but I found out this always worked for me.

    4. Use the font name from the previous step.
    Insert the font name(s) in the font-family attribute of your FO file:

    <fo:block font-family="LinLibertineO"> The quick brown fox ... </fo:block>

    Usually, you don't do this step manually, but set the DocBook parameters
    body.font.family etc.

    The FO spec allows also to "cascade" fonts, so in theory it is allowed to
    write this:

    <fo:block font-family="LinLibertineO,DejaVu"> The quick brown fox ...
    </fo:block>

    That means, if a requested glyph cannot be found in Linux Libertine, FOP will
    search in the DejaVu font. I'm not sure, if FOP supports this. You have to try
    it out.

    Be aware: If your font name from step 3 contains a space, wrap it in single
    quotes, for example font-family="'Foo Regular'"

    5. Create a new FOP configuration file as described in
    http://xmlgraphics.apache.org/fop/trunk/fonts.html#basics

    6. Format your document with FOP by using your configuration file from step 5,
    for example:
    $ fop -c myconfig.xml Book.fo Book.pdf


    Hope the above steps makes it clearer for you.


    Good luck! :-)


    ------
    [1] http://fontforge.sourceforge.net/

    --
    Gruß/Regards
    Thomas Schraitle




  • 4.  Re: [docbook-apps] embedding fonts in generated pdf

    Posted 07-16-2012 18:58
    On 2012-07-16 14:49, Thomas Schraitle wrote:
    >
    >> Still, I seem to be missing some missing link. For example: Who or what
    >> caused the generated pdf to reference Type 1 fonts, and what would it
    >> take to switch to TrueType ?
    > Well, let me give you a short explanation. You start with the idea that you
    > want to use a different font in your document.

    [...]

    Thanks for the explanation. You are describing steps to change the
    font-family. The issue I have above is not with font-families, but with
    font types. The generated pdf is referring to various Type 1 fonts
    (Times, Helvetica, Courier). I have locally installed the equivalent
    TrueType fonts, and told FOP about them in the configuration file. But
    it still generates pdfs referring to unembedded Type 1 fonts.
    The change of a font family doesn't even enter the picture here, or does
    it ?

    Thanks,
    Stefan

    --

    ...ich hab' noch einen Koffer in Berlin...




  • 5.  Re: [docbook-apps] embedding fonts in generated pdf

    Posted 07-16-2012 19:59
    Hi Stefan,

    Am Montag, 16. Juli 2012, 14:57:37 schrieb Stefan Seefeld:
    >
    > [...]
    >
    > Thanks for the explanation. You are describing steps to change the
    > font-family.

    That's true.


    > The issue I have above is not with font-families, but with
    > font types.

    I know. However, you need to insert your font somewhere, so the font-family
    attribute maps to a font type.


    > The generated pdf is referring to various Type 1 fonts
    > (Times, Helvetica, Courier). I have locally installed the equivalent
    > TrueType fonts, and told FOP about them in the configuration file. But
    > it still generates pdfs referring to unembedded Type 1 fonts.
    > The change of a font family doesn't even enter the picture here, or does
    > it ?

    Well, I guess it's a configuration issue. If you really want to use the
    aequivalent to Times, Helvetica, and Courier, I've found a comment in the
    "fop.xconf" file:

    -----------
    <fonts>




    </fonts>
    -----------

    It seems to me, you need to remove the XML comment before
    and add the path to the Arial TTF file. Same with the other two font types.

    I haven't tried it out, but it could work. The other solution would be to use
    a totally different font. In that case you have probably more glyphs available
    than Arial or some Helvetica clone.


    --
    Gruß/Regards
    Thomas Schraitle




  • 6.  Re: [docbook-apps] embedding fonts in generated pdf

    Posted 07-17-2012 05:58
    On 07/16/2012 07:57 PM, Stefan Seefeld wrote:
    > On 2012-07-16 14:49, Thomas Schraitle wrote:
    >>
    >>> Still, I seem to be missing some missing link. For example: Who or what
    >>> caused the generated pdf to reference Type 1 fonts, and what would it
    >>> take to switch to TrueType ?
    >> Well, let me give you a short explanation. You start with the idea that you
    >> want to use a different font in your document.
    >
    > [...]
    >
    > Thanks for the explanation. You are describing steps to change the
    > font-family. The issue I have above is not with font-families, but with
    > font types. The generated pdf is referring to various Type 1 fonts
    > (Times, Helvetica, Courier). I have locally installed the equivalent
    > TrueType fonts, and told FOP about them in the configuration file. But
    > it still generates pdfs referring to unembedded Type 1 fonts.
    > The change of a font family doesn't even enter the picture here, or does
    > it ?
    >
    > Thanks,
    > Stefan


    The XSL-FO WG in W3C were unwilling to adopt font configuration as part
    of the W3C WD, hence it is down to the formatter manufacturer.

    The Rec simply says use this or that font-family attribute, which is
    inherited. Mapping of a font-family to a font file (of any type) is
    implementation dependent.

    What this also means is that the formatter, when it is unable to find a
    glyph matching a code point, can fall back on any font it likes, rather
    than warn the stylesheet writer and author. I think this is bad.
    Most formatters have... final fallback fonts, often installed in
    the formatter installation directory, which provide MOST (not all)
    common glyphs. So they fall back on those (silently) when the fonts
    about which it knows, through the font configuration file, and the
    font-family specification list, have been exhausted.

    What font type is supported is wholly implementation dependent.

    HTH DaveP





    regards

    --
    Dave Pawson
    XSLT XSL-FO FAQ.
    http://www.dpawson.co.uk