aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/pdf
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-04-03 12:51:27 +0000
committerJeremias Maerki <jeremias@apache.org>2003-04-03 12:51:27 +0000
commitf3694e125312a451f2036927c02c3652037c647d (patch)
treedc868f2760b2941dd066c3fc5635d3c635b2c9ea /src/java/org/apache/fop/render/pdf
parenta29be0ad84308c025df21e48f67e28c67f8cff71 (diff)
downloadxmlgraphics-fop-f3694e125312a451f2036927c02c3652037c647d.tar.gz
xmlgraphics-fop-f3694e125312a451f2036927c02c3652037c647d.zip
Fix font registration (normal and bold work again, invalid values get barked at)
Make the kerning and embedding-url attributes optional as it should be git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196204 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/pdf')
-rw-r--r--src/java/org/apache/fop/render/pdf/FontSetup.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/render/pdf/FontSetup.java b/src/java/org/apache/fop/render/pdf/FontSetup.java
index d2bd02e12..3da3d472f 100644
--- a/src/java/org/apache/fop/render/pdf/FontSetup.java
+++ b/src/java/org/apache/fop/render/pdf/FontSetup.java
@@ -233,11 +233,24 @@ public class FontSetup {
try {
weight = Integer.parseInt(triplet.getWeight());
weight = ((int)weight / 100) * 100;
- weight = Math.min(weight, 100);
- weight = Math.max(weight, 900);
+ weight = Math.max(weight, 100);
+ weight = Math.min(weight, 900);
} catch (NumberFormatException nfe) {
- /**@todo log this exception */
+ //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)");
+ }
}
+ //System.out.println("Registering: "+triplet+" weight="+weight);
fontInfo.addFontProperties(internalName,
triplet.getName(),
triplet.getStyle(),
@@ -291,8 +304,8 @@ public class FontSetup {
EmbedFontInfo efi;
efi = new EmbedFontInfo(font[i].getAttribute("metrics-url"),
- font[i].getAttributeAsBoolean("kerning"),
- tripleList, font[i].getAttribute("embed-url"));
+ font[i].getAttributeAsBoolean("kerning", false),
+ tripleList, font[i].getAttribute("embed-url", null));
fontList.add(efi);
}