docbook-apps

  • 1.  Font color

    Posted 01-31-2012 13:04
    Hi all,

    I wonder if there is a way to set color easily for some part of my text ?

    For exemple :
    <emphasis role="???">My Colored Text</emphasis>

    As I expect that it's not so easy, does some of you have ever customized
    pdf stylesheets to do that ?

    Regards,
    Benjamin



  • 2.  Re: [docbook-apps] Font color

    Posted 02-10-2012 02:16
    Hi Benjamin,

    It's actually not that hard, as long as you already have a customization for other things. If you have, then you could add the following to your customization. For example, if you want red text:

    <xsl:template match="d:phrase[@role='red']">
    <fo:inline color="red">
    <xsl:apply-templates/>
    </fo:inline>
    </xsl:template>

    That will put text surrounded by <phrase role="red">here's some text you want in red</phrase> into red.

    Notice that I used phrase instead of emphasis. Either would work, just change d:phrase to d:emphasis in the template, but phrase exists for this sort of thing, so I'd probably use it first.

    If you have never done a customization, then it's a bit tougher. In that case, I'd suggest that you check out Bob Stayton's book, DocBook XSL: The Complete Guide, which is THE resource for customizers. You can find his book online at: sagehill.net/, but if you're going to do much with the DocBook styleguides, get the print version (available on Amazon) and read it from cover to cover.

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



    On Jan 31, 2012, at 5:03 AM, Benjamin DE DARDEL wrote:

    > Hi all,
    >
    > I wonder if there is a way to set color easily for some part of my text ?
    >
    > For exemple :
    > <emphasis role="???">My Colored Text</emphasis>
    >
    > As I expect that it's not so easy, does some of you have ever customized pdf stylesheets to do that ?
    >
    > Regards,
    > Benjamin