Changeset 1234


Ignore:
Timestamp:
09/21/10 12:50:53 (20 months ago)
Author:
jharrop
Message:

Include source code for fop-fonts, as org.docx4j.fonts.fop.
Use FOP 1.0.
Move panose to org.docx4j.fonts.foray
Add LICENSE, NOTICE

Location:
trunk/docx4j
Files:
112 added
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/build.xml

    r1231 r1234  
    1111        <property name="m2Repository" value="../../.m2/repository"/>     
    1212    <path id="Maven Dependencies.libraryclasspath"> 
    13         <pathelement location="${m2Repository}/junit/junit/4.4/junit-4.4.jar"/>          
     13     
     14        <pathelement location="${m2Repository}/junit/junit/4.4/junit-4.4.jar"/> 
    1415        <pathelement location="${m2Repository}/javax/jcr/jcr/1.0/jcr-1.0.jar"/> 
    1516        <pathelement location="${m2Repository}/log4j/log4j/1.2.15/log4j-1.2.15.jar"/> 
    16 <!--        <pathelement location="${m2Repository}/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.jar"/> --> 
     17        <pathelement location="${m2Repository}/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/> 
    1718        <pathelement location="${m2Repository}/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/> 
     19        <pathelement location="${m2Repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"/> 
     20        <pathelement location="${m2Repository}/jdom/jdom/1.0/jdom-1.0.jar"/> 
     21        <pathelement location="${m2Repository}/org/apache/xmlgraphics/xmlgraphics-commons/1.4/xmlgraphics-commons-1.4.jar"/> 
    1822        <pathelement location="${m2Repository}/commons-io/commons-io/1.3.1/commons-io-1.3.1.jar"/> 
    19         <pathelement location="${m2Repository}/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/> 
    20         <pathelement location="${m2Repository}/jdom/jdom/1.0/jdom-1.0.jar"/> <!--  for commons-vfs --> 
    21 <!--             
    22         <pathelement location="${m2Repository}/junit/junit/3.8.1/junit-3.8.1.jar"/> 
    23         --> 
    24                 <!-- For Ole --> 
    25         <pathelement location="${m2Repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"/> 
    26  
    27         <pathelement location="${m2Repository}/org/apache/xmlgraphics/xmlgraphics-commons/1.4/xmlgraphics-commons-1.4.jar"/> 
    28          
     23        <pathelement location="${m2Repository}/org/apache/xmlgraphics/fop/1.0/fop-1.0.jar"/> 
     24        <pathelement location="${m2Repository}/org/apache/avalon/framework/avalon-framework-api/4.3.1/avalon-framework-api-4.3.1.jar"/> 
     25        <pathelement location="${m2Repository}/org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.jar"/> 
     26        <pathelement location="${m2Repository}/net/arnx/wmf2svg/0.8.3/wmf2svg-0.8.3.jar"/> 
    2927        <pathelement location="${m2Repository}/org/apache/poi/hwpf/3.4.0/hwpf-3.4.0.jar"/> 
    30 <!--         <pathelement location="${m2Repository}/com/topologi/diffx/0.61/diffx-0.61.jar"/> 
    31  --> 
     28        <pathelement location="${m2Repository}/xalan/xalan-patched/2.7.0/xalan-patched-2.7.0.jar"/> 
     29        <pathelement location="${m2Repository}/org/apache/commons/commons-vfs-patched/1.9.1/commons-vfs-patched-1.9.1.jar"/> 
     30        <pathelement location="${m2Repository}/com/sun/xml/jaxb-NamespacePrefixMapper-interfaces/2.0.0/jaxb-NamespacePrefixMapper-interfaces-2.0.0.jar"/>     
    3231  
    3332<!--    Uncomment for the PDF conversion via HTML or iText, which 
     
    4645--> 
    4746 
    48         <pathelement location="${m2Repository}/xalan/xalan-patched/2.7.0/xalan-patched-2.7.0.jar"/> 
    4947<!-- As from 2010 09 17 source is included (see src/main/java/org/jvnet..) 
    5048         so this is no longer required. 
    5149        <pathelement location="${m2Repository}/org/jvnet/jaxb2_commons/ppp/parent-pointer-plugin/1.0/parent-pointer-plugin-1.0.jar"/> 
    5250 --> 
    53         <pathelement location="${m2Repository}/org/apache/avalon/framework/avalon-framework-api/4.3.1/avalon-framework-api-4.3.1.jar"/> 
    54         <pathelement location="${m2Repository}/org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.jar"/> 
    55  
    56         <pathelement location="${m2Repository}/docx4j/fop-patched/0.95.756437/fop-patched-0.95.756437.jar"/> 
    57         <pathelement location="${m2Repository}/org/apache/commons/commons-vfs-patched/1.9.1/commons-vfs-patched-1.9.1.jar"/> 
    58         <pathelement location="${m2Repository}/net/arnx/wmf2svg/0.8.3/wmf2svg-0.8.3.jar"/> 
    59          
    60         <pathelement location="${m2Repository}//com/sun/xml/jaxb-NamespacePrefixMapper-interfaces/2.0.0/jaxb-NamespacePrefixMapper-interfaces-2.0.0.jar"/> 
    6151    </path> 
    6252    <path id="docx4j.classpath"> 
  • trunk/docx4j/pom.xml

    r1231 r1234  
    195195                </dependency>                            
    196196                <dependency> 
    197                         <!-- required for fop fonts --> 
     197                        <!-- required for fop, xmlgraphics-commons; 
     198                             list it explicitly, so dependencies can be excluded. --> 
    198199                        <groupId>commons-logging</groupId> 
    199200                        <artifactId>commons-logging</artifactId> 
     
    221222                                </exclusions> --> 
    222223                </dependency> 
    223                 <!-- required for fop  --> 
    224                 <dependency> 
    225                         <groupId>commons-io</groupId> 
    226                         <artifactId>commons-io</artifactId> 
    227                         <version>1.3.1</version> 
    228                 </dependency>                            
    229                 <dependency> 
    230                         <groupId>org.apache.avalon.framework</groupId> 
    231                         <artifactId>avalon-framework-api</artifactId> 
    232                         <version>4.3.1</version> 
    233                 </dependency> 
    234                 <dependency> 
    235                         <groupId>org.apache.avalon.framework</groupId> 
    236                         <artifactId>avalon-framework-impl</artifactId> 
    237                         <version>4.3.1</version> 
    238                 </dependency> 
    239                 <!-- /required for fop  --> 
    240224                <dependency> 
    241225                        <!--  required for ole introspection --> 
     
    256240                        <artifactId>xmlgraphics-commons</artifactId> 
    257241                        <version>1.4</version> 
     242                </dependency> 
     243 
     244                <dependency> 
     245                        <groupId>org.apache.xmlgraphics</groupId> 
     246                        <artifactId>fop</artifactId> 
     247                        <version>1.0</version> 
     248                                <exclusions> 
     249                                        <exclusion> 
     250                                                <groupId>org.apache.xmlgraphics</groupId> 
     251                                                <artifactId>batik-svg-dom</artifactId> 
     252                                        </exclusion> 
     253                                        <exclusion> 
     254                                                <groupId>org.apache.xmlgraphics</groupId> 
     255                                                <artifactId>batik-bridge</artifactId> 
     256                                        </exclusion> 
     257                                        <exclusion> 
     258                                                <groupId>org.apache.xmlgraphics</groupId> 
     259                                                <artifactId>batik-awt-util</artifactId> 
     260                                        </exclusion> 
     261                                        <exclusion> 
     262                                                <groupId>org.apache.xmlgraphics</groupId> 
     263                                                <artifactId>batik-gvt</artifactId> 
     264                                        </exclusion> 
     265                                        <exclusion> 
     266                                                <groupId>org.apache.xmlgraphics</groupId> 
     267                                                <artifactId>batik-transcoder</artifactId> 
     268                                        </exclusion> 
     269                                        <exclusion> 
     270                                                <groupId>org.apache.xmlgraphics</groupId> 
     271                                                <artifactId>batik-extension</artifactId> 
     272                                        </exclusion> 
     273                                        <exclusion> 
     274                                                <groupId>org.apache.xmlgraphics</groupId> 
     275                                                <artifactId>batik-ext</artifactId> 
     276                                        </exclusion> 
     277                                </exclusions>                    
    258278                </dependency> 
    259279  
     
    353373                </dependency> 
    354374 --> 
    355  
    356                 <dependency> 
    357                         <groupId>docx4j</groupId> 
    358                         <artifactId>fop-patched</artifactId> 
    359                         <version>0.95.756437</version> 
    360                 </dependency> 
    361                         <!--  its really 95.756434, but i had to re-build it to remove 
    362                               Class-Path from the MANIFEST.MF, which was  
    363                               being used by Java Web Start to try to fetch certain 
    364                               jars. So the number is incremented (0.95.756435). 
    365                               And then, Panose.java moved to original foray package (0.95.756436)  
    366                                
    367                               0.95.756437 has fop r891181 of 20091216 applied, which adds support for 
    368                               symbol character maps (eg Wingdings) to TTFFile 
    369                                  
    370                               --> 
    371  
    372                  
    373 <!--  
    374                 <dependency> 
    375                         <groupId>docx4j</groupId> 
    376                         <artifactId>fop-fonts</artifactId> 
    377                         <version>0.2.0</version> 
    378                 </dependency> 
    379    --> 
    380375    
    381376                <!-- end of svn:http://dev.plutext.org/svn/docx4j/trunk/docx4j/m2 --> 
  • trunk/docx4j/src/main/java/org/docx4j/convert/out/pdf/viaXSLFO/Conversion.java

    r1220 r1234  
    3535import org.docx4j.fonts.PhysicalFont; 
    3636import org.docx4j.fonts.PhysicalFonts; 
     37//import org.docx4j.fonts.fop.apps.Fop; 
     38//import org.docx4j.fonts.fop.apps.FopFactory; 
     39//import org.docx4j.fonts.fop.apps.MimeConstants; 
     40import org.docx4j.fonts.fop.fonts.FontTriplet; 
    3741import org.docx4j.jaxb.Context; 
    3842import org.docx4j.jaxb.NamespacePrefixMapperUtils; 
     
    6872import org.docx4j.wml.RPr; 
    6973import org.docx4j.wml.SectPr; 
     74import org.docx4j.wml.Style; 
    7075import org.docx4j.wml.Tbl; 
    7176import org.docx4j.wml.Tc; 
     
    8893import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; 
    8994import org.apache.commons.io.FileUtils; 
     95import org.apache.fop.apps.Fop; 
    9096import org.apache.fop.apps.FopFactory; 
    91 import org.apache.fop.apps.Fop; 
    9297import org.apache.fop.apps.MimeConstants; 
    93 import org.apache.fop.fonts.FontTriplet; 
    9498import org.apache.log4j.Logger; 
    9599import org.apache.log4j.Priority; 
     
    578582        // which implements org.w3c.dom.traversal.NodeIterator 
    579583         
    580         String defaultParagraphStyleId = wmlPackage.getMainDocumentPart().getStyleDefinitionsPart().getDefaultParagraphStyle().getStyleId();  
     584                Style defaultParagraphStyle = wmlPackage.getMainDocumentPart().getStyleDefinitionsPart().getDefaultParagraphStyle(); 
     585                                // TODO: handle the case where there is no SDP! 
     586                 
     587        String defaultParagraphStyleId; 
     588        if (defaultParagraphStyle==null) // possible, for non MS source docx 
     589                defaultParagraphStyleId = "Normal"; 
     590        else defaultParagraphStyleId = defaultParagraphStyle.getStyleId(); 
    581591         
    582592                if ( pStyleVal ==null || pStyleVal.equals("") ) { 
  • trunk/docx4j/src/main/java/org/docx4j/fonts/BestMatchingMapper.java

    r876 r1234  
    252252                                wmlFontPanoseForDocumentFont = font.getPanose1(); 
    253253                        } 
    254                         org.foray.font.format.Panose documentFontPanose = null; 
     254                        org.docx4j.fonts.foray.font.format.Panose documentFontPanose = null; 
    255255                        if (wmlFontPanoseForDocumentFont!=null && wmlFontPanoseForDocumentFont.getVal()!=null ) { 
    256256                                try { 
    257                                         documentFontPanose = org.foray.font.format.Panose.makeInstance(wmlFontPanoseForDocumentFont.getVal() ); 
     257                                        documentFontPanose = org.docx4j.fonts.foray.font.format.Panose.makeInstance(wmlFontPanoseForDocumentFont.getVal() ); 
    258258                                } catch (IllegalArgumentException e) {                                   
    259259                                        log.error(e.getMessage()); 
     
    287287                                                                 
    288288                                // Is the Panose value valid? 
    289                                 if (log.isDebugEnabled() &&  org.foray.font.format.Panose.validPanose(documentFontPanose.getPanoseArray())!=null) {                                                                                                              
     289                                if (log.isDebugEnabled() &&  org.docx4j.fonts.foray.font.format.Panose.validPanose(documentFontPanose.getPanoseArray())!=null) {                                                                                                                 
    290290                                        // NB org.apache.fop.fonts.Panose only exists in our patched FOP 
    291                                         log.debug(documentFontName + " : " + org.foray.font.format.Panose.validPanose(documentFontPanose.getPanoseArray()));                                     
     291                                        log.debug(documentFontName + " : " + org.docx4j.fonts.foray.font.format.Panose.validPanose(documentFontPanose.getPanoseArray()));                                        
    292292                                        //This is the case for 'Impact' which has  
    293293                                        //Invalid value 9 > 8 in position 5 of 2 11 8 6 3 9 2 5 2 4  
     
    412412                                                        log.debug(".. as expected, lacking Panose");                                     
    413413                                                } else if (documentFontPanose!=null  ) { 
    414                                                         org.foray.font.format.Panose physicalFontPanose = null; 
     414                                                        org.docx4j.fonts.foray.font.format.Panose physicalFontPanose = null; 
    415415                                                        try { 
    416                                                                 physicalFontPanose = org.foray.font.format.Panose.makeInstance(fontMatched 
     416                                                                physicalFontPanose = org.docx4j.fonts.foray.font.format.Panose.makeInstance(fontMatched 
    417417                                                                                                .getPanose() 
    418418                                                                                                .getPanoseArray()); 
     
    478478         * @param soughtPanose 
    479479         */ 
    480         private PhysicalFont getAssociatedPhysicalFont(String documentFontName, String orignalKey, org.foray.font.format.Panose soughtPanose) { 
     480        private PhysicalFont getAssociatedPhysicalFont(String documentFontName, String orignalKey, org.docx4j.fonts.foray.font.format.Panose soughtPanose) { 
    481481 
    482482                log.debug("Looking for " + soughtPanose); 
     
    523523                 
    524524                Returns key of matching font in physicalFontMap. */ 
    525         private String findClosestPanoseMatch(String documentFontName, org.foray.font.format.Panose documentFontPanose,  
     525        private String findClosestPanoseMatch(String documentFontName, org.docx4j.fonts.foray.font.format.Panose documentFontPanose,  
    526526                        Map<String, PhysicalFont> physicalFontSpace, int matchThreshold) { 
    527527                 
     
    549549                        continue; 
    550550                } 
    551                         org.foray.font.format.Panose physicalFontPanose = null; 
     551                        org.docx4j.fonts.foray.font.format.Panose physicalFontPanose = null; 
    552552                long panoseMatchValue = MATCH_THRESHOLD + 1; // inititaliase to a non-match 
    553553                        try { 
    554                                 physicalFontPanose = org.foray.font.format.Panose.makeInstance(physicalFont.getPanose().getPanoseArray() ); 
     554                                physicalFontPanose = org.docx4j.fonts.foray.font.format.Panose.makeInstance(physicalFont.getPanose().getPanoseArray() ); 
    555555                        panoseMatchValue = documentFontPanose.difference(physicalFontPanose, null); 
    556556                        } catch (IllegalArgumentException e) {                                   
     
    696696                        PhysicalFont pf = (PhysicalFont)pairs.getValue(); 
    697697                         
    698                         org.foray.font.format.Panose fopPanose = pf.getPanose(); 
     698                        org.docx4j.fonts.foray.font.format.Panose fopPanose = pf.getPanose(); 
    699699                         
    700700                                if (fopPanose == null ) { 
  • trunk/docx4j/src/main/java/org/docx4j/fonts/PhysicalFont.java

    r876 r1234  
    44package org.docx4j.fonts; 
    55 
    6 import org.apache.fop.fonts.EmbedFontInfo; 
    76import org.apache.log4j.Logger; 
     7import org.docx4j.fonts.fop.fonts.EmbedFontInfo; 
    88 
    99/** 
     
    9999        } 
    100100         
    101         org.foray.font.format.Panose panose; 
    102         public org.foray.font.format.Panose getPanose() { 
     101        org.docx4j.fonts.foray.font.format.Panose panose; 
     102        public org.docx4j.fonts.foray.font.format.Panose getPanose() { 
    103103                return panose; 
    104104        } 
    105         public void setPanose(org.foray.font.format.Panose panose) { 
     105        public void setPanose(org.docx4j.fonts.foray.font.format.Panose panose) { 
    106106                this.panose = panose; 
    107107        } 
  • trunk/docx4j/src/main/java/org/docx4j/fonts/PhysicalFonts.java

    r1167 r1234  
    88import java.util.Map; 
    99 
    10 import org.apache.fop.fonts.EmbedFontInfo; 
    11 import org.apache.fop.fonts.FontCache; 
    12 import org.apache.fop.fonts.FontResolver; 
    13 import org.apache.fop.fonts.FontSetup; 
    14 import org.apache.fop.fonts.FontTriplet; 
    15 import org.apache.fop.fonts.autodetect.FontFileFinder; 
    16 import org.apache.fop.fonts.autodetect.FontInfoFinder; 
    1710import org.apache.log4j.Logger; 
     11import org.docx4j.fonts.fop.fonts.EmbedFontInfo; 
     12import org.docx4j.fonts.fop.fonts.FontCache; 
     13import org.docx4j.fonts.fop.fonts.FontResolver; 
     14import org.docx4j.fonts.fop.fonts.FontSetup; 
     15import org.docx4j.fonts.fop.fonts.FontTriplet; 
     16import org.docx4j.fonts.fop.fonts.autodetect.FontFileFinder; 
     17import org.docx4j.fonts.fop.fonts.autodetect.FontInfoFinder; 
    1818import org.docx4j.fonts.microsoft.MicrosoftFonts; 
    1919import org.docx4j.fonts.microsoft.MicrosoftFontsRegistry; 
  • trunk/docx4j/src/main/java/org/docx4j/fonts/foray/font/format/Panose.java

    r876 r1234  
    3333 
    3434//package org.foray.font.format; 
    35 package org.foray.font.format; 
     35package org.docx4j.fonts.foray.font.format; 
    3636 
    3737import java.io.Serializable; 
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/ObfuscatedFontPart.java

    r706 r1234  
    2121package org.docx4j.openpackaging.parts.WordprocessingML; 
    2222 
    23 import org.apache.fop.fonts.CustomFont; 
    24 import org.apache.fop.fonts.EncodingMode; 
    25 import org.apache.fop.fonts.FontLoader; 
    26 import org.apache.fop.fonts.FontResolver; 
    27 import org.apache.fop.fonts.FontSetup; 
    28 import org.apache.fop.fonts.autodetect.FontFileFinder; 
    29 import org.apache.fop.fonts.autodetect.FontInfoFinder; 
    3023import org.apache.log4j.Logger; 
     24import org.docx4j.fonts.fop.fonts.CustomFont; 
     25import org.docx4j.fonts.fop.fonts.EncodingMode; 
     26import org.docx4j.fonts.fop.fonts.FontLoader; 
     27import org.docx4j.fonts.fop.fonts.FontResolver; 
     28import org.docx4j.fonts.fop.fonts.FontSetup; 
     29import org.docx4j.fonts.fop.fonts.autodetect.FontFileFinder; 
     30import org.docx4j.fonts.fop.fonts.autodetect.FontInfoFinder; 
    3131import org.docx4j.openpackaging.exceptions.InvalidFormatException; 
    3232import org.docx4j.openpackaging.parts.PartName; 
  • trunk/docx4j/src/main/java/org/docx4j/samples/CreatePdf.java

    r1232 r1234  
    5555                        } catch (IllegalArgumentException e) { 
    5656//                      inputfilepath = System.getProperty("user.dir") + "/sample-docs/sample-docx.xml"; 
    57                         inputfilepath = System.getProperty("user.dir") + "/docs/Docx4j_GettingStarted.xml";              
     57//                      inputfilepath = System.getProperty("user.dir") + "/docs/Docx4j_GettingStarted.xml";              
    5858                        } 
    5959                 
     
    7373                                 */ 
    7474                                 
    75                                  wordMLPackage = new WordprocessingMLPackage(); 
    76                                 MainDocumentPart wordDocumentPart = new MainDocumentPart();              
    77                                 wordMLPackage.addTargetPart(wordDocumentPart); 
    78                                 org.docx4j.wml.ObjectFactory factory = new org.docx4j.wml.ObjectFactory(); 
    79                                 org.docx4j.wml.Body  body = factory.createBody(); 
    80                                 org.docx4j.wml.Document wmlDocumentEl = factory.createDocument(); 
    81                                 wmlDocumentEl.setBody(body); 
    82                                                  
    83                                 // Put the content in the part 
    84                                 ((org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart)wordDocumentPart).setJaxbElement(wmlDocumentEl); 
    85          
    86                                 createContent(wordDocumentPart);         
     75                                 wordMLPackage = WordprocessingMLPackage.createPackage(); 
     76                                createContent(wordMLPackage.getMainDocumentPart());      
    8777                        } else { 
    8878                                // Load .docx or Flat OPC .xml 
Note: See TracChangeset for help on using the changeset viewer.