From 949351de59f386a76ab790826bea9ed3fdfe8b7a Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Sun, 18 Feb 2007 09:46:12 +0000 Subject: [PATCH] Slight correction: value of "inherit" was not yet handled; delegate to the superclass in that case git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@508890 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/properties/FontFamilyProperty.java | 74 ++++++++++--------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java index 84000233c..62263a02c 100644 --- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java +++ b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java @@ -47,46 +47,50 @@ public class FontFamilyProperty extends ListProperty { * org.apache.fop.fo.FObj) */ public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { - ListProperty prop = new ListProperty(); - String tmpVal; - int startIndex = 0; - int commaIndex = value.indexOf(','); - int quoteIndex; - int aposIndex; - char qChar; - boolean parsed = false; - while (!parsed) { - if (commaIndex == -1) { - tmpVal = value.substring(startIndex).trim(); - parsed = true; - } else { - tmpVal = value.substring(startIndex, commaIndex).trim(); - startIndex = commaIndex + 1; - commaIndex = value.indexOf(',', startIndex); - } - aposIndex = tmpVal.indexOf('\''); - quoteIndex = tmpVal.indexOf('\"'); - if (aposIndex != -1 || quoteIndex != -1) { - qChar = (aposIndex == -1) ? '\"' : '\''; - if (tmpVal.lastIndexOf(qChar) != tmpVal.length() - 1) { - Property.log.warn("Skipping malformed value for font-family: " - + tmpVal + " in \"" + value + "\"."); - tmpVal = ""; + if ("inherit".equals(value)) { + return super.make(propertyList, value, fo); + } else { + ListProperty prop = new ListProperty(); + String tmpVal; + int startIndex = 0; + int commaIndex = value.indexOf(','); + int quoteIndex; + int aposIndex; + char qChar; + boolean parsed = false; + while (!parsed) { + if (commaIndex == -1) { + tmpVal = value.substring(startIndex).trim(); + parsed = true; } else { - tmpVal = tmpVal.substring(1, tmpVal.length() - 1); + tmpVal = value.substring(startIndex, commaIndex).trim(); + startIndex = commaIndex + 1; + commaIndex = value.indexOf(',', startIndex); } - } - if (!"".equals(tmpVal)) { - int dblSpaceIndex = tmpVal.indexOf(" "); - while (dblSpaceIndex != -1) { - tmpVal = tmpVal.substring(0, dblSpaceIndex) - + tmpVal.substring(dblSpaceIndex + 1); - dblSpaceIndex = tmpVal.indexOf(" "); + aposIndex = tmpVal.indexOf('\''); + quoteIndex = tmpVal.indexOf('\"'); + if (aposIndex != -1 || quoteIndex != -1) { + qChar = (aposIndex == -1) ? '\"' : '\''; + if (tmpVal.lastIndexOf(qChar) != tmpVal.length() - 1) { + log.warn("Skipping malformed value for font-family: " + + tmpVal + " in \"" + value + "\"."); + tmpVal = ""; + } else { + tmpVal = tmpVal.substring(1, tmpVal.length() - 1); + } + } + if (!"".equals(tmpVal)) { + int dblSpaceIndex = tmpVal.indexOf(" "); + while (dblSpaceIndex != -1) { + tmpVal = tmpVal.substring(0, dblSpaceIndex) + + tmpVal.substring(dblSpaceIndex + 1); + dblSpaceIndex = tmpVal.indexOf(" "); + } + prop.addProperty(new StringProperty(tmpVal)); } - prop.addProperty(new StringProperty(tmpVal)); } + return prop; } - return prop; } /** -- 2.39.5