Ignore:
Timestamp:
03/21/09 21:01:38 (3 years ago)
Author:
jharrop
Message:

Font stuff should be working now for html export, pdf via html, and pdf via xsl fo. Still to test, and do bold/italics.

File:
1 edited

Legend:

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

    r695 r708  
    3636import org.apache.log4j.Logger; 
    3737import org.docx4j.convert.out.xmlPackage.XmlPackage; 
    38 import org.docx4j.fonts.Substituter; 
     38import org.docx4j.fonts.Mapper; 
    3939import org.docx4j.fonts.FontUtils; 
    4040import org.docx4j.jaxb.Context; 
     
    244244     
    245245     
    246      
    247     public void setFontSubstituter(Substituter fs) throws Exception { 
    248         if (fs == null) { 
     246/* There should be a mapper per document, 
     247 * but PhysicalFonts should be system wide. 
     248 *  
     249 * The only way PhysicalFonts will change 
     250 * is if fonts are added/removed while 
     251 * docx4j is executing (which can happen eg if an 
     252 * obfuscated font part is read) 
     253 */ 
     254 
     255    public void setFontMapper(Mapper fm) throws Exception { 
     256        if (fm == null) { 
    249257                throw new IllegalArgumentException("Font Substituter cannot be null."); 
    250258        } 
     
    254262                // 2.  For each font, find the closest match on the system (use OO's VCL.xcu to do this) 
    255263                //     - do this in a general way, since docx4all needs this as well to display fonts            
    256                 fontSubstituter = fs; 
     264                fontMapper = fm; 
    257265                org.docx4j.wml.Fonts fonts = null; 
    258266                FontTablePart fontTablePart= this.getMainDocumentPart().getFontTablePart();      
     
    266274                 
    267275                fonts = (org.docx4j.wml.Fonts)fontTablePart.getJaxbElement(); 
    268                 fontSubstituter.populateFontMappings(fontsInUse, fonts);         
     276                fontMapper.populateFontMappings(fontsInUse, fonts);      
    269277         
    270278    } 
    271279 
    272     public Substituter getFontSubstituter() { 
    273                 return fontSubstituter; 
    274         } 
    275  
    276         private Substituter fontSubstituter; 
    277      
    278          
     280    public Mapper getFontMapper() { 
     281                return fontMapper; 
     282        } 
     283 
     284        private Mapper fontMapper; 
     285         
    279286 
    280287        public static WordprocessingMLPackage createPackage() throws InvalidFormatException { 
Note: See TracChangeset for help on using the changeset viewer.