hgbook

changeset 886:8a2b0994ccd9

Make pdf looks more beautiful
author Dongsheng Song <dongsheng.song@gmail.com>
date Thu Oct 22 15:08:18 2009 +0800 (2009-10-22)
parents 4fb00c894429
children 0aeeeab529d6
files stylesheets/fo.xsl stylesheets/zh/fo.xsl
line diff
     1.1 --- a/stylesheets/fo.xsl	Thu Oct 22 11:24:54 2009 +0800
     1.2 +++ b/stylesheets/fo.xsl	Thu Oct 22 15:08:18 2009 +0800
     1.3 @@ -1,8 +1,12 @@
     1.4  <?xml version="1.0"?>
     1.5 -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
     1.6 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     1.7 +      xmlns:fo="http://www.w3.org/1999/XSL/Format"
     1.8 +      version='1.0'>
     1.9  
    1.10    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
    1.11  
    1.12 +  <xsl:param name="l10n.gentext.language" select="'en'"/>
    1.13 +  <xsl:param name="paper.type" select="'A4'"></xsl:param>
    1.14    <xsl:param name="draft.mode" select="no"/>
    1.15  
    1.16    <!-- These extensions are required for table printing and other stuff -->
    1.17 @@ -22,42 +26,24 @@
    1.18    <xsl:param name="section.autolabel" select="1" />
    1.19    <xsl:param name="section.label.includes.component.label">1</xsl:param>
    1.20  
    1.21 -  <xsl:param name="variablelist.as.blocks" select="1" />        <!-- fo only -->
    1.22 -  <xsl:param name="hyphenate">false</xsl:param>                 <!-- fo only -->
    1.23 -  <xsl:param name="paper.type" select="'A4'"></xsl:param>       <!-- fo only -->
    1.24 +  <xsl:param name="variablelist.as.blocks" select="1" />
    1.25 +  <xsl:param name="hyphenate">false</xsl:param>
    1.26  
    1.27 -  <!-- Default font settings -->
    1.28 -  <!--
    1.29 -  <xsl:param name="title.font.family">sans-serif</xsl:param>
    1.30 -  <xsl:param name="body.font.family">serif</xsl:param>
    1.31 -  <xsl:param name="sans.font.family">sans-serif</xsl:param>
    1.32 -  <xsl:param name="dingbat.font.family">serif</xsl:param>
    1.33 -  <xsl:param name="monospace.font.family">monospace</xsl:param>
    1.34 +  <!-- Font settings, we use characters out of base14 even for english -->
    1.35 +  <xsl:param name="title.font.family">sans-serif,Arial</xsl:param>
    1.36 +  <xsl:param name="body.font.family">serif,Times New Roman</xsl:param>
    1.37 +  <xsl:param name="sans.font.family">sans-serif,Arial</xsl:param>
    1.38 +  <xsl:param name="dingbat.font.family">serif,Times New Roman</xsl:param>
    1.39 +  <xsl:param name="monospace.font.family">monospace,Courier New</xsl:param>
    1.40    <xsl:param name="symbol.font.family">Symbol,ZapfDingbats</xsl:param>
    1.41 -  -->
    1.42  
    1.43 -  <!-- Custom font settings - preferred truetype font -->
    1.44 -  <xsl:param name="title.font.family">Calibri,sans-serif,SimHei</xsl:param>
    1.45 -  <xsl:param name="body.font.family">Cambria,Cambria Math,serif,SimSun</xsl:param>
    1.46 -  <xsl:param name="sans.font.family">Calibri,sans-serif,SimHei</xsl:param>
    1.47 -  <xsl:param name="dingbat.font.family">Cambria,Cambria Math,serif,SimSun</xsl:param>
    1.48 -  <xsl:param name="monospace.font.family">Courier New,monospace,FangSong</xsl:param>
    1.49 -
    1.50 -  <!-- Page related Settings -->
    1.51 +  <!-- Page related settings -->
    1.52    <xsl:param name="page.margin.inner">1.5cm</xsl:param>
    1.53    <xsl:param name="page.margin.outer">1.5cm</xsl:param>
    1.54    <xsl:param name="title.margin.left">0pt</xsl:param>
    1.55    <xsl:param name="body.start.indent">24pt</xsl:param>
    1.56    <xsl:param name="body.end.indent">0pt</xsl:param>
    1.57  
    1.58 -  <!-- Breaking long lines -->
    1.59 -  <xsl:param name="hyphenate.verbatim">0</xsl:param>
    1.60 -  <xsl:attribute-set name="monospace.verbatim.properties"
    1.61 -                     use-attribute-sets="verbatim.properties monospace.properties">
    1.62 -    <xsl:attribute name="wrap-option">wrap</xsl:attribute>
    1.63 -    <xsl:attribute name="hyphenation-character">&#x25BA;</xsl:attribute>
    1.64 -  </xsl:attribute-set>
    1.65 -
    1.66    <!-- Prevent blank pages in output -->
    1.67    <xsl:template name="book.titlepage.before.verso">
    1.68    </xsl:template>
    1.69 @@ -66,6 +52,105 @@
    1.70    <xsl:template name="book.titlepage.separator">
    1.71    </xsl:template>
    1.72  
    1.73 +  <!-- titlepage settings -->
    1.74 +  <xsl:template name="book.titlepage">
    1.75 +    <fo:block>
    1.76 +        <fo:table table-layout="fixed" space-after.optimum="10pt" width="100%">
    1.77 +            <fo:table-body>
    1.78 +                <fo:table-row>
    1.79 +                    <fo:table-cell>
    1.80 +                        <fo:block text-align="center">
    1.81 +                          <!--fo:external-graphic src="url(figs/cover-logo.png)"
    1.82 +                              width="90%"  height="auto" content-width="scale-to-fit" content-height="scale-to-fit" /-->
    1.83 +                        </fo:block>
    1.84 +                    </fo:table-cell>
    1.85 +                </fo:table-row>
    1.86 +            </fo:table-body>
    1.87 +        </fo:table>
    1.88 +    </fo:block>
    1.89 +
    1.90 +    <fo:block text-align="center" color="#000000" margin-left="1cm" margin-right="1cm"
    1.91 +        space-before.optimum="3cm" space-after.optimum="5.0cm"
    1.92 +        font-weight="900" font-size="32pt">
    1.93 +      <xsl:attribute name="font-family"><xsl:value-of select="$title.font.family" /></xsl:attribute>
    1.94 +
    1.95 +      <xsl:value-of select="/book/title"/>
    1.96 +    </fo:block>
    1.97 +
    1.98 +    <fo:block text-align="center" color="#000080" margin-left="1cm" margin-right="1cm"
    1.99 +        space-before.optimum="2cm" space-after.optimum="8.0cm"
   1.100 +        font-weight="900" font-size="16pt">
   1.101 +      <xsl:attribute name="font-family"><xsl:value-of select="$title.font.family" /></xsl:attribute>
   1.102 +
   1.103 +      <xsl:value-of select="/book/subtitle"/>
   1.104 +    </fo:block>
   1.105 +
   1.106 +    <fo:block text-align="center" color="#000000" margin-left="1cm" margin-right="1cm"
   1.107 +        space-before.optimum="8cm" space-after.optimum="10cm"
   1.108 +        font-weight="600" font-size="24pt">
   1.109 +      <xsl:attribute name="font-family"><xsl:value-of select="$title.font.family" /></xsl:attribute>
   1.110 +
   1.111 +      <xsl:call-template name="person.name.list">
   1.112 +        <xsl:with-param name="person.list" select="bookinfo/authorgroup/author"/>
   1.113 +      </xsl:call-template>
   1.114 +    </fo:block>
   1.115 +
   1.116 +    <!--fo:block text-align="end"    color="#666D70" margin-left="1cm" margin-right="1cm"
   1.117 +        font-family="sans-serif" font-weight="normal" font-size="10pt" >
   1.118 +      <xsl:value-of select="/book/subtitle"/>
   1.119 +    </fo:block-->
   1.120 +  </xsl:template>
   1.121 +
   1.122 +  <!-- title settings -->
   1.123 +  <xsl:attribute-set name="preface.titlepage.recto.style">
   1.124 +    <xsl:attribute name="color">#7C1C51</xsl:attribute>
   1.125 +  </xsl:attribute-set>
   1.126 +  <xsl:attribute-set name="chapter.titlepage.recto.style">
   1.127 +    <xsl:attribute name="color">#7C1C51</xsl:attribute>
   1.128 +  </xsl:attribute-set>
   1.129 +  <xsl:attribute-set name="section.titlepage.recto.style">
   1.130 +    <xsl:attribute name="color">#7C1C51</xsl:attribute>
   1.131 +  </xsl:attribute-set>
   1.132 +  <xsl:attribute-set name="appendix.titlepage.recto.style">
   1.133 +    <xsl:attribute name="color">#7C1C51</xsl:attribute>
   1.134 +  </xsl:attribute-set>
   1.135 +
   1.136 +  <!-- Verbatim related settings -->
   1.137 +  <xsl:param name="hyphenate.verbatim">0</xsl:param>
   1.138 +
   1.139 +  <xsl:attribute-set name="monospace.properties">
   1.140 +    <xsl:attribute name="font-family">
   1.141 +      <xsl:value-of select="$monospace.font.family"/>
   1.142 +    </xsl:attribute>
   1.143 +      <xsl:attribute name="color">#000080</xsl:attribute>
   1.144 +  </xsl:attribute-set>
   1.145 +
   1.146 +  <xsl:attribute-set name="monospace.verbatim.properties"
   1.147 +                     use-attribute-sets="verbatim.properties monospace.properties">
   1.148 +    <xsl:attribute name="border-color">blue</xsl:attribute>
   1.149 +    <xsl:attribute name="border-width">thin</xsl:attribute>
   1.150 +    <xsl:attribute name="border-style">solid</xsl:attribute>
   1.151 +    <xsl:attribute name="font-size">8pt</xsl:attribute>
   1.152 +    <xsl:attribute name="wrap-option">wrap</xsl:attribute>
   1.153 +    <xsl:attribute name="hyphenation-character">&#x25BA;</xsl:attribute>
   1.154 +    <!--xsl:attribute name="hyphenation-character">&#x27A4;</xsl:attribute-->
   1.155 +  </xsl:attribute-set>
   1.156 +
   1.157 +  <!-- emphasis settings -->
   1.158 +  <xsl:template match="emphasis">
   1.159 +    <xsl:param name="content">
   1.160 +      <xsl:call-template name="simple.xlink">
   1.161 +        <xsl:with-param name="content">
   1.162 +          <xsl:apply-templates/>
   1.163 +        </xsl:with-param>
   1.164 +      </xsl:call-template>
   1.165 +    </xsl:param>
   1.166 +
   1.167 +    <fo:inline color="#7C1C51" font-weight="bold">
   1.168 +      <xsl:copy-of select="$content"/>
   1.169 +    </fo:inline>
   1.170 +  </xsl:template>
   1.171 +
   1.172    <!-- Colourize links in output -->
   1.173    <xsl:attribute-set name="xref.properties">
   1.174      <xsl:attribute name="color">
     2.1 --- a/stylesheets/zh/fo.xsl	Thu Oct 22 11:24:54 2009 +0800
     2.2 +++ b/stylesheets/zh/fo.xsl	Thu Oct 22 15:08:18 2009 +0800
     2.3 @@ -8,6 +8,13 @@
     2.4    <xsl:param name="l10n.gentext.language" select="'zh'"/>
     2.5  
     2.6    <!-- Chinese font related settings -->
     2.7 +  <xsl:param name="title.font.family">Calibri,sans-serif,SimHei</xsl:param>
     2.8 +  <xsl:param name="body.font.family">Cambria,Cambria Math,serif,SimSun</xsl:param>
     2.9 +  <xsl:param name="sans.font.family">Calibri,sans-serif,SimHei</xsl:param>
    2.10 +  <xsl:param name="dingbat.font.family">Cambria,Cambria Math,serif,SimSun</xsl:param>
    2.11 +  <xsl:param name="monospace.font.family">Courier New,monospace,FangSong</xsl:param>
    2.12 +
    2.13 +  <!-- Chinese para related settings -->
    2.14    <xsl:param name="body.font.master">12</xsl:param>
    2.15  
    2.16    <xsl:attribute-set name="standard.para.spacing" use-attribute-sets="normal.para.spacing">