docbook-apps

  • 1.  Font-size definition

    Posted 04-17-2008 14:31
    Hello folks,

    In my custom stylesheet I defined my own template for guilabel,
    guimenu, etc.

    Sometimes I use those tags inside section title and I would like to a
    font-size proportional to the title font size.

    I tried with font-size="0.9em" (in the fo:inline statement). It's ok
    for the titles, but it's to big for normal text. In this case it
    should be proportional to $body.font.master.

    The section font-size are already proportional to $body.font.master.

    <xsl:template name="myGuiMenu">
    <xsl:param name="content">
    <xsl:apply-templates/>
    </xsl:param>
    <fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format" font-
    family="LucidaGrande" font-weight="normal" font-size="0.9em">
    <xsl:if test="@id">
    <xsl:attribute name="id">
    <xsl:value-of select="@id"/>
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="@dir">
    <xsl:attribute name="direction">
    <xsl:choose>
    <xsl:when test="@dir = 'ltr' or @dir =
    'lro'">ltr</xsl:when>
    <xsl:otherwise>rtl</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    </xsl:if>
    <xsl:copy-of select="$content"/>
    </fo:inline>
    </xsl:template>

    How can I to that without define another template for the titles ?

    Thanks in advance,
    Jacques



  • 2.  Re: [docbook-apps] Font-size definition

    Posted 04-17-2008 23:20
    I had a similar problem resizing a font in different contexts. You can use
    xsl:attribute to set font-size and put an xsl:choose inside it like this:

    <fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format"
    font-family="LucidaGrande" font-weight="normal">
    <xsl:attribute name="font-size">
    <xsl:choose>
    <xsl:when test="ancestor::title
    or ancestor::literal
    or ancestor::filename
    or ancestor::programlisting
    or ancestor::literallayout">0.9em</xsl:when>
    <xsl:otherwise>0.8em</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    ...

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net





  • 3.  Access to ancestor Font-size definition

    Posted 03-05-2010 14:09
    On 18 avr. 2008, at 01:20, Bob Stayton wrote:
    Hello,

    A long time ago I had a problem for resizing fonts in different context and Bob gave me this answer which until today.
    > <fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="LucidaGrande" font-weight="normal">
    > <xsl:attribute name="font-size">
    > <xsl:choose>
    > <xsl:when test="ancestor::title
    > or ancestor::literal
    > or ancestor::filename
    > or ancestor::programlisting
    > or ancestor::literallayout">0.9em</xsl:when>
    > <xsl:otherwise>0.8em</xsl:otherwise>
    > </xsl:choose>
    > </xsl:attribute>


    I found that in some case the font-size is too big or too small. So I tried to correct by using, instead of 0.9em size the ancestor font-size and a value. The first problem is to access to the ancestor font size :

    <xsl:attribute name="font-size">
    <xsl:choose>
    <xsl:when test="ancestor::d:title
    or ancestor::d:info
    or ancestor::d:literal
    or ancestor::d:filename
    or ancestor::d:programlisting
    or ancestor::d:literallayout"><xsl:value-of select="ancestor::?????"/></xsl:when>
    <xsl:otherwise>0.75em</xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>

    And I don't know what to put to replace my ?????

    May be I'm on the wrong way, but I have no other ideas.

    Thanks in advance for your help,

    Jacques