Next in thread → Next in month →

Re: [docbook-apps] reducing font sizes for a chapter in a book

From
<>
Date
2012-06-02T19:27:33+00:00
ID
Thread
Re: [docbook-apps] reducing font sizes for a chapter in a book
Jeff,

I use a simpler method that just uses a font-size attribute. A bit more 
crude, but it works for me. You could expand this to cover paras 
in chapters with that attribute. That would make sure that the titles for 
the chapter still looked like the same as others.

 

The downside of this code is that you have to do it for each para.

 

<!-- Change the font size of the block or para 
-->
<xsl:template match="para[@font-size]"> 

    <fo:block font-size="{@font-size}"> 

        <xsl:apply-templates/> 

    </fo:block> 

</xsl:template>

 

 

Regards,

Dean Nelson

 

In a message dated 6/1/2012 9:39:48 P.M. Pacific Daylight Time, 
 writes:

  

  
I’ve got a book that I need to output to 2 different page 
  formats, a larger size (7.5x9) for online viewing and a smaller size (4.125x6) 
  for print, so I’ve got a separate stylesheet for each book even though both 
  books contain the same XML content.

  
 

  
For the printed book, I’d like to keep the page count under 
  300 pages. Consequently, I’ve decided to reduce the fonts of two chapters of 
  the book (which contain specifications, regulatory info, etc.). I did this by 
  adding a custom attribute called “reducefont” to many elements, and then I 
  process those elements whose reducefont attribute is set to “yes”, thus 
  reducing the font size by 60%:

  
 

  
<xsl:template match="d:para">

  
  
  <fo:block xsl:use-attribute-sets="normal.para.spacing">

  
    
  <xsl:if test="@reducefont and (@reducefont = 'yes')">

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

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

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

  
      
  </xsl:attribute>

  
    
  </xsl:if>

  
    
  <xsl:call-template name="anchor"/>

  
    
  <xsl:apply-templates/>

  
  
  </fo:block>

  
</xsl:template>

  
 

  
This works, but it seems like a hack. Is there a simpler 
  way to resize the fonts in these two chapters?

  
 

  
Regards,

  
Jeff Powanda

  
Vocera Communications, 
Inc.
Next in thread → Next in month →