Ignore:
Timestamp:
03/10/08 04:34:14 (4 years ago)
Author:
jharrop
Message:

Sketch out using font-family cascade for HTML output. Not implemented in populateFontMappings yet, though.

Location:
trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java

    r159 r163  
    166166         
    167167 
    168         /** Create an html version of the document.  
     168        /** Create an html version of the document, using CSS font family 
     169         *  stacks.  This is appropriate if the HTML is intended for 
     170         *  viewing in a web browser, rather than an intermediate step 
     171         *  on the way to generating PDF output.  
    169172         *  
    170173         * @param result 
     
    173176         * */  
    174177    public void html(javax.xml.transform.Result result) throws Exception { 
     178 
     179        html(result, true); 
     180    } 
     181     
     182        /** Create an html version of the document.  
     183         *  
     184         * @param result 
     185         *            The javax.xml.transform.Result object to transform into  
     186         *  
     187         * */  
     188    public void html(javax.xml.transform.Result result, boolean fontFamilyStack) throws Exception { 
    175189         
    176190        /* 
     
    264278                //     possibly via an extension function in the XSLT 
    265279                xformer.setParameter("substituterInstance", s); 
     280                xformer.setParameter("fontFamilyStack", fontFamilyStack); 
    266281                 
    267282                 
     
    308323                org.w3c.dom.Document xhtmlDoc = org.docx4j.XmlUtils.neww3cDomDocument(); 
    309324                javax.xml.transform.dom.DOMResult result = new javax.xml.transform.dom.DOMResult(xhtmlDoc); 
    310                 html(result); 
     325                html(result, false); // false -> don't use HTML fonts. 
    311326                                 
    312327                // Now render the XHTML 
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/wordml2html-2007.xslt

    r153 r163  
    2929        exclude-result-prefixes="java msxsl ext w o v WX aml w10">       
    3030 
    31         <!--    xmlns:substituterClass= "org.docx4j.fonts.Substituter" 
    32         extension-element-prefixes="substituterClass"    
    33 --> 
    3431         
    3532<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" indent="yes" /> 
     
    3835<!-- Used in extension function for mapping fonts -->            
    3936<xsl:param name="substituterInstance"/> <!-- select="'passed in'"-->     
     37<xsl:param name="fontFamilyStack"/> <!-- select="'passed in'"-->         
    4038         
    4139 
     
    26382636<xsl:template match="w:rFonts" mode="rpr"> 
    26392637        <xsl:variable name="documentFont"><xsl:value-of select="string(@w:ascii)"/></xsl:variable> 
    2640         <xsl:variable name="targetFont" select="java:org.docx4j.fonts.Substituter.getPdfSubstituteFont($substituterInstance, string($documentFont))" /> 
     2638        <xsl:variable name="targetFont" select="java:org.docx4j.fonts.Substituter.getSubstituteFontXsltExtension($substituterInstance, string($documentFont), boolean($fontFamilyStack))" /> 
    26412639        font-family:<xsl:value-of select="$targetFont"/>; 
    26422640</xsl:template> 
Note: See TracChangeset for help on using the changeset viewer.