From 37d2b45dbdbd492ff3bc7a7553cb17257d5d485e Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Wed, 26 Jun 2002 15:59:46 +0000 Subject: [PATCH] Added 3 arg systemFontCharacteristic(). Added expandFontSHand(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@194922 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/expr/SystemFontFunction.java | 71 ++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/src/org/apache/fop/fo/expr/SystemFontFunction.java b/src/org/apache/fop/fo/expr/SystemFontFunction.java index 5b426cdb5..64ee465af 100644 --- a/src/org/apache/fop/fo/expr/SystemFontFunction.java +++ b/src/org/apache/fop/fo/expr/SystemFontFunction.java @@ -9,6 +9,8 @@ package org.apache.fop.fo.expr; import org.apache.fop.fo.Properties.Font; import org.apache.fop.fo.PropNames; +import org.apache.fop.fo.PropertySets; +import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.FunctionNotImplementedException; /** @@ -20,9 +22,74 @@ public class SystemFontFunction { private static final String tag = "$Name$"; private static final String revision = "$Revision$"; - public static PropertyValue systemFont(String font, int property) - throws FunctionNotImplementedException + /** + * Return the PropertyValue appropriate to the property + * of the argument. property must be one of the font + * characteristic properties in the expansion set of the font + * shorthand property; PropertySets.fontExpansion. + * @param property int index of the font characteristic property + * to be returned. + * @param font String name of the system font + * @exception FunctionNotImplementedException + * @exception PropertyException if the property is not appropriate or + * if any other errors occur in the processing of the property + */ + public static PropertyValue systemFontCharacteristic + (int property, String font) + throws FunctionNotImplementedException, PropertyException { throw new FunctionNotImplementedException("system-font"); } + + /** + * Return the PropertyValue appropriate to the property + * of the argument. The value returned is the current value of the + * font characteristic, named by propName, defined on the + * system font named by font. propName must be one of + * characteristic properties in the expansion set of the font + * shorthand property; PropertySets.fontExpansion. + * @param property int index of the property for the + * PropertyValue to be returned. + * @param font String name of the system font + * @param propName String name of font characteristic whose + * current value is to be returned. + * @exception FunctionNotImplementedException + * @exception PropertyException if the property is not appropriate or + * if any other errors occur in the processing of the property + */ + public static PropertyValue systemFontCharacteristic + (int Property, String font, String propName) + throws FunctionNotImplementedException, PropertyException + { + throw new FunctionNotImplementedException("system-font"); + } + + /** + * Expand the font shorthand property defined for a named + * system font, by providing a PropertyValueList containing + * one element for each property expansion from the font + * shorthand. Individual values are derived by calling + * SystemFontFunction.systemFontCharacteristic for each + * property in the expansion. + * @param property int index of the property for the + * PropertyValue to be returned. + * @param font String name of the system font + * @return PropertyValueList containing a list of + * PropertyValues, one for each property in the expansion of + * the font shorthand property. + * @exception PropertyException + */ + public static PropertyValueList expandFontSHand + (int property, String font) + throws PropertyException + { + // Get the array of indices of the properties in the + // expansion of this shorthand + ROIntArray expansion = PropertySets.fontExpansion; + PropertyValueList list = new PropertyValueList(property); + for (int i = 0; i < expansion.length; i++) { + list.add(systemFontCharacteristic(expansion.get(i), font)); + } + return list; + } } -- 2.39.5