]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added 3 arg systemFontCharacteristic(). Added expandFontSHand().
authorPeter Bernard West <pbwest@apache.org>
Wed, 26 Jun 2002 15:59:46 +0000 (15:59 +0000)
committerPeter Bernard West <pbwest@apache.org>
Wed, 26 Jun 2002 15:59:46 +0000 (15:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@194922 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/expr/SystemFontFunction.java

index 5b426cdb568ae22cb6c5e8b6c1d215be4b65c09e..64ee465af5b779bd3de9e6c5317cfdeefeda07c8 100644 (file)
@@ -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 <tt>PropertyValue</tt> appropriate to the <em>property</em>
+     * of the argument.  <em>property</em> must be one of the font
+     * characteristic properties in the expansion set of the <em>font</em>
+     * shorthand property; <em>PropertySets.fontExpansion</em>.
+     * @param property <tt>int</tt> index of the font characteristic property
+     * to be returned.
+     * @param font <tt>String</tt> 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 <tt>PropertyValue</tt> appropriate to the <em>property</em>
+     * of the argument.  The value returned is the current value of the
+     * font characteristic, named by <em>propName</em>, defined on the
+     * system font named by <em>font</em>.  <em>propName</em> must be one of
+     * characteristic properties in the expansion set of the <em>font</em>
+     * shorthand property; <em>PropertySets.fontExpansion</em>.
+     * @param property <tt>int</tt> index of the property for the
+     * <tt>PropertyValue</tt> to be returned.
+     * @param font <tt>String</tt> name of the system font
+     * @param propName <tt>String</tt> 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 <em>font</em> shorthand property defined for a named
+     * system font, by providing a <tt>PropertyValueList</tt> containing
+     * one element for each property expansion from the <em>font</em>
+     * shorthand.  Individual values are derived by calling
+     * <em>SystemFontFunction.systemFontCharacteristic</em> for each
+     * property in the expansion.
+     * @param property <tt>int</tt> index of the property for the
+     * <tt>PropertyValue</tt> to be returned.
+     * @param font <tt>String</tt> name of the system font
+     * @return <tt>PropertyValueList</tt> containing a list of
+     *  <tt>PropertyValue</tt>s, one for each property in the expansion of
+     *  the <em>font</em> 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;
+    }
 }