Changeset 691 for trunk/docx4j/etc


Ignore:
Timestamp:
03/19/09 16:26:34 (3 years ago)
Author:
jharrop
Message:

Patch of 2009-1107 against revision 711795

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/etc/fop-fonts.patch

    r690 r691  
    1 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/CustomFont.java 
     1Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java 
    22=================================================================== 
    3 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/CustomFont.java     (revision 631408) 
    4 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/CustomFont.java     (working copy) 
     3--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java        (revision 711795) 
     4+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java        (working copy) 
     5@@ -151,7 +151,10 @@ 
     6         } 
     7         EmbedFontInfo fontInfo = new EmbedFontInfo(null, customFont.isKerningEnabled(), 
     8                 fontTripletList, embedUrl, subFontName); 
     9+        fontInfo.setPanose(customFont.getPanose()); 
     10         fontInfo.setPostScriptName(customFont.getFontName()); 
     11+        fontInfo.setEmbeddable(customFont.isEmbeddable()); 
     12+         
     13         if (fontCache != null) { 
     14             fontCache.addFont(fontInfo); 
     15         } 
     16Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/CIDFontType.java 
     17=================================================================== 
     18--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/CIDFontType.java      (revision 711795) 
     19+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/CIDFontType.java      (working copy) 
     20@@ -19,7 +19,8 @@ 
     21  
     22 package org.apache.fop.fonts; 
     23  
     24-import org.apache.avalon.framework.ValuedEnum; 
     25+//import org.apache.avalon.framework.ValuedEnum; 
     26+import org.apache.fop.fonts.ValuedEnum; 
     27  
     28 /** 
     29  * This class enumerates all supported CID font types. 
     30Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/CustomFont.java 
     31=================================================================== 
     32--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/CustomFont.java       (revision 711795) 
     33+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/CustomFont.java       (working copy) 
    534@@ -17,6 +17,11 @@ 
    635  
     
    1544  
    1645 import java.io.IOException; 
    17 @@ -57,6 +62,26 @@ 
    18      private Map kerning; 
     46@@ -58,6 +63,26 @@ 
    1947  
    2048     private boolean useKerning = true; 
    21 +     
    22 +    private boolean isEmbeddable = true;  
     49  
     50+    private boolean isEmbeddable = true; 
     51+ 
    2352+       public boolean isEmbeddable() { 
    2453+               return isEmbeddable; 
    2554+       } 
     55+ 
    2656+       public void setEmbeddable(boolean isEmbeddable) { 
    2757+               this.isEmbeddable = isEmbeddable; 
    2858+       } 
    29 +     
    30 +     
    31 +    private Panose panose = null; 
    32 + 
    33 +    public Panose getPanose() { 
     59+ 
     60+       private Panose panose = null; 
     61+ 
     62+       public Panose getPanose() { 
    3463+               return panose; 
    3564+       } 
     
    3968+       } 
    4069+     
    41   
    4270     /** {@inheritDoc} */ 
    4371     public String getFontName() { 
    44 @@ -448,4 +473,5 @@ 
    45          } 
    46      } 
    47   
    48 + 
    49  } 
    50 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/EmbedFontInfo.java 
     72         return fontName; 
     73Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/EmbedFontInfo.java 
    5174=================================================================== 
    52 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/EmbedFontInfo.java  (revision 631408) 
    53 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/EmbedFontInfo.java  (working copy) 
     75--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/EmbedFontInfo.java    (revision 711795) 
     76+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/EmbedFontInfo.java    (working copy) 
    5477@@ -17,6 +17,11 @@ 
    5578  
    5679 /* $Id$ */ 
    57    
     80  
    5881+/* NOTICE: This file has been changed by Plutext Pty Ltd for use in docx4j. 
    5982+ *  
     
    6386 package org.apache.fop.fonts; 
    6487  
    65  import java.io.Serializable; 
    66 @@ -38,6 +43,32 @@ 
    67      protected boolean kerning; 
    68      /** the list of associated font triplets */ 
    69      protected List fontTriplets; 
    70 +     
    71 +    private boolean isEmbeddable = true;  
     88 import java.io.IOException; 
     89@@ -48,14 +53,41 @@ 
     90  
     91     private transient boolean embedded = true; 
     92  
     93+    private boolean isEmbeddable = true; 
     94+ 
    7295+       public boolean isEmbeddable() { 
    7396+               return isEmbeddable; 
    7497+       } 
     98+ 
    7599+       public void setEmbeddable(boolean isEmbeddable) { 
    76100+               this.isEmbeddable = isEmbeddable; 
    77 +       }     
    78 +     
    79 +    protected Panose panose = null; 
    80 + 
    81 +    public Panose getPanose() { 
     101+       } 
     102+ 
     103+       protected Panose panose = null; 
     104+ 
     105+       public Panose getPanose() { 
    82106+               return panose; 
    83107+       } 
     
    87111+       } 
    88112+     
    89 +       protected String postScriptName = null; 
    90 +       public String getPostScriptName() { 
    91 +               return postScriptName; 
    92 +       } 
    93 +       public void setPostScriptName(String postScriptName) { 
    94 +               this.postScriptName = postScriptName; 
    95 +       } 
    96         
    97113     /** 
    98       * Main constructor 
    99 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/Enum.java 
     114-     * Main constructor 
     115-     * @param metricsFile Path to the xml file containing font metrics 
     116-     * @param kerning True if kerning should be enabled 
     117-     * @param fontTriplets List of font triplets to associate with this font 
     118-     * @param embedFile Path to the embeddable font file (may be null) 
     119-     * @param subFontName the sub-fontname used for TrueType Collections (null otherwise) 
     120-     */ 
     121+        * Main constructor 
     122+        *  
     123+        * @param metricsFile 
     124+        *            Path to the xml file containing font metrics 
     125+        * @param kerning 
     126+        *            True if kerning should be enabled 
     127+        * @param fontTriplets 
     128+        *            List of font triplets to associate with this font 
     129+        * @param embedFile 
     130+        *            Path to the embeddable font file (may be null) 
     131+        * @param subFontName 
     132+        *            the sub-fontname used for TrueType Collections (null 
     133+        *            otherwise) 
     134+        */ 
     135     public EmbedFontInfo(String metricsFile, boolean kerning, 
     136                     List/*<FontTriplet>*/ fontTriplets, String embedFile, String subFontName) { 
     137         this.metricsFile = metricsFile; 
     138Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/Enum.java 
    100139=================================================================== 
    101 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/Enum.java   (revision 0) 
    102 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/Enum.java   (revision 0) 
     140--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/Enum.java     (revision 0) 
     141+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/Enum.java     (revision 0) 
    103142@@ -0,0 +1,182 @@ 
    104143+/* 
     
    123162+ */ 
    124163+ 
    125 +// moved from avalon.framework 
     164+//package org.apache.avalon.framework; 
    126165+package org.apache.fop.fonts; 
    127166+ 
     
    178217+ * 
    179218+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> 
    180 + * @version CVS $Revision: 1.28 $ $Date: 2004/02/11 14:34:24 $ 
     219+ * @version $Id$ 
    181220+ */ 
    182221+public abstract class Enum 
     
    230269+     * @return the equality status 
    231270+     */ 
    232 +    public final boolean equals( Object o ) 
     271+    public boolean equals( Object o ) 
    233272+    { 
    234273+        if( this == o ) 
     
    237276+            return false; 
    238277+ 
    239 +        final Enum enumb = (Enum)o; 
    240 + 
    241 +        if( !getClass().equals( enumb.getClass() ) ) 
     278+        final Enum enumerated = (Enum)o; 
     279+ 
     280+        if( !getClass().equals( enumerated.getClass() ) ) 
    242281+            return false; 
    243 +        if( m_name != null ? !m_name.equals( enumb.m_name ) : enumb.m_name != null ) 
     282+        if( m_name != null ? !m_name.equals( enumerated.m_name ) : enumerated.m_name != null ) 
    244283+            return false; 
    245284+ 
     
    284323+    } 
    285324+} 
    286 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/MultiByteFont.java 
     325Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/FontType.java 
    287326=================================================================== 
    288 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/MultiByteFont.java  (revision 631408) 
    289 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/MultiByteFont.java  (working copy) 
     327--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/FontType.java (revision 711795) 
     328+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/FontType.java (working copy) 
     329@@ -19,7 +19,8 @@ 
     330  
     331 package org.apache.fop.fonts; 
     332  
     333-import org.apache.avalon.framework.ValuedEnum; 
     334+//import org.apache.avalon.framework.ValuedEnum; 
     335+import org.apache.fop.fonts.ValuedEnum; 
     336  
     337 /** 
     338  * This class enumerates all supported font types. 
     339Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/MultiByteFont.java 
     340=================================================================== 
     341--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/MultiByteFont.java    (revision 711795) 
     342+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/MultiByteFont.java    (working copy) 
    290343@@ -17,6 +17,11 @@ 
    291344  
     
    300353  
    301354 //Java 
    302 @@ -40,8 +45,9 @@ 
    303      private String namePrefix = null;    // Quasi unique prefix 
    304   
    305      private BFEntry[] bfentries = null; 
    306 +     
    307   
    308 -    /** 
    309 +       /** 
    310       * Default constructor 
    311       */ 
    312      public MultiByteFont() { 
    313 @@ -133,12 +139,16 @@ 
     355@@ -118,10 +123,13 @@ 
    314356         } 
    315357     } 
    316358  
    317 -    /** 
    318 -     * {@inheritDoc} 
    319 -     */ 
     359-    /** {@inheritDoc} */ 
    320360-    public boolean isEmbeddable() { 
    321361-        return !(getEmbedFileName() == null && getEmbedResourceName() == null); 
    322362-    } 
    323 +     
    324363+// Comment out - this overrides the value derived by TTFFile, which  
    325364+// is not what we want.     
    326365+     
    327 +//    /** 
    328 +//     * {@inheritDoc} 
    329 +//     */ 
     366+//    /** {@inheritDoc} */ 
    330367+//    public boolean isEmbeddable() { 
    331368+//        return !(getEmbedFileName() == null && getEmbedResourceName() == null); 
    332369+//    } 
    333370  
    334      /** 
    335       * {@inheritDoc} 
    336 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/Panose.java 
     371     /** {@inheritDoc} */ 
     372     public CIDSubset getCIDSubset() { 
     373Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/Panose.java 
    337374=================================================================== 
    338 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/Panose.java (revision 0) 
    339 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/Panose.java (revision 0) 
    340 @@ -0,0 +1,409 @@ 
     375--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/Panose.java   (revision 0) 
     376+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/Panose.java   (revision 0) 
     377@@ -0,0 +1,376 @@ 
    341378+/* 
    342379+ * Copyright 2006 The FOray Project. 
     
    362399+ 
    363400+/* 
    364 + * $LastChangedRevision: 10097 $ 
    365 + * $LastChangedDate: 2007-07-24 15:05:09 -0600 (Tue, 24 Jul 2007) $ 
     401+ * $LastChangedRevision: 10482 $ 
     402+ * $LastChangedDate: 2008-03-23 02:59:39 +1100 (Sun, 23 Mar 2008) $ 
    366403+ * $LastChangedBy$ 
    367404+ */ 
     
    372409+ */ 
    373410+ 
     411+//package org.foray.font.format; 
    374412+package org.apache.fop.fonts; 
    375413+ 
    376 +import java.io.Serializable; 
    377414+ 
    378415+ 
    379416+/** 
    380 + * A PANOSE classification number. 
    381 + *  
     417+ * A PANOSE-1 classification number. 
     418+ * 
    382419+ * <p>References:</p> 
    383420+ * <ul> 
     
    393430+ * </ul> 
    394431+ */ 
    395 +public class Panose implements Serializable { 
    396 + 
    397 +    /** 
    398 +     * Serialization Version UID. Change this value if you want to make sure the user's cache 
    399 +     * file is purged after an update. 
    400 +     */ 
    401 +    private static final long serialVersionUID = 605232520271754718L; 
    402 +        
     432+public final class Panose { 
     433+ 
    403434+    /** 
    404435+     * Enumeration of the fields that comprise a PANOSE description. 
     
    469500+ 
    470501+    } 
    471 +        
     502+ 
     503+    /** 
     504+     * Constant indicating the minimum italic value for the letterform field. 
     505+     * This is based on an analysis of the MS ClearType Collection fonts: 
     506+     * <ul> 
     507+     * <li>consolas             [ 2 11 6 9 2 2 4 3 2 4 ]  bold 6 ital 3</li> 
     508+     * <li>consolas-bold        [ 2 11 7 9 2 2 4 3 2 4 ]  bold 7 ital 3</li> 
     509+     * <li>consolas-italic      [ 2 11 6 9 2 2 4 10 2 4 ] bold 6 ital 10</li> 
     510+     * <li>consolas-bolditalic  [ 2 11 7 9 2 2 4 10 2 4 ] bold 7 ital 10</li> 
     511+     * 
     512+     * <li>cordianew            [ 2 11 3 4 2 2 2 2 2 4 ]  bold 3 ital 2</li> 
     513+     * <li>cordianew-bolditalic [ 2 11 6 4 2 2 2 9 2 4 ]  bold 6 ital 9</li> 
     514+     * 
     515+     * <li>calibri              [ 2 15 5 2 2 2 4 3 2 4 ]  bold 5 ital 3</li> 
     516+     * <li>calibri-bold         [ 2 15 7 2 3 4 4 3 2 4 ]  bold 7 ital 3</li> 
     517+     * <li>calibri-bolditalic   [ 2 15 7 2 3 4 4 10 2 4 ] bold 7 ital 10</li> 
     518+     * 
     519+     * <li>constantia           [ 2 3 6 2 5 3 6 3 3 3 ]   bold 6 ital 3</li> 
     520+     * <li>constantia-bold      [ 2 3 7 2 6 3 6 3 3 3 ]   bold 7 ital 3 (note the 6 at index 4)</li> 
     521+     * <li>constantia-italic    [ 2 3 6 2 5 3 6 10 3 3 ]  bold 6 ital 10</li> 
     522+     * 
     523+     * <li>candara-bold         [ 2 14 7 2 3 3 3 2 2 4 ]  bold 7 ital 2</li> 
     524+     * <li>candara-italic       [ 2 14 5 2 3 3 3 9 2 4 ]  bold 5 ital 9</li> 
     525+     * <li>candara-bolditalic   [ 2 14 7 2 3 3 3 9 2 4 ]  bold 7 ital 9</li> 
     526+     * 
     527+     * <li>cambria-bold         [ 2 4 8 3 5 4 6 3 2 4 ]   bold 8 ital 3</li> 
     528+     * <li>cambria-italic       [ 2 4 5 3 5 4 6 10 2 4 ]  bold 5 ital 10</li> 
     529+     * </ul> 
     530+     */ 
     531+    private static final byte LETTERFORM_MIN_ITALIC = 9; 
     532+ 
     533+    /** 
     534+     * Constant indicating the minimum bold value for the weight field. 
     535+     * This is based on an analysis of the MS ClearType Collection fonts, which can be found at 
     536+     * {@link #LETTERFORM_MIN_ITALIC}. 
     537+     */ 
     538+    private static final byte WEIGHT_MIN_BOLD = 7; 
     539+ 
    472540+    /** An array of weights indicating that all elements in a comparison between two PANOSE values 
    473541+     * shall be considered to be of the same weight. */ 
     
    476544+     * parameter. However, there is no way to protect the data inside it from corruption, so we 
    477545+     * have elected to keep it private and to allow "null" to be interpreted as the same value. */ 
    478 +        
    479 +//    /** Constant indicating the size of the "panose" field, in bytes. */ 
    480 +//    public static final byte ARRAY_SIZE = 10; 
    481 + 
    482 +    /** Max difference for it to be considered an acceptable match. 
    483 +     *  Note that this value will depend on the weights in the 
    484 +     *  difference function. 
    485 +     */  
    486 +    public static final int MATCH_THRESHOLD = 30; 
    487 +     
    488 +     
     546+ 
    489547+    /** The encapsulated array of PANOSE numbers. */ 
    490548+    private byte[] panoseArray; 
    491 +     
    492549+ 
    493550+    /** 
     
    496553+     */ 
    497554+    private Panose(final byte[] panoseArray) { 
    498 +        this.panoseArray = panoseArray; 
    499 +    } 
    500 + 
    501 +    /** 
    502 +     * Creates a new Panose instance. 
     555+        /* Clone the incoming array to protect our data from subsequent changes made to the original 
     556+         * array. */ 
     557+        this.panoseArray = panoseArray.clone(); 
     558+    } 
     559+ 
     560+    /** 
     561+     * Creates a new Panose instance, first checking it for validity. 
    503562+     * @param panoseArray The array of bytes recording the PANOSE 
    504563+     * classification. 
    505564+     * @return The newly-created instance. 
     565+     * @throws FontException If <code>panoseArray</code> contains an illegal value. 
     566+     * @see #forceInstance(byte[]) 
    506567+     */ 
    507568+    public static Panose makeInstance(final byte[] panoseArray) { 
     
    510571+            throw new IllegalArgumentException("Illegal Panose Array: " + panoseValidationMessage); 
    511572+        } 
     573+        return new Panose(panoseArray); 
     574+    } 
     575+ 
     576+    /** 
     577+     * Creates a new Panose instance without any error checking. 
     578+     * @param panoseArray The array of bytes recording the PANOSE classification. 
     579+     * @return The newly-created instance. 
     580+     * @see #makeInstance(byte[]) 
     581+     */ 
     582+    public static Panose forceInstance(final byte[] panoseArray) { 
    512583+        return new Panose(panoseArray); 
    513584+    } 
     
    575646+        return difference; 
    576647+    } 
    577 +     
    578 +    /* 
    579 +     *  consolas           [ 2 11 6 9 2 2 4 3 2 4 ] bold 6 ital 3 
    580 +               consolas-bold      [ 2 11 7 9 2 2 4 3 2 4 ] bold 7 ital 3 
    581 +               consolas-italic    [ 2 11 6 9 2 2 4 10 2 4 ] bold 6 ital 10 
    582 +               consolas-bolditalic[ 2 11 7 9 2 2 4 10 2 4 ] bold 7 ital 10 
    583 +                
    584 +               cordianew           [ 2 11 3 4 2 2 2 2 2 4 ] bold 3 ital 2 
    585 +               cordianew-bolditalic[ 2 11 6 4 2 2 2 9 2 4 ] bold 6 ital 9 
    586 +                
    587 +               calibri             [ 2 15 5 2 2 2 4 3 2 4 ] bold 5 ital 3 
    588 +               calibri-bold        [ 2 15 7 2 3 4 4 3 2 4 ] bold 7 ital 3 
    589 +               calibri-bolditalic  [ 2 15 7 2 3 4 4 10 2 4 ] bold 7 ital 10 
    590 +                
    591 +               constantia          [ 2 3 6 2 5 3 6 3 3 3 ] bold 6 ital 3 
    592 +               constantia-bold     [ 2 3 7 2 6 3 6 3 3 3 ] bold 7 ital 3 
    593 +                                             ^ note this 
    594 +               constantia-italic   [ 2 3 6 2 5 3 6 10 3 3 ] bold 6 ital 10 
    595 +                
    596 +               candara-bold        [ 2 14 7 2 3 3 3 2 2 4 ] bold 7 ital 2 
    597 +               candara-italic      [ 2 14 5 2 3 3 3 9 2 4 ] bold 5 ital 9 
    598 +               candara-bolditalic  [ 2 14 7 2 3 3 3 9 2 4 ] bold 7 ital 9 
    599 +                
    600 +               cambria-bold        [ 2 4 8 3 5 4 6 3 2 4 ] bold 8 ital 3 
    601 +               cambria-italic      [ 2 4 5 3 5 4 6 10 2 4 ] bold 5 ital 10 
    602 + 
    603 +     */ 
    604 +     
    605 +    public static Panose getBold(Panose thisPanose) { 
    606 +        
    607 +       byte[] panoseArray = thisPanose.getPanoseArray(); 
    608 +        
    609 +       if (panoseArray[2]==11) { 
    610 +               // Already the maximum value - do nothing 
    611 +       } else if (panoseArray[2]<8) { 
    612 +               panoseArray[2]=9;  
    613 +               // 8 = bold, and even though most of the MS ClearType Collection fonts have 7 here, 
    614 +               // experience (Times New Roman) shows it is better to be on the high side, to stop 
    615 +               // this Panose array from being equidistant between the normal weight and the 
    616 +               // bold weight. 
    617 +                
    618 +       } else { 
    619 +               // Do nothing, rather than increase the Weight 
    620 +       } 
    621 +        
    622 +               return Panose.makeInstance(panoseArray); 
    623 +        
    624 +    } 
    625 + 
    626 +    public static Panose getItalic(Panose thisPanose) { 
    627 +        
    628 +       byte[] panoseArray = thisPanose.getPanoseArray(); 
    629 +        
    630 +       if (panoseArray[7]==15) { 
    631 +               // Already the maximum value - do nothing 
    632 +       } else if (panoseArray[7]<9) { 
    633 +               panoseArray[7]=10; // Most fonts have 9 or 10 here, so use 10 on the same reasoning as above. 
    634 +       } else { 
    635 +               // Do nothing, rather than increase the Letterform setting  
    636 +       } 
    637 +        
    638 +               return Panose.makeInstance(panoseArray); 
    639 +        
    640 +    } 
    641 +     
    642 +     
     648+ 
    643649+    /** 
    644650+     * Examines an array of weights, throwing various unchecked exceptions if the data is not valid. 
     
    662668+        } 
    663669+    } 
    664 +     
    665 +//    /** 
    666 +//     * Tests the validity of a panose description. 
    667 +//     * @param panoseDescription The panose values to be tested. 
    668 +//     * @return True for a valid PANOSE description, or false if the input is 
    669 +//     * null, does not have 10 elements, or any of the elements do not contain 
    670 +//     * valid ASCII numerals (0 through 9). 
    671 +//     */ 
    672 +//    public static boolean validPanose(final byte[] panoseDescription) { 
    673 +//        if (panoseDescription == null) { 
    674 +//             System.out.println("null byte[]" ); 
    675 +//            return false; 
    676 +//        } 
    677 +//        if (panoseDescription.length != Panose.ARRAY_SIZE) { 
    678 +//             System.out.println("Invalid length " + panoseDescription.length ); 
    679 +//            return false; 
    680 +//        } 
    681 +//        for (int i = 0; i < panoseDescription.length; i++) { 
    682 +//            final byte theByte = panoseDescription[i]; 
    683 +//            String s = Byte.toString(theByte);             
    684 +//            int n = Integer.parseInt(s); 
    685 +//            if (n < 0) { 
    686 +//             //System.out.println("Invalid value (too small) " + theByte + " in position " + i + " of " + toString(panoseDescription) ); 
    687 +//                return false; 
    688 +//            } 
    689 +//                         
    690 +//            if (n > validMaxValues[i]) { 
    691 +//             System.out.println("Invalid value " + n + " > " + validMaxValues[i] + " in position " + i + " of " + toString(panoseDescription) ); 
    692 +//                return false; 
    693 +//            } 
    694 +//        } 
    695 +//        return true; 
    696 +//    } 
    697 + 
    698 +     
    699 +     
     670+ 
    700671+    /** 
    701672+     * Tests the validity of a panose description. 
     
    728699+     */ 
    729700+    public String toString() { 
    730 +        return toString(this.panoseArray);       
     701+        return toString(this.panoseArray); 
    731702+    } 
    732703+ 
     
    744715+        } 
    745716+        sb.append("]"); 
    746 +        return sb.toString();        
    747 +    } 
    748 +     
     717+        return sb.toString(); 
     718+    } 
     719+ 
     720+    /** 
     721+     * Returns the bold version of this Panose instance. 
     722+     * @return If this already describes a bold font, returns this. Otherwise, returns a new 
     723+     * Panose instance that is identical to this, except describing a bold font. 
     724+     */ 
     725+    public Panose getBold() { 
     726+        final byte weightValue = this.getElement(Panose.Field.WEIGHT); 
     727+        if (weightValue >= Panose.WEIGHT_MIN_BOLD) { 
     728+            /* This Panose value is already bold. */ 
     729+            return this; 
     730+        } 
     731+        final byte[] newArray = this.panoseArray.clone(); 
     732+        newArray[Panose.Field.WEIGHT.getIndex()] = Panose.WEIGHT_MIN_BOLD; 
     733+        return Panose.forceInstance(newArray); 
     734+    } 
     735+ 
     736+    /** 
     737+     * Returns the italic version of this Panose instance. 
     738+     * @return If this already describes an italic font, returns this. Otherwise, returns a new 
     739+     * Panose instance that is identical to this, except describing an italic font. 
     740+     */ 
     741+    public Panose getItalic() { 
     742+        final byte letterformValue = this.getElement(Panose.Field.LETTERFORM); 
     743+        if (letterformValue >= Panose.LETTERFORM_MIN_ITALIC) { 
     744+            /* This Panose value is already italic. */ 
     745+            return this; 
     746+        } 
     747+        final byte[] newArray = this.panoseArray.clone(); 
     748+        newArray[Panose.Field.LETTERFORM.getIndex()] = Panose.LETTERFORM_MIN_ITALIC; 
     749+        return Panose.forceInstance(newArray); 
     750+    } 
     751+ 
     752+ 
    749753+} 
    750 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/truetype/TTFFile.java 
     754Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/truetype/TTFFile.java 
    751755=================================================================== 
    752 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/truetype/TTFFile.java       (revision 631408) 
    753 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/truetype/TTFFile.java       (working copy) 
    754 @@ -17,6 +17,11 @@ 
    755   
    756  /* $Id$ */ 
    757   
    758 +/* NOTICE: This file has been changed by Plutext Pty Ltd for use in docx4j. 
    759 + *  
    760 + * This notice is included to meet the condition in clause 4(b) of the License.  
    761 + */ 
    762 + 
    763  package org.apache.fop.fonts.truetype; 
    764   
    765  import java.io.IOException; 
    766 @@ -30,7 +35,9 @@ 
    767   
     756--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/truetype/TTFFile.java (revision 711795) 
     757+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/truetype/TTFFile.java (working copy) 
     758@@ -31,6 +31,7 @@ 
    768759 import org.apache.xmlgraphics.fonts.Glyphs; 
    769760  
    770 +import org.apache.fop.fonts.EmbedFontInfo; 
    771761 import org.apache.fop.fonts.FontUtil; 
    772762+import org.apache.fop.fonts.Panose; 
     
    774764 /** 
    775765  * Reads a TrueType file or a TrueType Collection. 
    776 @@ -48,9 +55,12 @@ 
    777      public static final boolean TRACE_ENABLED = false; 
     766@@ -49,6 +50,9 @@ 
    778767  
    779768     private String encoding = "WinAnsiEncoding";    // Default encoding 
     769  
     770+    /** Array containing the Panose information. */ 
     771+       private Panose panose; 
    780772+     
    781 +    /** Array containing the Panose information. */ 
    782 +    private Panose panose; 
    783   
    784773     private short firstChar = 0; 
    785 -    private boolean isEmbeddable = true; 
    786 +    private boolean isEmbeddable = false; // until proven otherwise! 
     774     private boolean isEmbeddable = true; 
    787775     private boolean hasSerifs = true; 
    788      /** 
    789       * Table directory 
    790 @@ -549,8 +559,10 @@ 
    791       */ 
    792      public String getPostScriptName() { 
    793          if (postScriptName.length() == 0) { 
    794 +               System.out.println("TTFFile - Hmmm, Composed postscript name from fullname."); 
    795              return FontUtil.stripWhiteSpace(getFullName()); 
    796          } else { 
    797 +//             System.out.println("TTFFile - Cool, there was a proper postScript name, namely: " + postScriptName); 
    798              return postScriptName; 
    799          } 
    800      } 
    801 @@ -743,6 +755,7 @@ 
    802       * @return boolean True if it may be embedded 
    803       */ 
    804      public boolean isEmbeddable() { 
    805 +        
    806          return isEmbeddable; 
    807      } 
    808   
    809 @@ -988,7 +1001,10 @@ 
    810          if (dirTabs.get("OS/2") != null) { 
    811              seekTab(in, "OS/2", 2 * 2); 
    812              this.usWeightClass = in.readTTFUShort(); 
    813 +             
    814 +            // usWidthClass 
    815              in.skip(2); 
    816 +             
    817              int fsType = in.readTTFUShort(); 
    818              if (fsType == 2) { 
    819                  isEmbeddable = false; 
    820 @@ -996,10 +1012,21 @@ 
     776@@ -1006,8 +1010,15 @@ 
    821777                 isEmbeddable = true; 
    822778             } 
    823779             in.skip(11 * 2); 
    824780-            in.skip(10); //panose array 
     781-            in.skip(4 * 4); //unicode ranges 
    825782+             
    826 +            //in.skip(10); //panose array 
     783+            //in.skip(10); //panose array             
    827784+            final byte[] panoseArray = new byte[10]; 
    828 +            for (int i = 0; i < panoseArray.length; i++) { 
    829 +                panoseArray[i] = in.read(); 
    830 +            } 
    831 +            this.panose = Panose.makeInstance(panoseArray); 
     785+                       for (int i = 0; i < panoseArray.length; i++) { 
     786+                               panoseArray[i] = in.read(); 
     787+                       } 
     788+                       this.panose = Panose.makeInstance(panoseArray); 
    832789+             
    833 +             
    834 +            /* Skip ulUnicodeRange1 - 4. */             
    835              in.skip(4 * 4); //unicode ranges 
     790+            in.skip(4 * 4); // unicode ranges 
    836791             in.skip(4); 
    837792             in.skip(3 * 2); 
    838 +            
    839 +            /* Read sTypoAscender. */             
    840793             int v; 
    841              os2Ascender = in.readTTFShort(); //sTypoAscender 
    842              log.debug("sTypoAscender: " + os2Ascender  
    843 @@ -1568,4 +1655,8 @@ 
    844              ioe.printStackTrace(System.err); 
     794@@ -1549,6 +1560,10 @@ 
     795             return null; 
    845796         } 
    846797     } 
    847 + 
    848 +       public Panose getPanose() { 
     798+     
     799+    public Panose getPanose() { 
    849800+               return panose; 
    850 +       } 
    851  } 
    852 \ No newline at end of file 
    853 Index: /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/ValuedEnum.java 
     801+       }     
     802  
     803     /* 
     804      * Helper classes, they are not very efficient, but that really 
     805Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java 
    854806=================================================================== 
    855 --- /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/ValuedEnum.java     (revision 0) 
    856 +++ /home/jharrop/workspace200711/fop/src/java/org/apache/fop/fonts/ValuedEnum.java     (revision 0) 
    857 @@ -0,0 +1,205 @@ 
     807--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java   (revision 711795) 
     808+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java   (working copy) 
     809@@ -130,6 +130,9 @@ 
     810         returnFont.setItalicAngle(Integer.parseInt(ttf.getItalicAngle())); 
     811         returnFont.setMissingWidth(0); 
     812         returnFont.setWeight(ttf.getWeightClass()); 
     813+         
     814+        returnFont.setPanose(ttf.getPanose() ); 
     815+        returnFont.setEmbeddable(ttf.isEmbeddable() ); 
     816  
     817         if (isCid) { 
     818             multiFont.setCIDType(CIDFontType.CIDTYPE2); 
     819Index: /home/dev/workspace/fop/src/java/org/apache/fop/fonts/ValuedEnum.java 
     820=================================================================== 
     821--- /home/dev/workspace/fop/src/java/org/apache/fop/fonts/ValuedEnum.java       (revision 0) 
     822+++ /home/dev/workspace/fop/src/java/org/apache/fop/fonts/ValuedEnum.java       (revision 0) 
     823@@ -0,0 +1,234 @@ 
    858824+/* 
    859825+ * Copyright 1997-2004 The Apache Software Foundation 
     
    877843+ */ 
    878844+ 
    879 +// moved from avalon.framework 
     845+//package org.apache.avalon.framework; 
    880846+package org.apache.fop.fonts; 
    881847+ 
     
    938904+ * 
    939905+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> 
    940 + * @version CVS $Revision: 1.21 $ $Date: 2004/02/11 14:34:24 $ 
     906+ * @version $Id$ 
    941907+ */ 
    942908+public abstract class ValuedEnum 
     
    10501016+ 
    10511017+    /** 
     1018+     * Tests for equality. Two Enum:s are considered equal 
     1019+     * if they are of the same class, have the same name, and same value. 
     1020+     * 
     1021+     * @param o the other object 
     1022+     * @return the equality status 
     1023+     */ 
     1024+    public boolean equals( Object o ) 
     1025+    { 
     1026+        boolean prelim = super.equals( o ); 
     1027+        if( ! prelim ) 
     1028+            return false; 
     1029+             
     1030+        if( !(o instanceof ValuedEnum) ) 
     1031+            return false; 
     1032+ 
     1033+        final ValuedEnum enumerated = (ValuedEnum) o; 
     1034+        return m_value == enumerated.m_value; 
     1035+    } 
     1036+     
     1037+    public int hashCode() 
     1038+    { 
     1039+        int hash = super.hashCode(); 
     1040+        hash ^= m_value; 
     1041+        hash >>>= (m_value & 31 ); 
     1042+        return hash; 
     1043+    } 
     1044+     
     1045+     
     1046+    /** 
    10521047+     * Override toString method to produce human readable description. 
    10531048+     * 
Note: See TracChangeset for help on using the changeset viewer.