]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fix to avoid leading and trailing spaces in the values being read.
authorJeremias Maerki <jeremias@apache.org>
Sun, 10 Oct 2004 11:24:46 +0000 (11:24 +0000)
committerJeremias Maerki <jeremias@apache.org>
Sun, 10 Oct 2004 11:24:46 +0000 (11:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198020 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fonts/FontReader.java

index e5d5ecf32fca2a61f8d030ab934787282d54630f..517f648548786fac93455a75d8f2668bbd1572f5 100644 (file)
@@ -213,50 +213,51 @@ public class FontReader extends DefaultHandler {
      * @see org.xml.sax.ContentHandler#endElement(String, String, String)
      */
     public void endElement(String uri, String localName, String qName) {
+        String content = text.toString().trim();
         if ("font-name".equals(localName)) {
-            returnFont.setFontName(text.toString());
+            returnFont.setFontName(content);
         } else if ("ttc-name".equals(localName) && isCID) {
-            multiFont.setTTCName(text.toString());
+            multiFont.setTTCName(content);
         } else if ("cap-height".equals(localName)) {
-            returnFont.setCapHeight(getInt(text.toString()));
+            returnFont.setCapHeight(getInt(content));
         } else if ("x-height".equals(localName)) {
-            returnFont.setXHeight(getInt(text.toString()));
+            returnFont.setXHeight(getInt(content));
         } else if ("ascender".equals(localName)) {
-            returnFont.setAscender(getInt(text.toString()));
+            returnFont.setAscender(getInt(content));
         } else if ("descender".equals(localName)) {
-            returnFont.setDescender(getInt(text.toString()));
+            returnFont.setDescender(getInt(content));
         } else if ("left".equals(localName)) {
             int[] bbox = returnFont.getFontBBox();
-            bbox[0] = getInt(text.toString());
+            bbox[0] = getInt(content);
             returnFont.setFontBBox(bbox);
         } else if ("bottom".equals(localName)) {
             int[] bbox = returnFont.getFontBBox();
-            bbox[1] = getInt(text.toString());
+            bbox[1] = getInt(content);
             returnFont.setFontBBox(bbox);
         } else if ("right".equals(localName)) {
             int[] bbox = returnFont.getFontBBox();
-            bbox[2] = getInt(text.toString());
+            bbox[2] = getInt(content);
             returnFont.setFontBBox(bbox);
         } else if ("top".equals(localName)) {
             int[] bbox = returnFont.getFontBBox();
-            bbox[3] = getInt(text.toString());
+            bbox[3] = getInt(content);
             returnFont.setFontBBox(bbox);
         } else if ("first-char".equals(localName)) {
-            returnFont.setFirstChar(getInt(text.toString()));
+            returnFont.setFirstChar(getInt(content));
         } else if ("last-char".equals(localName)) {
-            returnFont.setLastChar(getInt(text.toString()));
+            returnFont.setLastChar(getInt(content));
         } else if ("flags".equals(localName)) {
-            returnFont.setFlags(getInt(text.toString()));
+            returnFont.setFlags(getInt(content));
         } else if ("stemv".equals(localName)) {
-            returnFont.setStemV(getInt(text.toString()));
+            returnFont.setStemV(getInt(content));
         } else if ("italic-angle".equals(localName)) {
-            returnFont.setItalicAngle(getInt(text.toString()));
+            returnFont.setItalicAngle(getInt(content));
         } else if ("missing-width".equals(localName)) {
-            returnFont.setMissingWidth(getInt(text.toString()));
+            returnFont.setMissingWidth(getInt(content));
         } else if ("cid-type".equals(localName)) {
-            multiFont.setCIDType(CIDFontType.byName(text.toString()));
+            multiFont.setCIDType(CIDFontType.byName(content));
         } else if ("default-width".equals(localName)) {
-            multiFont.setDefaultWidth(getInt(text.toString()));
+            multiFont.setDefaultWidth(getInt(content));
         } else if ("cid-widths".equals(localName)) {
             int[] wds = new int[cidWidths.size()];
             int j = 0;