aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-08-14 15:31:10 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-08-14 15:31:10 +0000
commita9a3ea149314c75ee52f5f2f0f58c8146592736a (patch)
treec944187b2e2e87956d8db7640997727fc4543559 /src/java/org/apache
parentdbb70a6873319ab9948777513b8149e7a1262364 (diff)
downloadxmlgraphics-fop-a9a3ea149314c75ee52f5f2f0f58c8146592736a.tar.gz
xmlgraphics-fop-a9a3ea149314c75ee52f5f2f0f58c8146592736a.zip
move layout.FontState to fonts.Font
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196800 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/fo/PropertyManager.java8
-rw-r--r--src/java/org/apache/fop/fo/TextInfo.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/Leader.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/PageNumber.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/PageNumberCitation.java4
-rw-r--r--src/java/org/apache/fop/fo/pagination/Title.java4
-rw-r--r--src/java/org/apache/fop/fonts/Font.java (renamed from src/java/org/apache/fop/layout/FontState.java)10
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java1
-rw-r--r--src/java/org/apache/fop/layoutmgr/TextLayoutManager.java1
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java6
-rw-r--r--src/java/org/apache/fop/render/ps/PSGraphics2D.java15
-rw-r--r--src/java/org/apache/fop/render/ps/PSTextPainter.java25
-rw-r--r--src/java/org/apache/fop/svg/PDFGraphics2D.java21
-rw-r--r--src/java/org/apache/fop/svg/PDFTextPainter.java26
-rw-r--r--src/java/org/apache/fop/tools/AreaTreeBuilder.java8
-rw-r--r--src/java/org/apache/fop/util/CharUtilities.java4
16 files changed, 75 insertions, 70 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyManager.java b/src/java/org/apache/fop/fo/PropertyManager.java
index dc5d9f918..0e73e6433 100644
--- a/src/java/org/apache/fop/fo/PropertyManager.java
+++ b/src/java/org/apache/fop/fo/PropertyManager.java
@@ -57,7 +57,7 @@ import java.awt.geom.Rectangle2D;
// FOP
import org.apache.fop.area.CTM;
import org.apache.fop.datatypes.FODimension;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.control.Document;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
@@ -84,7 +84,7 @@ public class PropertyManager {
private PropertyList properties;
private Document fontInfo = null;
- private FontState fontState = null;
+ private Font fontState = null;
private CommonBorderAndPadding borderAndPadding = null;
private CommonHyphenation hyphProps = null;
private TextInfo textInfo = null;
@@ -133,7 +133,7 @@ public class PropertyManager {
* @param fontInfo FontInfo to work with
* @return a FontState object
*/
- public FontState getFontState(Document fontInfo) {
+ public Font getFontState(Document fontInfo) {
if (fontState == null) {
if (fontInfo == null) {
fontInfo = this.fontInfo;
@@ -170,7 +170,7 @@ public class PropertyManager {
String fname = fontInfo.fontLookup(fontFamily, fontStyle,
fontWeight);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
- fontState = new FontState(fname, metrics, fontSize);
+ fontState = new Font(fname, metrics, fontSize);
}
return fontState;
}
diff --git a/src/java/org/apache/fop/fo/TextInfo.java b/src/java/org/apache/fop/fo/TextInfo.java
index 860bbd119..a84ab6c3c 100644
--- a/src/java/org/apache/fop/fo/TextInfo.java
+++ b/src/java/org/apache/fop/fo/TextInfo.java
@@ -51,7 +51,7 @@
package org.apache.fop.fo;
// FOP
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.traits.SpaceVal;
import org.apache.fop.fo.properties.TextTransform;
@@ -61,7 +61,7 @@ import org.apache.fop.fo.properties.TextTransform;
*/
public class TextInfo {
/** object containing the font information */
- public FontState fs;
+ public Font fs;
/** fo:color property */
public ColorType color;
/** fo:wrap-option property */
diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java
index 285aef2e8..9f59b44e8 100644
--- a/src/java/org/apache/fop/fo/flow/Leader.java
+++ b/src/java/org/apache/fop/fo/flow/Leader.java
@@ -71,7 +71,7 @@ import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.control.Document;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.layoutmgr.ContentLayoutManager;
@@ -96,7 +96,7 @@ public class Leader extends FObjMixed {
/** FontInfo for this object */
protected Document fontInfo = null;
/** FontState for this object */
- protected FontState fontState;
+ protected Font fontState;
protected InlineArea leaderArea = null;
/**
diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java
index f6488bd1a..8f9fd7d8f 100644
--- a/src/java/org/apache/fop/fo/flow/PageNumber.java
+++ b/src/java/org/apache/fop/fo/flow/PageNumber.java
@@ -59,7 +59,7 @@ import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.control.Document;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.layout.TextState;
@@ -84,7 +84,7 @@ public class PageNumber extends FObj {
/** FontInfo for this object */
protected Document fontInfo = null;
/** FontState for this object */
- protected FontState fontState;
+ protected Font fontState;
private float red;
private float green;
diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
index 53a2bafde..a83665d9d 100644
--- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
+++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
@@ -69,7 +69,7 @@ import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.control.Document;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.layout.TextState;
@@ -91,7 +91,7 @@ public class PageNumberCitation extends FObj {
/** FontInfo for this object **/
protected Document fontInfo = null;
/** Fontstate for this object **/
- protected FontState fontState;
+ protected Font fontState;
private float red;
private float green;
diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java
index a1b9c9d98..a4daf6138 100644
--- a/src/java/org/apache/fop/fo/pagination/Title.java
+++ b/src/java/org/apache/fop/fo/pagination/Title.java
@@ -62,7 +62,7 @@ import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.layoutmgr.ContentLayoutManager;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
@@ -120,7 +120,7 @@ public class Title extends FObjMixed {
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- FontState fontState = propMgr.getFontState(foInputHandler.getFontInfo());
+ Font fontState = propMgr.getFontState(foInputHandler.getFontInfo());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
diff --git a/src/java/org/apache/fop/layout/FontState.java b/src/java/org/apache/fop/fonts/Font.java
index 2414a2a25..a304be560 100644
--- a/src/java/org/apache/fop/layout/FontState.java
+++ b/src/java/org/apache/fop/fonts/Font.java
@@ -48,18 +48,18 @@
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
-package org.apache.fop.layout;
+package org.apache.fop.fonts;
import java.util.Map;
-import org.apache.fop.fonts.CodePointMapping;
-import org.apache.fop.fonts.FontMetrics;
+
+
/**
* This class holds font state information and provides access to the font
* metrics.
*/
-public class FontState {
+public class Font {
private String fontName;
private int fontSize;
@@ -80,7 +80,7 @@ public class FontState {
* @param met font metrics
* @param fontSize font size
*/
- public FontState(String key, FontMetrics met, int fontSize) {
+ public Font(String key, FontMetrics met, int fontSize) {
this.fontName = key;
this.metric = met;
this.fontSize = fontSize;
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 83262ec21..4061e475e 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -63,6 +63,7 @@ import org.apache.fop.area.LineArea;
import org.apache.fop.traits.LayoutProps;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonBackground;
+import org.apache.fop.fonts.*;
/**
* LayoutManager for a block FO.
diff --git a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
index e26000f04..903f8c51b 100644
--- a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
@@ -59,6 +59,7 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Word;
import org.apache.fop.area.inline.Space;
import org.apache.fop.util.CharUtilities;
+import org.apache.fop.fonts.*;
/**
* LayoutManager for text (a sequence of characters) which generates one
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index 8b469f6e2..be653326b 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -114,7 +114,7 @@ import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Image;
import org.apache.fop.area.inline.Leader;
import org.apache.fop.area.inline.InlineParent;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.traits.BorderProps;
import org.apache.fop.datatypes.ColorType;
@@ -920,7 +920,7 @@ public class PDFRenderer extends PrintRenderer {
String s = word.getWord();
FontMetrics metrics = fontInfo.getMetricsFor(name);
- FontState fs = new FontState(name, metrics, size);
+ Font fs = new Font(name, metrics, size);
escapeText(s, fs, useMultiByte, pdf);
pdf.append(endText);
@@ -936,7 +936,7 @@ public class PDFRenderer extends PrintRenderer {
* @param useMultiByte Indicates the use of multi byte convention
* @param pdf target buffer for the escaped text
*/
- public void escapeText(String s, FontState fs,
+ public void escapeText(String s, Font fs,
boolean useMultiByte, StringBuffer pdf) {
String startText = useMultiByte ? "<" : "(";
String endText = useMultiByte ? "> " : ") ";
diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2D.java b/src/java/org/apache/fop/render/ps/PSGraphics2D.java
index 068d6272e..009bc9005 100644
--- a/src/java/org/apache/fop/render/ps/PSGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/PSGraphics2D.java
@@ -58,7 +58,8 @@ import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
-import java.awt.Font;
+/* java.awt.Font is not imported to avoid confusion with
+ org.apache.fop.fonts.Font */
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
@@ -84,7 +85,7 @@ import java.io.IOException;
// FOP
import org.apache.fop.control.Document;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
// Batik
import org.apache.batik.ext.awt.g2d.AbstractGraphics2D;
@@ -113,10 +114,10 @@ public class PSGraphics2D extends AbstractGraphics2D {
protected PSGenerator gen;
/** Currently valid FontState */
- protected FontState fontState;
+ protected Font fontState;
/** Overriding FontState */
- protected FontState overrideFontState = null;
+ protected Font overrideFontState = null;
/**
* the current (internal) font name
@@ -826,7 +827,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
public void drawString(String s, float x, float y) {
try {
if (overrideFontState == null) {
- Font gFont = getFont();
+ java.awt.Font gFont = getFont();
String n = gFont.getFamily();
if (n.equals("sanserif")) {
n = "sans-serif";
@@ -1088,7 +1089,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
* Sets the overrideing font state.
* @param infont FontState to set
*/
- public void setOverrideFontState(FontState infont) {
+ public void setOverrideFontState(Font infont) {
overrideFontState = infont;
}
@@ -1100,7 +1101,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
* @see java.awt.FontMetrics
* @see java.awt.Graphics#getFontMetrics()
*/
- public java.awt.FontMetrics getFontMetrics(Font f) {
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
return fmg.getFontMetrics(f);
}
diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java
index f357fa283..bb52fef6e 100644
--- a/src/java/org/apache/fop/render/ps/PSTextPainter.java
+++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java
@@ -53,7 +53,8 @@ package org.apache.fop.render.ps;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.awt.Font;
+/* java.awt.Font is not imported to avoid confusion with
+ org.apache.fop.fonts.Font */
import java.text.AttributedCharacterIterator;
import java.awt.font.TextAttribute;
@@ -73,7 +74,7 @@ import org.apache.batik.bridge.SVGFontFamily;
import org.apache.batik.gvt.renderer.StrokingTextPainter;
import org.apache.fop.fonts.FontMetrics;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.control.Document;
/**
@@ -189,7 +190,7 @@ public class PSTextPainter implements TextPainter {
&& (taWeight.floatValue() > 1.0)) ? Document.BOLD
: Document.NORMAL;
- FontState fontState = null;
+ Font fontState = null;
Document fi = fontInfo;
boolean found = false;
String fontFamily = null;
@@ -207,7 +208,7 @@ public class PSTextPainter implements TextPainter {
weight);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
int fsize = (int)(size.floatValue() * 1000);
- fontState = new FontState(fname, metrics, fsize);
+ fontState = new Font(fname, metrics, fsize);
found = true;
break;
}
@@ -218,27 +219,27 @@ public class PSTextPainter implements TextPainter {
fontInfo.fontLookup("any", style, Document.NORMAL);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
int fsize = (int)(size.floatValue() * 1000);
- fontState = new FontState(fname, metrics, fsize);
+ fontState = new Font(fname, metrics, fsize);
} else {
if (g2d instanceof PSGraphics2D) {
((PSGraphics2D) g2d).setOverrideFontState(fontState);
}
}
- int fStyle = Font.PLAIN;
+ int fStyle = java.awt.Font.PLAIN;
if (weight == Document.BOLD) {
if (style.equals("italic")) {
- fStyle = Font.BOLD | Font.ITALIC;
+ fStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
} else {
- fStyle = Font.BOLD;
+ fStyle = java.awt.Font.BOLD;
}
} else {
if (style.equals("italic")) {
- fStyle = Font.ITALIC;
+ fStyle = java.awt.Font.ITALIC;
} else {
- fStyle = Font.PLAIN;
+ fStyle = java.awt.Font.PLAIN;
}
}
- Font font = new Font(fontFamily, fStyle,
+ java.awt.Font font = new java.awt.Font(fontFamily, fStyle,
(int)(fontState.getFontSize() / 1000));
g2d.setFont(font);
@@ -288,7 +289,7 @@ public class PSTextPainter implements TextPainter {
return hasunsupported;
}
- private float getStringWidth(String str, FontState fontState) {
+ private float getStringWidth(String str, Font fontState) {
float wordWidth = 0;
float whitespaceWidth = fontState.getWidth(fontState.mapChar(' '));
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java
index 7a7bcf364..e4e4a2f37 100644
--- a/src/java/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java
@@ -65,7 +65,7 @@ import org.apache.fop.pdf.PDFLink;
import org.apache.fop.pdf.PDFAnnotList;
import org.apache.fop.pdf.BitmapImage;
import org.apache.fop.control.Document;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.render.pdf.FontSetup;
import org.apache.fop.fonts.FontMetrics;
import org.apache.fop.fonts.LazyFont;
@@ -87,7 +87,8 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.GraphicsConfiguration;
-import java.awt.Font;
+/* java.awt.Font is not imported to avoid confusion with
+ org.apache.fop.fonts.Font */
import java.awt.Image;
import java.awt.Shape;
import java.awt.Stroke;
@@ -159,7 +160,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* The override font state used when drawing text and the font cannot be
* set using java fonts.
*/
- protected FontState ovFontState = null;
+ protected Font ovFontState = null;
/**
* the current stream to add PDF commands to
@@ -266,7 +267,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
*
* @param infont the font state to use
*/
- public void setOverrideFontState(FontState infont) {
+ public void setOverrideFontState(Font infont) {
ovFontState = infont;
}
@@ -1198,9 +1199,9 @@ public class PDFGraphics2D extends AbstractGraphics2D {
public void drawString(String s, float x, float y) {
// System.out.println("drawString(String)");
- FontState fontState;
+ Font fontState;
if (ovFontState == null) {
- Font gFont = getFont();
+ java.awt.Font gFont = getFont();
String n = gFont.getFamily();
if (n.equals("sanserif")) {
n = "sans-serif";
@@ -1210,10 +1211,10 @@ public class PDFGraphics2D extends AbstractGraphics2D {
int weight = gFont.isBold() ? Document.BOLD : Document.NORMAL;
String fname = fontInfo.fontLookup(n, style, weight);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
- fontState = new FontState(fname, metrics, siz * 1000);
+ fontState = new Font(fname, metrics, siz * 1000);
} else {
FontMetrics metrics = fontInfo.getMetricsFor(ovFontState.getFontName());
- fontState = new FontState(ovFontState.getFontName(),
+ fontState = new Font(ovFontState.getFontName(),
metrics, ovFontState.getFontSize());
ovFontState = null;
}
@@ -1367,7 +1368,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
float y) {
System.err.println("drawString(AttributedCharacterIterator)");
- FontState fontState = null;
+ Font fontState = null;
Shape imclip = getClip();
writeClip(imclip);
@@ -1587,7 +1588,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
* @see java.awt.FontMetrics
* @see java.awt.Graphics#getFontMetrics()
*/
- public java.awt.FontMetrics getFontMetrics(Font f) {
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
return fmg.getFontMetrics(f);
}
diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java
index a3645d2e3..247b98bb9 100644
--- a/src/java/org/apache/fop/svg/PDFTextPainter.java
+++ b/src/java/org/apache/fop/svg/PDFTextPainter.java
@@ -53,8 +53,8 @@ package org.apache.fop.svg;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.awt.Font;
-
+/* java.awt.Font is not imported to avoid confusion with
+ org.apache.fop.fonts.Font */
import java.text.AttributedCharacterIterator;
import java.awt.font.TextAttribute;
import java.awt.Shape;
@@ -73,7 +73,7 @@ import org.apache.batik.bridge.SVGFontFamily;
import org.apache.batik.gvt.renderer.StrokingTextPainter;
import org.apache.fop.fonts.FontMetrics;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.control.Document;
/**
@@ -189,7 +189,7 @@ public class PDFTextPainter implements TextPainter {
&& (taWeight.floatValue() > 1.0)) ? Document.BOLD
: Document.NORMAL;
- FontState fontState = null;
+ Font fontState = null;
Document fi = fontInfo;
boolean found = false;
String fontFamily = null;
@@ -207,7 +207,7 @@ public class PDFTextPainter implements TextPainter {
weight);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
int fsize = (int)(size.floatValue() * 1000);
- fontState = new FontState(fname, metrics, fsize);
+ fontState = new Font(fname, metrics, fsize);
found = true;
break;
}
@@ -218,27 +218,27 @@ public class PDFTextPainter implements TextPainter {
fontInfo.fontLookup("any", style, Document.NORMAL);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
int fsize = (int)(size.floatValue() * 1000);
- fontState = new FontState(fname, metrics, fsize);
+ fontState = new Font(fname, metrics, fsize);
} else {
if (g2d instanceof PDFGraphics2D) {
((PDFGraphics2D) g2d).setOverrideFontState(fontState);
}
}
- int fStyle = Font.PLAIN;
+ int fStyle = java.awt.Font.PLAIN;
if (weight == Document.BOLD) {
if (style.equals("italic")) {
- fStyle = Font.BOLD | Font.ITALIC;
+ fStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
} else {
- fStyle = Font.BOLD;
+ fStyle = java.awt.Font.BOLD;
}
} else {
if (style.equals("italic")) {
- fStyle = Font.ITALIC;
+ fStyle = java.awt.Font.ITALIC;
} else {
- fStyle = Font.PLAIN;
+ fStyle = java.awt.Font.PLAIN;
}
}
- Font font = new Font(fontFamily, fStyle,
+ java.awt.Font font = new java.awt.Font(fontFamily, fStyle,
(int)(fontState.getFontSize() / 1000));
g2d.setFont(font);
@@ -288,7 +288,7 @@ public class PDFTextPainter implements TextPainter {
return hasunsupported;
}
- private float getStringWidth(String str, FontState fontState) {
+ private float getStringWidth(String str, Font fontState) {
float wordWidth = 0;
float whitespaceWidth = fontState.getWidth(fontState.mapChar(' '));
diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java
index 5f06e5bf0..16b720db2 100644
--- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java
+++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java
@@ -101,7 +101,7 @@ import org.apache.fop.area.inline.Space;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.area.inline.Word;
import org.apache.fop.control.Document;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.pdf.PDFRenderer;
import org.apache.fop.render.svg.SVGRenderer;
@@ -249,7 +249,7 @@ class TreeLoader extends AbstractLogEnabled {
private AreaTree areaTree;
private AreaTreeModel model;
private Document fontInfo;
- private FontState currentFontState;
+ private Font currentFontState;
TreeLoader(Document fi) {
fontInfo = fi;
@@ -562,7 +562,7 @@ class TreeLoader extends AbstractLogEnabled {
String fname = fontInfo.fontLookup("sans-serif", "normal", Document.NORMAL);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
currentFontState =
- new FontState(fname, metrics, 12000);
+ new Font(fname, metrics, 12000);
ch.setWidth(currentFontState.getWidth(ch.getChar()));
ch.setOffset(currentFontState.getCapHeight());
@@ -587,7 +587,7 @@ class TreeLoader extends AbstractLogEnabled {
String fname = fontInfo.fontLookup("sans-serif", "normal", Document.NORMAL);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
currentFontState =
- new FontState(fname, metrics, 12000);
+ new Font(fname, metrics, 12000);
Word word = getWord((Element) obj);
word.addTrait(Trait.FONT_NAME, fname);
diff --git a/src/java/org/apache/fop/util/CharUtilities.java b/src/java/org/apache/fop/util/CharUtilities.java
index 80fd7aba2..0703deaf3 100644
--- a/src/java/org/apache/fop/util/CharUtilities.java
+++ b/src/java/org/apache/fop/util/CharUtilities.java
@@ -50,7 +50,7 @@
*/
package org.apache.fop.util;
-import org.apache.fop.layout.FontState;
+import org.apache.fop.fonts.Font;
/**
* This class provides utilities to distinguish various kinds of Unicode
@@ -117,7 +117,7 @@ public class CharUtilities {
* @param fs FontState to use
* @return the width of the character
*/
- public static int getCharWidth(char c, FontState fs) {
+ public static int getCharWidth(char c, Font fs) {
int width;
if ((c == '\n') || (c == '\r') || (c == '\t') || (c == '\u00A0')) {