diff options
author | Peter Hancock <phancock@apache.org> | 2012-10-04 14:46:01 +0000 |
---|---|---|
committer | Peter Hancock <phancock@apache.org> | 2012-10-04 14:46:01 +0000 |
commit | af57408966c6e9a525475f52bdc96add31cb0e51 (patch) | |
tree | 7aec6fd97d2d6c501be6b2473aa399b236e37a51 /src/java/org/apache/fop/render/ps | |
parent | 118f9d4f0f6aeed4971ea9cc61fd4d63198c9a84 (diff) | |
parent | d261730a4f7be752ae12a5ec52e6bad8ee4fa5c1 (diff) | |
download | xmlgraphics-fop-af57408966c6e9a525475f52bdc96add31cb0e51.tar.gz xmlgraphics-fop-af57408966c6e9a525475f52bdc96add31cb0e51.zip |
Merged trunk@1391502
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1394098 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps')
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSDocumentHandler.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSFontUtils.java | 30 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSDocumentHandler.java b/src/java/org/apache/fop/render/ps/PSDocumentHandler.java index 0ec5fdda6..897ed8fb8 100644 --- a/src/java/org/apache/fop/render/ps/PSDocumentHandler.java +++ b/src/java/org/apache/fop/render/ps/PSDocumentHandler.java @@ -39,6 +39,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.xmlgraphics.io.TempResourceURIGenerator; import org.apache.xmlgraphics.java2d.Dimension2DDouble; import org.apache.xmlgraphics.ps.DSCConstants; import org.apache.xmlgraphics.ps.PSDictionary; @@ -53,7 +54,6 @@ import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox; import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox; import org.apache.fop.apps.MimeConstants; -import org.apache.fop.apps.io.TempResourceURIGenerator; import org.apache.fop.render.intermediate.AbstractBinaryWritingIFDocumentHandler; import org.apache.fop.render.intermediate.IFContext; import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator; diff --git a/src/java/org/apache/fop/render/ps/PSFontUtils.java b/src/java/org/apache/fop/render/ps/PSFontUtils.java index c99bb21e1..9e810c824 100644 --- a/src/java/org/apache/fop/render/ps/PSFontUtils.java +++ b/src/java/org/apache/fop/render/ps/PSFontUtils.java @@ -38,7 +38,7 @@ import org.apache.xmlgraphics.ps.dsc.ResourceTracker; import org.apache.fop.fonts.Base14Font; import org.apache.fop.fonts.CIDFontType; -import org.apache.fop.fonts.CIDSubset; +import org.apache.fop.fonts.CIDSet; import org.apache.fop.fonts.CMapSegment; import org.apache.fop.fonts.CustomFont; import org.apache.fop.fonts.EmbeddingMode; @@ -457,15 +457,17 @@ public class PSFontUtils extends org.apache.xmlgraphics.ps.PSFontUtils { // TODO /FontInfo gen.write("/CIDCount "); - CIDSubset cidSubset = font.getCIDSubset(); - int subsetSize = cidSubset.getSubsetSize(); - gen.write(subsetSize); + CIDSet cidSet = font.getCIDSet(); + int numberOfGlyphs = cidSet.getNumberOfGlyphs(); + gen.write(numberOfGlyphs); gen.writeln(" def"); gen.writeln("/GDBytes 2 def"); // TODO always 2? gen.writeln("/CIDMap [<"); int colCount = 0; int lineCount = 1; - for (int cid = 0; cid < subsetSize; cid++) { + int nextBitSet = 0; + int previousBitSet = 0; + for (int cid = 0; cid < numberOfGlyphs; cid++) { if (colCount++ == 20) { gen.newLine(); colCount = 1; @@ -478,7 +480,23 @@ public class PSFontUtils extends org.apache.xmlgraphics.ps.PSFontUtils { if (font.getEmbeddingMode() != EmbeddingMode.FULL) { gid = HexEncoder.encode(cid, 4); } else { - gid = HexEncoder.encode(cidSubset.getGlyphIndexForSubsetIndex(cid), 4); + previousBitSet = nextBitSet; + nextBitSet = cidSet.getGlyphIndices().nextSetBit(nextBitSet); + while (previousBitSet++ < nextBitSet) { + // if there are gaps in the indices we pad them with zeros + gen.write("0000"); + cid++; + if (colCount++ == 20) { + gen.newLine(); + colCount = 1; + if (lineCount++ == 800) { + gen.writeln("> <"); + lineCount = 1; + } + } + } + gid = HexEncoder.encode(nextBitSet, 4); + nextBitSet++; } gen.write(gid); } |