You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2003/04/03 14:53:44 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fonts MultiByteFont.java CIDFont.java
jeremias 2003/04/03 04:53:44
Modified: src/java/org/apache/fop/render/pdf FontReader.java
src/java/org/apache/fop/pdf PDFFactory.java
src/java/org/apache/fop/fonts MultiByteFont.java
CIDFont.java
Log:
Fix TrueType embedding. Width array did not reflect the subset. Was my bad.
Revision Changes Path
1.3 +1 -1 xml-fop/src/java/org/apache/fop/render/pdf/FontReader.java
Index: FontReader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/FontReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FontReader.java 15 Mar 2003 16:58:59 -0000 1.2
+++ FontReader.java 3 Apr 2003 12:53:44 -0000 1.3
@@ -304,7 +304,7 @@
wds[j++] = i.intValue();
}
- multiFont.addCIDWidthEntry(cidWidthIndex, wds);
+ //multiFont.addCIDWidthEntry(cidWidthIndex, wds);
multiFont.setWidthArray(wds);
} else if ("bfranges".equals(localName)) {
1.3 +1 -1 xml-fop/src/java/org/apache/fop/pdf/PDFFactory.java
Index: PDFFactory.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PDFFactory.java 27 Mar 2003 11:04:31 -0000 1.2
+++ PDFFactory.java 3 Apr 2003 12:53:44 -0000 1.3
@@ -1023,7 +1023,7 @@
new PDFCIDFont(basefont,
cidMetrics.getCIDType(),
cidMetrics.getDefaultWidth(),
- cidMetrics.getWidths(), sysInfo,
+ cidMetrics.getSubsetWidths(), sysInfo,
(PDFCIDFontDescriptor)pdfdesc);
getDocument().registerObject(cidFont);
1.2 +20 -19 xml-fop/src/java/org/apache/fop/fonts/MultiByteFont.java
Index: MultiByteFont.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/MultiByteFont.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MultiByteFont.java 11 Mar 2003 13:05:15 -0000 1.1
+++ MultiByteFont.java 3 Apr 2003 12:53:44 -0000 1.2
@@ -73,7 +73,7 @@
private CIDFontType cidType = CIDFontType.CIDTYPE2;
private String namePrefix = null; // Quasi unique prefix
- private PDFWArray warray = new PDFWArray();
+ //private PDFWArray warray = new PDFWArray();
private int width[] = null;
private BFEntry[] bfentries = null;
@@ -170,23 +170,6 @@
}
}
-/* unused
- public PDFWArray getWidthsAsPDFWArray() {
- if (isEmbeddable()) {
- // Create widths for reencoded chars
- warray = new PDFWArray();
- int[] tmpWidth = new int[usedGlyphsCount];
-
- for (int i = 0; i < usedGlyphsCount; i++) {
- Integer nw = (Integer)usedGlyphsIndex.get(new Integer(i));
- int nwx = (nw == null) ? 0 : nw.intValue();
- tmpWidth[i] = width[nwx];
- }
- warray.addEntry(0, tmpWidth);
- }
- return warray;
- }*/
-
/**
* @see org.apache.fop.fonts.FontDescriptor#isEmbeddable()
*/
@@ -243,6 +226,23 @@
}
/**
+ * @see org.apache.fop.fonts.CIDFont#getSubsetWidths()
+ */
+ public PDFWArray getSubsetWidths() {
+ // Create widths for reencoded chars
+ PDFWArray warray = new PDFWArray();
+ int[] tmpWidth = new int[usedGlyphsCount];
+
+ for (int i = 0; i < usedGlyphsCount; i++) {
+ Integer nw = (Integer)usedGlyphsIndex.get(new Integer(i));
+ int nwx = (nw == null) ? 0 : nw.intValue();
+ tmpWidth[i] = width[nwx];
+ }
+ warray.addEntry(0, tmpWidth);
+ return warray;
+ }
+
+ /**
* Remaps a codepoint based.
* @param i codepoint to remap
* @return new codepoint
@@ -334,9 +334,10 @@
* @param cidWidthIndex index
* @param wds array of widths
*/
+ /*
public void addCIDWidthEntry(int cidWidthIndex, int[] wds) {
this.warray.addEntry(cidWidthIndex, wds);
- }
+ }*/
/**
1.2 +11 -1 xml-fop/src/java/org/apache/fop/fonts/CIDFont.java
Index: CIDFont.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/CIDFont.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CIDFont.java 11 Mar 2003 13:05:15 -0000 1.1
+++ CIDFont.java 3 Apr 2003 12:53:44 -0000 1.2
@@ -50,6 +50,8 @@
*/
package org.apache.fop.fonts;
+import org.apache.fop.pdf.PDFWArray;
+
/**
* Abstract base class for CID fonts.
*/
@@ -104,4 +106,12 @@
public boolean isMultiByte() {
return true;
}
-}
+
+ /**
+ * Returns a PDFWArray containing all the widths of the subset to be used.
+ * @return the character widths
+ * @todo Try to avoid dependency on PDF library
+ */
+ public abstract PDFWArray getSubsetWidths();
+
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org