jeremias 2003/04/03 04:51:27 Modified: src/java/org/apache/fop/render/pdf FontSetup.java Log: 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 Revision Changes Path 1.3 +18 -5 xml-fop/src/java/org/apache/fop/render/pdf/FontSetup.java Index: FontSetup.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/FontSetup.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FontSetup.java 27 Mar 2003 11:17:46 -0000 1.2 +++ FontSetup.java 3 Apr 2003 12:51:27 -0000 1.3 @@ -233,11 +233,24 @@ 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) { - /[EMAIL PROTECTED] 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 @@ 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); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]