diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-12-22 20:10:54 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-12-22 20:10:54 +0000 |
commit | 250a5e5363af3462693c80227e0666d0b5b75a8f (patch) | |
tree | 08472457a78d2cc6cf8e8c6b4ae98ee4180d7c59 /src/java/org/apache/fop/render/ps/PSTextPainter.java | |
parent | 3e74ade6902eb4ce94c5c6c7566a900437f4702b (diff) | |
download | xmlgraphics-fop-250a5e5363af3462693c80227e0666d0b5b75a8f.tar.gz xmlgraphics-fop-250a5e5363af3462693c80227e0666d0b5b75a8f.zip |
As announced, I brought FontTriplet to more life by making it Serializable and using it to transport the information about the font in use through the area tree. This has small effects on the test cases as the values in the generated XML are slightly different. While refactoring I saw that there's some room for optimization. Too many objects are still created. It should be quite easy now with the FontTriplet to create a small cache.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@358613 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps/PSTextPainter.java')
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSTextPainter.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index 7153ea4f5..aba67759c 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -48,6 +48,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.fop.fonts.FontMetrics; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontTriplet; /** * Renders the attributed character iterator of a <tt>TextNode</tt>. @@ -384,19 +385,22 @@ public class PSTextPainter implements TextPainter { }*/ fontFamily = fam.getFamilyName(); if (fontInfo.hasFont(fontFamily, style, weight)) { - String fname = fontInfo.fontLookup( + FontTriplet triplet = fontInfo.fontLookup( fontFamily, style, weight); + String fname = fontInfo.getInternalFontKey(triplet); + fontInfo.useFont(fname); FontMetrics metrics = fontInfo.getMetricsFor(fname); int fsize = (int)(fontSize.floatValue() * 1000); - return new Font(fname, metrics, fsize); + return new Font(fname, triplet, metrics, fsize); } } } - String fname = fontInfo.fontLookup( - "any", style, Font.NORMAL); + FontTriplet triplet = fontInfo.fontLookup("any", style, Font.NORMAL); + String fname = fontInfo.getInternalFontKey(triplet); + fontInfo.useFont(fname); FontMetrics metrics = fontInfo.getMetricsFor(fname); int fsize = (int)(fontSize.floatValue() * 1000); - return new Font(fname, metrics, fsize); + return new Font(fname, triplet, metrics, fsize); } private java.awt.Font makeAWTFont(AttributedCharacterIterator aci, Font font) { |