aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-04-03 12:53:44 +0000
committerJeremias Maerki <jeremias@apache.org>2003-04-03 12:53:44 +0000
commit6b9af7902e76938f4ec90003b2abba3d1c2ac629 (patch)
tree6b7043c5290390ccf2293bdcc16b33d1b7c0a353
parentf3694e125312a451f2036927c02c3652037c647d (diff)
downloadxmlgraphics-fop-6b9af7902e76938f4ec90003b2abba3d1c2ac629.tar.gz
xmlgraphics-fop-6b9af7902e76938f4ec90003b2abba3d1c2ac629.zip
Fix TrueType embedding. Width array did not reflect the subset. Was my bad.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196205 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fonts/CIDFont.java12
-rw-r--r--src/java/org/apache/fop/fonts/MultiByteFont.java39
-rw-r--r--src/java/org/apache/fop/pdf/PDFFactory.java2
-rw-r--r--src/java/org/apache/fop/render/pdf/FontReader.java2
4 files changed, 33 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/fonts/CIDFont.java b/src/java/org/apache/fop/fonts/CIDFont.java
index 2697cda8e..701b9be2f 100644
--- a/src/java/org/apache/fop/fonts/CIDFont.java
+++ b/src/java/org/apache/fop/fonts/CIDFont.java
@@ -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 abstract class CIDFont extends CustomFont {
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
diff --git a/src/java/org/apache/fop/fonts/MultiByteFont.java b/src/java/org/apache/fop/fonts/MultiByteFont.java
index 91694051e..3195eb1dc 100644
--- a/src/java/org/apache/fop/fonts/MultiByteFont.java
+++ b/src/java/org/apache/fop/fonts/MultiByteFont.java
@@ -73,7 +73,7 @@ public class MultiByteFont extends CIDFont {
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 @@ public class MultiByteFont extends CIDFont {
}
}
-/* 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 @@ public class MultiByteFont extends CIDFont {
}
/**
+ * @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 @@ public class MultiByteFont extends CIDFont {
* @param cidWidthIndex index
* @param wds array of widths
*/
+ /*
public void addCIDWidthEntry(int cidWidthIndex, int[] wds) {
this.warray.addEntry(cidWidthIndex, wds);
- }
+ }*/
/**
diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java
index ceeba8915..ec5d772a6 100644
--- a/src/java/org/apache/fop/pdf/PDFFactory.java
+++ b/src/java/org/apache/fop/pdf/PDFFactory.java
@@ -1023,7 +1023,7 @@ public class PDFFactory {
new PDFCIDFont(basefont,
cidMetrics.getCIDType(),
cidMetrics.getDefaultWidth(),
- cidMetrics.getWidths(), sysInfo,
+ cidMetrics.getSubsetWidths(), sysInfo,
(PDFCIDFontDescriptor)pdfdesc);
getDocument().registerObject(cidFont);
diff --git a/src/java/org/apache/fop/render/pdf/FontReader.java b/src/java/org/apache/fop/render/pdf/FontReader.java
index 08a55d4d4..5a917b574 100644
--- a/src/java/org/apache/fop/render/pdf/FontReader.java
+++ b/src/java/org/apache/fop/render/pdf/FontReader.java
@@ -304,7 +304,7 @@ public class FontReader extends DefaultHandler {
wds[j++] = i.intValue();
}
- multiFont.addCIDWidthEntry(cidWidthIndex, wds);
+ //multiFont.addCIDWidthEntry(cidWidthIndex, wds);
multiFont.setWidthArray(wds);
} else if ("bfranges".equals(localName)) {