aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-07-04 19:25:51 +0000
committerJeremias Maerki <jeremias@apache.org>2003-07-04 19:25:51 +0000
commitbdccae8d8902398e815bbf86585da429198eef0b (patch)
tree5c43aeb3683767b51a7b32145e00b288b0aa0f98 /src/java/org/apache/fop/render
parentc002a829bddac8d9860addda60e3941646f34c5b (diff)
downloadxmlgraphics-fop-bdccae8d8902398e815bbf86585da429198eef0b.tar.gz
xmlgraphics-fop-bdccae8d8902398e815bbf86585da429198eef0b.zip
Use code from the new FontUtil class.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196591 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/pdf/FontSetup.java23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/java/org/apache/fop/render/pdf/FontSetup.java b/src/java/org/apache/fop/render/pdf/FontSetup.java
index 3da3d472f..b00e924fc 100644
--- a/src/java/org/apache/fop/render/pdf/FontSetup.java
+++ b/src/java/org/apache/fop/render/pdf/FontSetup.java
@@ -55,6 +55,7 @@ import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontDescriptor;
+import org.apache.fop.fonts.FontUtil;
import org.apache.fop.fonts.LazyFont;
import org.apache.fop.layout.FontInfo;
import org.apache.fop.pdf.PDFDocument;
@@ -229,27 +230,7 @@ public class FontSetup {
for (int c = 0; c < triplets.size(); c++) {
FontTriplet triplet = (FontTriplet)triplets.get(c);
- int weight = 400;
- try {
- weight = Integer.parseInt(triplet.getWeight());
- weight = ((int)weight / 100) * 100;
- weight = Math.max(weight, 100);
- weight = Math.min(weight, 900);
- } catch (NumberFormatException nfe) {
- //weight is no number, so convert smybolic name to number
- if (triplet.getWeight().equals("normal")) {
- weight = 400;
- } else if (triplet.getWeight().equals("bold")) {
- weight = 700;
- } else {
- throw new IllegalArgumentException(
- "Illegal value for font weight: '"
- + triplet.getWeight()
- + "'. Use one of: 100, 200, 300, "
- + "400, 500, 600, 700, 800, 900, "
- + "normal (=400), bold (=700)");
- }
- }
+ int weight = FontUtil.parseCSS2FontWeight(triplet.getWeight());
//System.out.println("Registering: "+triplet+" weight="+weight);
fontInfo.addFontProperties(internalName,
triplet.getName(),