← Prev in month ← Prev in thread
Next in thread → Next in month →

Colored titles and custom font

From
Peter Schmelzer <>
Date
2018-04-27T06:38:51+00:00
ID
Thread
Colored titles and custom font
Hi,
i'm new to Docbook, so I apologize for any stupid question.

I want to achieve that all titles like titlepage, chapter, section, index etc. share the same font and the same color. I've read Bob Stayton's guidline "http://www.sagehill.net/docbookxsl/TitleFontSizes.html", but I'm unable the reproduce the guideline for other titles like index and so on.

What do I have at the moment is the following (shortened):

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://docbook.org/ns/docbook"

    xmlns:d="http://docbook.org/ns/docbook" version="1.0">

    <xsl:import href="" href="https://cdn.docbook.org/release/xsl/current/fo/docbook.xsl">https://cdn.docbook.org/release/xsl/current/fo/docbook.xsl"/>

    <!-- Standard Schriftgrösse -->

    <xsl:param name="body.font.master">11</xsl:param>

    <!-- Schriftart für Fliesstext ändern -->

    <xsl:param name="body.font.family">"Calibri"</xsl:param>

    <!-- Schriftart für Titel ändern -->

    <xsl:param name="title.font.family">"TrajanPro-Bold"</xsl:param>

    <!-- Farbe für Überschriften und Titel -->

    <xsl:param name="title.color">#014A78</xsl:param>

    <!-- Grafik für Kopfzeilen -->

    <xsl:param name="header.image.filename">../images/my.svg</xsl:param>

    <!-- ... -->

    <xsl:param name="toc.section.depth">2</xsl:param>

    <xsl:param name="insert.xref.page.number">0</xsl:param>

    <!--

        Voreinstellung: Seitenlayout

    -->

    <xsl:param name="page.orientation">portrait</xsl:param>

    <xsl:param name="page.height.portrait">297mm</xsl:param>

    <xsl:param name="page.width.portrait">210mm</xsl:param>

    <xsl:param name="page.margin.inner">20mm</xsl:param>

    <xsl:param name="page.margin.outer">15mm</xsl:param>

    <xsl:param name="page.margin.top">10mm</xsl:param>

    <xsl:param name="region.before.extent">17mm</xsl:param>

    <xsl:param name="body.margin.top">30mm</xsl:param>

    <xsl:param name="region.after.extent">15mm</xsl:param>

    <xsl:param name="page.margin.bottom">10mm</xsl:param>

    <xsl:param name="body.margin.bottom">22mm</xsl:param>

    <!-- Kein Einzug für Fliesstext -->

    <xsl:param name="body.start.indent">0pt</xsl:param>

    <!-- Lange Zeilen umbrechen (z.B. Listings) -->

    <xsl:param name="fop1.extensions">1</xsl:param>

    <xsl:param name="hyphenate">true</xsl:param>

    <xsl:param name="hyphenate.verbatim" select="1"/>

    <!-- Einseitige PDF Dokumente (Bildschirm) -->

    <xsl:param name="double.sided">0</xsl:param>

    <!--

        Voreinstellung: Kopfzeile

    -->

    <xsl:template name="header.content">

        <xsl:param name="pageclass" select="''"/>

        <xsl:param name="sequence" select="''"/>

        <xsl:param name="position" select="''"/>

        <xsl:param name="gentext-key" select="''"/>

        <fo:block>

            <!-- sequence can be odd, even, first, blank -->

            <!-- position can be left, center, right -->

            <xsl:choose>

                <xsl:when test="$sequence = 'blank'">

                    <!-- nothing -->

                </xsl:when>

                <xsl:when test="$position='left'">

                    <!-- Same for odd, even, empty, and blank sequences -->

                    <xsl:call-template name="draft.text"/>

                </xsl:when>

                <xsl:when test="($sequence='odd' or $sequence='even') and $position='center'">

                    <!-- nothing -->

                </xsl:when>

                <xsl:when test="$position='center'">

                    <!-- nothing for empty and blank sequences -->

                </xsl:when>

                <xsl:when test="$position='right'">

                    <!-- Same for odd, even, empty, and blank sequences -->

                    <!--<xsl:call-template name="draft.text"/>-->

                    <fo:external-graphic content-height="25mm">

                        <xsl:attribute name="src">

                            <xsl:call-template name="fo-external-image">

                                <xsl:with-param name="filename" select="$header.image.filename"/>

                            </xsl:call-template>

                        </xsl:attribute>

                    </fo:external-graphic>

                </xsl:when>

                <xsl:when test="$sequence = 'first'">

                    <!-- nothing for first pages -->

                </xsl:when>

                <xsl:when test="$sequence = 'blank'">

                    <!-- nothing for blank pages -->

                </xsl:when>

            </xsl:choose>

        </fo:block>

    </xsl:template>

        Anpassung Schriftarten für Titel etc.

    -->

    <!-- Anpassung Schriftart für Titelseite -->

    <xsl:template match="d:title" mode="book.titlepage.recto.auto.mode">

        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"

            xsl:use-attribute-sets="book.titlepage.recto.style" text-align="center" font-size="32pt"

            space-before="18.6624pt" font-weight="bold" font-family="{$title.fontset}" color="{$title.color}">

            <xsl:call-template name="division.title">

                <xsl:with-param name="node" select="ancestor-or-self::d:book[1]"/>

            </xsl:call-template>

            <fo:block space-before="1em" space-after="1em">

                <fo:external-graphic src="" content-height="50%"

                    scaling="uniform"/>

            </fo:block>

        </fo:block>

    </xsl:template>

    <!-- Anpassung Schriftart für Kapitel -->

    <xsl:template match="d:title" mode="chapter.titlepage.recto.auto.mode">

        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"

            xsl:use-attribute-sets="chapter.titlepage.recto.style" font-size="22pt"

            font-weight="bold" space-after=".4in" color="{$title.color}">

            <xsl:call-template name="component.title">

                <xsl:with-param name="node" select="ancestor-or-self::d:chapter[1]"/>

            </xsl:call-template>

        </fo:block>

    </xsl:template>

    <!-- Anpassung Schriftart für Abschnittstitel Level 1 -->

    <xsl:attribute-set name="section.title.level1.properties">

        <xsl:attribute name="color">

            <xsl:value-of select="$title.color"/>

        </xsl:attribute>

        <xsl:attribute name="font-size">

            <xsl:value-of select="$body.font.master * 1.2"/>

            <xsl:text>pt</xsl:text>

        </xsl:attribute>

    </xsl:attribute-set>

    <!-- Anpassung Schriftart für Abschnittstitel Level 2 -->

    <xsl:attribute-set name="section.title.level2.properties">

        <xsl:attribute name="color">

            <xsl:value-of select="$title.color"/>

        </xsl:attribute>

        <xsl:attribute name="font-size">

            <xsl:value-of select="$body.font.master * 1.1"/>

            <xsl:text>pt</xsl:text>

        </xsl:attribute>

    </xsl:attribute-set>

    <!-- Anpassung Schriftart für Abschnittstitel Level 3 -->

    <xsl:attribute-set name="section.title.level3.properties">

        <xsl:attribute name="color">

            <xsl:value-of select="$title.color"/>

        </xsl:attribute>

        <xsl:attribute name="font-size">

            <xsl:value-of select="$body.font.master"/>

            <xsl:text>pt</xsl:text>

        </xsl:attribute>

    </xsl:attribute-set>

    <!-- Anpassung Schriftart für Anhang -->

    <xsl:template match="d:title" mode="appendix.titlepage.recto.auto.mode">

        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"

            xsl:use-attribute-sets="appendix.titlepage.recto.style"

            margin-left="{$title.margin.left}" font-size="22pt" space-after=".4in"

            font-weight="bold" font-family="{$title.fontset}" color="{$title.color}">

            <xsl:call-template name="component.title">

                <xsl:with-param name="node" select="ancestor-or-self::d:appendix[1]"/>

            </xsl:call-template>

        </fo:block>

    </xsl:template>

    <!-- Anpassung Schriftart für allgemeine Beschriftungen -->

    <xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">

        <xsl:attribute name="font-weight">bold</xsl:attribute>

        <xsl:attribute name="font-size">9pt</xsl:attribute>

        <xsl:attribute name="hyphenate">false</xsl:attribute>

        <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>

        <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>

        <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>

    </xsl:attribute-set>

</xsl:stylesheet>

Thanks for help.

Best regards

Peter
← Prev in month ← Prev in thread
Next in thread → Next in month →