aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/svg/PDFGraphics2D.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-02-10 14:39:34 +0000
committerJeremias Maerki <jeremias@apache.org>2006-02-10 14:39:34 +0000
commit17094f3329733ab1e0b68b8e9b3c302382572f25 (patch)
tree848c68e3210147b900273d3a6da29825ccc3753a /src/java/org/apache/fop/svg/PDFGraphics2D.java
parent77f908f5cce1fea0b4b5f694b31a4070bd33cfb8 (diff)
downloadxmlgraphics-fop-17094f3329733ab1e0b68b8e9b3c302382572f25.tar.gz
xmlgraphics-fop-17094f3329733ab1e0b68b8e9b3c302382572f25.zip
Creation of Font instances centralized in FontInfo and added a cache for them. This removes duplicate code in a number of places, improves speed a little and saves memory.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@376706 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/svg/PDFGraphics2D.java')
-rw-r--r--src/java/org/apache/fop/svg/PDFGraphics2D.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java
index 732cd95bd..9a8ef1d7a 100644
--- a/src/java/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java
@@ -35,7 +35,6 @@ import org.apache.fop.pdf.BitmapImage;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontSetup;
-import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.fonts.LazyFont;
import org.apache.fop.image.JpegImage;
@@ -1396,14 +1395,10 @@ public class PDFGraphics2D extends AbstractGraphics2D {
String style = gFont.isItalic() ? "italic" : "normal";
int weight = gFont.isBold() ? Font.BOLD : Font.NORMAL;
FontTriplet triplet = fontInfo.fontLookup(n, style, weight);
- String fname = fontInfo.getInternalFontKey(triplet);
- fontInfo.useFont(fname);
- FontMetrics metrics = fontInfo.getMetricsFor(fname);
- fontState = new Font(fname, triplet, metrics, siz * 1000);
+ fontState = fontInfo.getFontInstance(triplet, siz * 1000);
} else {
- FontMetrics metrics = fontInfo.getMetricsFor(ovFontState.getFontName());
- fontState = new Font(ovFontState.getFontName(), ovFontState.getFontTriplet(),
- metrics, ovFontState.getFontSize());
+ fontState = fontInfo.getFontInstance(
+ ovFontState.getFontTriplet(), ovFontState.getFontSize());
ovFontState = null;
}
String name;