diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2010-08-27 18:07:13 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2010-08-27 18:07:13 +0000 |
commit | bb6dd55147567b97aac0061e713321825bc32ef9 (patch) | |
tree | 66626592d3c68a355b21b458cf4c148cbe4942c2 /src/java/org | |
parent | 77e6a238703f46f39d6ac638b3aa9cc4b7bb6c01 (diff) | |
download | xmlgraphics-fop-bb6dd55147567b97aac0061e713321825bc32ef9.tar.gz xmlgraphics-fop-bb6dd55147567b97aac0061e713321825bc32ef9.zip |
Added support for multi-byte fonts
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@990219 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSTextPainter.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index e3dace703..c5237fd80 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -45,6 +45,9 @@ import org.apache.xmlgraphics.ps.PSGenerator; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontMetrics; +import org.apache.fop.fonts.LazyFont; +import org.apache.fop.fonts.MultiByteFont; import org.apache.fop.svg.NativeTextPainter; import org.apache.fop.util.CharUtilities; @@ -427,14 +430,22 @@ public class PSTextPainter extends NativeTextPainter { textUtil.setCurrentFont(f, mapped); applyColor(paint, gen); + FontMetrics metrics = f.getFontMetrics(); + boolean multiByte = metrics instanceof MultiByteFont + || metrics instanceof LazyFont + && ((LazyFont) metrics).getRealFont() instanceof MultiByteFont; StringBuffer sb = new StringBuffer(); - sb.append('('); + sb.append(multiByte ? '<' : '('); for (int i = 0, c = this.currentChars.length(); i < c; i++) { char ch = this.currentChars.charAt(i); mapped = f.mapChar(ch); - PSGenerator.escapeChar(mapped, sb); + if (multiByte) { + sb.append(HexEncoder.encode(mapped)); + } else { + PSGenerator.escapeChar(mapped, sb); + } } - sb.append(')'); + sb.append(multiByte ? '>' : ')'); if (x || y) { sb.append("\n["); int idx = 0; @@ -512,10 +523,20 @@ public class PSTextPainter extends NativeTextPainter { textUtil.selectFont(f, mapped); textUtil.setCurrentFont(f, mapped); } - mapped = f.mapChar(this.currentChars.charAt(i)); //add glyph outlines to current path - char codepoint = (char)(mapped % 256); - gen.write("(" + codepoint + ")"); + mapped = f.mapChar(this.currentChars.charAt(i)); + FontMetrics metrics = f.getFontMetrics(); + boolean multiByte = metrics instanceof MultiByteFont + || metrics instanceof LazyFont + && ((LazyFont) metrics).getRealFont() instanceof MultiByteFont; + if (multiByte) { + gen.write('<'); + gen.write(HexEncoder.encode(mapped)); + gen.write('>'); + } else { + char codepoint = (char)(mapped % 256); + gen.write("(" + codepoint + ")"); + } gen.writeln(" false charpath"); if (iter.hasNext()) { |