2002/css-validator/org/w3c/css/properties/css2/font Ascent.java,NONE,1.1 Baseline.java,NONE,1.1 Bbox.java,NONE,1.1 CapHeight.java,NONE,1.1 Centerline.java,NONE,1.1 Css2Style.java,NONE,1.1 DefinitionSrc.java,NONE,1.1 Descent.java,NONE,1.1 FontConstant.java,NONE,1.1 FontFamily.java,NONE,1.1 FontProperty.java,NONE,1.1 FontSize.java,NONE,1.1 FontStretch.java,NONE,1.1 FontStyle.java,NONE,1.1 FontVariant.java,NONE,1.1 FontWeight.java,NONE,1.1 Mathline.java,NONE,1.1 Panose1.java,NONE,1.1 Slope.java,NONE,1.1 Src.java,NONE,1.1 Stemh.java,NONE,1.1 Stemv.java,NONE,1.1 Topline.java,NONE,1.1 UnicodeRange.java,NONE,1.1 UnitsPerEm.java,NONE,1.1 Widths.java,NONE,1.1 XHeight.java,NONE,1.1

Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2/font
In directory hutz:/tmp/cvs-serv9948/font

Added Files:
	Ascent.java Baseline.java Bbox.java CapHeight.java 
	Centerline.java Css2Style.java DefinitionSrc.java Descent.java 
	FontConstant.java FontFamily.java FontProperty.java 
	FontSize.java FontStretch.java FontStyle.java FontVariant.java 
	FontWeight.java Mathline.java Panose1.java Slope.java Src.java 
	Stemh.java Stemv.java Topline.java UnicodeRange.java 
	UnitsPerEm.java Widths.java XHeight.java 
Log Message:
major reorganization of property files

--- NEW FILE: FontFamily.java ---
//
// $Id: FontFamily.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */

package org.w3c.css.properties.css2.font;

import java.util.Enumeration;
import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.util.Util;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssString;
import org.w3c.css.values.CssValue;

/** 
 */
public class FontFamily extends FontProperty implements CssOperator {
    
    Vector family_name = new Vector();

    /**
     * Create a new FontFamily
     */
    public FontFamily() {
    }  
    
    /**
     * Create a new FontFamily
     *
     * @param expression the font name
     * @exception InvalidParamException The expression is incorrect
     */
    public FontFamily(ApplContext ac, CssExpression expression, boolean check) 
	    throws InvalidParamException {
	boolean family = true;
	CssValue val = expression.getValue();
	char op;

	setByUser();
	//@@ and if name is already in the vector ?
	

	while (family) {
	    val = expression.getValue();
	    op = expression.getOperator();
	    
	    if ((op != COMMA) && (op != SPACE)) {
		throw new InvalidParamException("operator", 
						((new Character(op)).toString()),
						ac);
	    }
	    
	    if (val instanceof CssString) {
		if (op == COMMA) { // "helvetica", "roman"
		    String name = (String) val.get();
		    family_name.addElement(trimToOneSpace(name));
		    expression.next();
		} else { // "helvetica" CssValue
		    String name = (String) val.get();
		    family_name.addElement(trimToOneSpace(name));
		    family = false;
		    expression.next();
		}
	    } else if (val instanceof CssIdent) {
		if (op == COMMA) {
		    family_name.addElement(val.toString());
		    expression.next();
		} else {
		    CssValue next = expression.getNextValue();
		    
		    if (next instanceof CssIdent) {
			CssIdent New = new CssIdent(val.get() + " " 
						    + next.get());
			expression.remove();
			op = expression.getOperator();
			expression.remove();
			expression.insert(New);
			expression.setCurrentOperator(op);
		    } else {
			family_name.addElement(val.toString());
			expression.next();
			family = false;
		    }
		}
	    } else
		throw new InvalidParamException("value", expression.getValue(),
						getPropertyName(), ac);
	}
	
    }
    
    public FontFamily(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns all fonts name
     */  
    public Enumeration elements() {
	return family_name.elements();
    }
    
    /**
     * Returns the size
     */
    public int size() {
	return family_name.size();
    }
    
    /**
     * Returns the font (null if no font)
     */  
    public Object get() {
	if (family_name.size() == 0) {
	    return null;
	}
	return family_name.firstElement();
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {
	String r = "";
	for (Enumeration e = elements(); e.hasMoreElements();)
	    r += ", " + convertString(e.nextElement().toString());
	if (r.length() < 3) {
	    return null;
	}
	return r.substring(2);
    }
    
    String convertString (String value) {
	if (value.indexOf('"') != -1) {
	    return '\'' + value + '\'';
	} else if (value.indexOf('\'') != -1) {
	    return '"' + value + '"';	    
	} else {
	    return value;
	}
    }

    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "font-family";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;

	if (style0.fontFamily != null) {
	    style.addRedefinitionWarning(ac, this);
	}
	style0.fontFamily = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceFontFamily();
	} else {
	    return ((Css2Style) style).fontFamily;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	return false; //@@ FIXME
    }
    
    private static String trimToOneSpace(String name) {
	int count = name.length();
	char[] dst = new char[count];
	char[] src = new char[count];
	int index = -1;
	
	name.getChars(0, count, src, 0);
	for(int i=0; i < count; i++)
	    if ( i == 0 || ! Util.isWhiteSpace(src[i]) || 
		 ( Util.isWhiteSpace(src[i]) && 
		   !Util.isWhiteSpace(dst[index]) ) )
		dst[++index] = src[i];
	
	return new String(dst, 0, index+1);
    }
    
}

--- NEW FILE: Topline.java ---
//
// $Id: Topline.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Topline extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Topline
     */
    public Topline() {
	// nothing to do
    }
    
    /**
     * Creates a new Topline
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Topline(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Topline(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "topline";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.topline != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.topline = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getTopline();
	} else {
	    return ((Css2Style) style).topline;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: UnitsPerEm.java ---
//
// $Id: UnitsPerEm.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class UnitsPerEm extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new UnitsPerEm
     */
    public UnitsPerEm() {
	// nothing to do
    }
    
    /**
     * Creates a new UnitsPerEm
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public UnitsPerEm(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public UnitsPerEm(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "units-per-em";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.unitsPerEm != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.unitsPerEm = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getUnitsPerEm();
	} else {
	    return ((Css2Style) style).unitsPerEm;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Baseline.java ---
//
// $Id: Baseline.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Baseline extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Baseline
     */
    public Baseline() {
	// nothing to do
    }
    
    /**
     * Creates a new Baseline
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Baseline(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Baseline(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "baseline";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.baseline != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.baseline = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getBaseline();
	} else {
	    return ((Css2Style) style).baseline;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: CapHeight.java ---
//
// $Id: CapHeight.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class CapHeight extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new CapHeight
     */
    public CapHeight() {
	// nothing to do
    }
    
    /**
     * Creates a new CapHeight
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public CapHeight(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public CapHeight(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "cap-height";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.capHeight != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.capHeight = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getCapHeight();
	} else {
	    return ((Css2Style) style).capHeight;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Bbox.java ---
//
// $Id: Bbox.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class Bbox extends CssProperty {
    
    CssValue[] value = new CssValue[4];
    
    /**
     * Create a new Bbox
     */
    public Bbox() {
	// nothing to do
    }
    
    /**
     * Creates a new Bbox
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Bbox(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val;
	char op;
	int i = 0;
	setByUser();	

	val = expression.getValue();
	op = expression.getOperator();
	if (val instanceof CssNumber) {
	    value[i++] = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(),
					    getPropertyName(), ac);
	}
	if (op != CssOperator.COMMA || expression.end()) {
	    throw new InvalidParamException("few-value", 
					    getPropertyName(), ac);
	}

	val = expression.getValue();
	op = expression.getOperator();
	if (val instanceof CssNumber) {
	    value[i++] = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(),
					    getPropertyName(), ac);
	}
	if (op != CssOperator.COMMA || expression.end()) {
	    throw new InvalidParamException("few-value", 
					    getPropertyName(), ac);
	}

	val = expression.getValue();
	op = expression.getOperator();
	if (val instanceof CssNumber) {
	    value[i++] = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(),
					    getPropertyName(), ac);
	}
	if (op != CssOperator.COMMA || expression.end()) {
	    throw new InvalidParamException("few-value", 
					    getPropertyName(), ac);
	}

	val = expression.getValue();
	op = expression.getOperator();
	if (val instanceof CssNumber) {
	    value[i++] = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(),
					    getPropertyName(), ac);
	}
    }
    
    public Bbox(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value[0];
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret = "";
	for (int i = 0; i < 4; i++) {
	    ret += ", " + value[i];
	}
	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "bbox";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.bbox != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.bbox = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getBbox();
	} else {
	    return ((Css2Style) style).bbox;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: UnicodeRange.java ---
//
// $Id: UnicodeRange.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssUnicodeRange;
import org.w3c.css.values.CssValue;

/**
 */
public class UnicodeRange extends CssProperty {
    
    Vector values = new Vector();
    
    /**
     * Create a new UnicodeRange
     */
    public UnicodeRange() {
	// nothing to do
    }
    
    /**
     * Creates a new UnicodeRange
     *
     * @param expression the unicode range
     * @exception InvalidParamException values are incorrect
     */  
    public UnicodeRange(ApplContext ac, CssExpression expression,
	    boolean check) throws InvalidParamException {
	char op = expression.getOperator();
	CssValue val = expression.getValue();
	setByUser();

	do {
	    if (val instanceof CssUnicodeRange) {
		// nothing
	    } else {
		throw new InvalidParamException("value", expression.getValue(), 
						getPropertyName(), ac);
	    }
	    values.addElement(val);
	    op = expression.getOperator();
	    expression.next();
	} while (op == CssOperator.COMMA);
	
    }
    
    public UnicodeRange(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret ="";
	int i = 0;

	while (i < values.size()) {
	    ret += ", " + values.elementAt(i);
	    i++;
	}

	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "unicode-range";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.unicodeRange != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.unicodeRange = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceUnicodeRange();
	} else {
	    return ((Css2Style) style).unicodeRange;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: FontVariant.java ---
//
// $Id: FontVariant.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class FontVariant extends CssProperty implements FontConstant {
    
    Vector values = new Vector();
    
    private static CssIdent all = new CssIdent("all");

    /**
     * Create a new FontVariant
     */
    public FontVariant() {
	// nothing to do
    }
    
    /**
     * Creates a new FontVariant
     *
     * @param expression the font variant
     * @exception InvalidParamException values are incorrect
     */  
    public FontVariant(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	char op = expression.getOperator();
	CssValue val = expression.getValue();
	setByUser();

	do {
	    if (expression.getValue() instanceof CssIdent) {
		int hash = ((CssIdent) expression.getValue()).hashCode();
		int i = 0;
		for (; i<hash_values.length; i++) {
		    if (hash_values[i] == hash) {
			values.addElement(FONTVARIANT[i]);
			break;
		    }
		}
		if (i == FONTVARIANT.length) {
		    throw new InvalidParamException("value", 
						    expression.getValue(), 
						    getPropertyName(), ac);
		}
	    } else {
		throw new InvalidParamException("value", expression.getValue(), 
						getPropertyName(), ac);
	    }
	    op = expression.getOperator();
	    expression.next();
	} while (op == CssOperator.COMMA);
	
    }
    
    public FontVariant(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret ="";
	int i = 0;

	while (i < values.size()) {
	    ret += ", " + values.elementAt(i);
	    i++;
	}

	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "font-variant";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.fontVariant != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.fontVariant = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceFontVariant();
	} else {
	    return ((Css2Style) style).fontVariant;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
    private static int[] hash_values;
    
    static {
	hash_values = new int[FONTVARIANT.length];
	for (int i=0; i<FONTVARIANT.length; i++)
	    hash_values[i] = FONTVARIANT[i].hashCode();
    }
}

--- NEW FILE: Descent.java ---
//
// $Id: Descent.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Descent extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Descent
     */
    public Descent() {
	// nothing to do
    }
    
    /**
     * Creates a new Descent
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Descent(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Descent(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "descent";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.descent != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.descent = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getDescent();
	} else {
	    return ((Css2Style) style).descent;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: DefinitionSrc.java ---
//
// $Id: DefinitionSrc.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssURL;
import org.w3c.css.values.CssValue;

/**
 */
public class DefinitionSrc extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new DefinitionSrc
     */
    public DefinitionSrc() {
	// nothing to do
    }
    
    /**
     * Creates a new DefinitionSrc
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public DefinitionSrc(ApplContext ac, CssExpression expression,
	    boolean check) throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssURL) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public DefinitionSrc(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "definition-src";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.definitionSrc != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.definitionSrc = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getDefinitionSrc();
	} else {
	    return ((Css2Style) style).definitionSrc;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: FontProperty.java ---
//
// $Id: FontProperty.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */

package org.w3c.css.properties.css2.font;

import org.w3c.css.properties.css1.CssProperty;

/**
 * @version $Revision: 1.1 $
 */
public abstract class FontProperty extends CssProperty {

  /**
   * Returns true if the property is inherited
   */
  public boolean Inherited() {
    return false;
  }

}

--- NEW FILE: FontWeight.java ---
//
// $Id: FontWeight.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class FontWeight extends CssProperty implements FontConstant {
    
    Vector values = new Vector();
    
    private static CssIdent all = new CssIdent("all");

    /**
     * Create a new FontWeight
     */
    public FontWeight() {
	// nothing to do
    }
    
    /**
     * Creates a new FontWeight
     *
     * @param expression the font weight
     * @exception InvalidParamException values are incorrect
     */  
    public FontWeight(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	char op = expression.getOperator();
	CssValue val = expression.getValue();
	setByUser();

	if (val.equals(all)) {
	    values.addElement(all);
	    expression.next();
	    return;
	}

	do {
	    if (expression.getValue() instanceof CssIdent) {
		int hash = ((CssIdent) expression.getValue()).hashCode();
		int i = 0;
		for (; i<hash_values.length; i++) {
		    if (hash_values[i] == hash) {
			values.addElement(FONTWEIGHT[i]);
			break;
		    }
		}
		if (i == FONTWEIGHT.length) {
		    throw new InvalidParamException("value", 
						    expression.getValue(), 
						    getPropertyName(), ac);
		}
	    } else if (val instanceof CssNumber) {
		float valf = ((Float) val.get()).floatValue();
		int vali = (int) valf;
		if ((valf - (float) vali) == 0
		    && isCorrectWeight(vali)) {
		    values.addElement(val);
		} else {
		    throw new InvalidParamException("value", 
						    expression.getValue(), 
						    getPropertyName(), ac);
		}
	    } else {
		throw new InvalidParamException("value", expression.getValue(), 
						getPropertyName(), ac);
	    }
	    op = expression.getOperator();
	    expression.next();
	} while (op == CssOperator.COMMA);
	
    }
    
    public FontWeight(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret ="";
	int i = 0;

	while (i < values.size()) {
	    ret += ", " + values.elementAt(i);
	    i++;
	}

	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "font-weight";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.fontWeight != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.fontWeight = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceFontWeight();
	} else {
	    return ((Css2Style) style).fontWeight;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
    private boolean isCorrectWeight(int val) {
	val = val / 100;
	return val > 0 && val < 10;
    }
    
    private static int[] hash_values;
    
    static {
	hash_values = new int[FONTWEIGHT.length];
	for (int i=0; i<FONTWEIGHT.length; i++)
	    hash_values[i] = FONTWEIGHT[i].hashCode();
    }
}

--- NEW FILE: Css2Style.java ---
//
// $Id: Css2Style.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssPrinterStyle;

/**
 * @version $Revision: 1.1 $
 */
public class Css2Style extends org.w3c.css.properties.paged.Css2Style {

    FontFamily fontFamily;
    FontStyle fontStyle;
    FontVariant fontVariant;
    FontWeight fontWeight;
    FontStretch fontStretch;
    FontSize    fontSize;
    UnicodeRange    unicodeRange;
    UnitsPerEm unitsPerEm;
    Src src; 
    Panose1 panose1;
    Bbox bbox;
    Widths widths;
    Stemv stemv;
    Stemh stemh;
    Slope slope;
    CapHeight capHeight;
    XHeight xHeight;
    Ascent ascent;
    Descent descent;
    Baseline baseline;
    Centerline centerline;
    Mathline mathline;
    Topline topline;
    DefinitionSrc definitionSrc;

    /**
     * Get the font-family property
     */
    public final FontFamily getFaceFontFamily() {
        return fontFamily;
    }
    
    /**
     * Get the font-style property
     */
    public final FontStyle getFaceFontStyle() {
        return fontStyle;
    }
    
    /**
     * Get the font-variant property
     */
    public final FontVariant getFaceFontVariant() {
        return fontVariant;
    }
    
    /**
     * Get the font-weight property
     */
    public final FontWeight getFaceFontWeight() {
        return fontWeight;
    }
    
    /**
     * Get the font-stretch property
     */
    public final FontStretch getFaceFontStretch() {
        return fontStretch;
    }
    
    /**
     * Get the font-size property
     */
    public final FontSize getFaceFontSize() {
        return fontSize;
    }
    
    /**
     * Get the unicode-range property
     */
    public final UnicodeRange getFaceUnicodeRange() {
        return unicodeRange;
    }
    
    
    /**
     * Get the units-per-em property
     */
    public final UnitsPerEm getUnitsPerEm() {
        return unitsPerEm;
    }
    
    /**
     * Get the stemv property
     */
    public final Stemv getStemv() {
        return stemv;
    }
    
    /**
     * Get the src property
     */
    public final Src getSrc() {
        return src;
    }
    
    /**
     * Get the panose1 property
     */
    public final Panose1 getPanose1() {
        return panose1;
    }
    
    /**
     * Get the widths property
     */
    public final Widths getWidths() {
        return widths;
    }
 
    /**
     * Get the bbox property
     */
    public final Bbox getBbox() {
        return bbox;
    }
    
    /**
     * Get the stemh property
     */
    public final Stemh getStemh() {
        return stemh;
    }
    
    /**
     * Get the slope property
     */
    public final Slope getSlope() {
        return slope;
    }  
    
    /**
     * Get the ascent property
     */
    public final Ascent getAscent() {
        return ascent;
    }
    
    /**
     * Get the descent property
     */
    public final Descent getDescent() {
        return descent;
    }
    
    /**
     * Get the cap-height property
     */
    public final CapHeight getCapHeight() {
        return capHeight;
    }
    
    /**
     * Get the x-height property
     */
    public final XHeight getXHeight() {
        return xHeight;
    }

    /**
     * Get the baseline property
     */
    public final Baseline getBaseline() {
        return baseline;
    }
    
    /**
     * Get the centerline property
     */
    public final Centerline getCenterline() {
        return centerline;
    }
    
    /**
     * Get the mathline property
     */
    public final Mathline getMathline() {
        return mathline;
    }

    /**
     * Get the topline property
     */
    public final Topline getTopline() {
        return topline;
    }
    
    /**
     * Get the definition-src property
     */
    public final DefinitionSrc getDefinitionSrc() {
        return definitionSrc;
    }

    
    /**
     * Print this style.
     *
     * @param printer The printer interface.
     */  
    public void print(CssPrinterStyle printer) {
	super.print(printer);
	if (fontFamily != null) {
	    fontFamily.print(printer);
	}
	if (fontStyle != null) {
	    fontStyle.print(printer);
	}
	if (fontVariant != null) {
	    fontVariant.print(printer);
	}
	if (fontWeight != null) {
	    fontWeight.print(printer);
	}
	if (fontStretch != null) {
	    fontStretch.print(printer);
	}
	if (fontSize != null) {
	    fontSize.print(printer);
	}
	if (unitsPerEm != null) {
	    unitsPerEm.print(printer);
	}
	if (src != null) {
	    src.print(printer);
	}
	if (panose1 != null) {
	    panose1.print(printer);
	}
	if (widths != null) {
	    widths.print(printer);
	}
	if (bbox != null) {
	    bbox.print(printer);
	}
	if (stemv != null) {
	    stemv.print(printer);
	}
	if (stemv != null) {
	    stemv.print(printer);
	}
	if (stemh != null) {
	    stemh.print(printer);
	}
	if (slope != null) {
	    slope.print(printer);
	}
	if (ascent != null) {
	    ascent.print(printer);
	}
	if (descent != null) {
	    descent.print(printer);
	}
	if (capHeight != null) {
	    capHeight.print(printer);
	}
	if (xHeight != null) {
	    xHeight.print(printer);
	}
	if (baseline != null) {
	    baseline.print(printer);
	}
	if (centerline != null) {
	    centerline.print(printer);
	}
	if (mathline != null) {
	    mathline.print(printer);
	}
	if (topline != null) {
	    topline.print(printer);
	}
	if (definitionSrc != null) {
	    definitionSrc.print(printer);
	}
    }
}

--- NEW FILE: Slope.java ---
//
// $Id: Slope.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Slope extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Slope
     */
    public Slope() {
	// nothing to do
    }
    
    /**
     * Creates a new Slope
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Slope(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Slope(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "slope";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.slope != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.slope = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getSlope();
	} else {
	    return ((Css2Style) style).slope;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Stemv.java ---
//
// $Id: Stemv.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Stemv extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Stemv
     */
    public Stemv() {
	// nothing to do
    }
    
    /**
     * Creates a new Stemv
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Stemv(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Stemv(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "stemv";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.stemv != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.stemv = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getStemv();
	} else {
	    return ((Css2Style) style).stemv;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: FontConstant.java ---
//
// $Id: FontConstant.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 * $Log: FontConstant.java,v $
 * Revision 1.1  2005/08/23 16:33:50  ylafon
 * major reorganization of property files
 *
 * Revision 1.2  2002/04/08 21:17:08  plehegar
 * New
 *
 * Revision 1.3  1997/07/30 13:19:59  plehegar
 * Updated package
 *
 * Revision 1.2  1997/07/17 12:42:03  plehegar
 * Added font-weight
 *
 * Revision 1.1  1997/07/17 12:28:44  plehegar
 * Initial revision
 *
 */
package org.w3c.css.properties.css2.font;

/**
 * @version $Revision: 1.1 $
 */
public interface FontConstant {

  /**
   * Array of font-style values
   */  
  static String[] FONTSTYLE = { "normal", "italic", "oblique" };

  /**
   * Array of font-variant values
   */  
  static String[] FONTVARIANT = { "normal", "small-caps" };

  /**
   * Array of font-weight values
   */  
    static String[] FONTWEIGHT = { "normal", "bold" };
  
  /**
   * Array of font-stretch values
   */  
  static String[] FONTSTRETCH = { "normal", "wider", "narrower", 
				  "ultra-condensed", "extra-condensed", 
				  "condensed", "semi-condensed", 
				  "semi-expanded", "expanded", "extra-expanded",
				  "ultra-expanded", "inherit" };
  
}

--- NEW FILE: Mathline.java ---
//
// $Id: Mathline.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Mathline extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Mathline
     */
    public Mathline() {
	// nothing to do
    }
    
    /**
     * Creates a new Mathline
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Mathline(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Mathline(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "mathline";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.mathline != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.mathline = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getMathline();
	} else {
	    return ((Css2Style) style).mathline;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: FontStretch.java ---
//
// $Id: FontStretch.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class FontStretch extends CssProperty implements FontConstant {
    
    Vector values = new Vector();
    
    private static CssIdent all = new CssIdent("all");

    /**
     * Create a new FontStretch
     */
    public FontStretch() {
	// nothing to do
    }
    
    /**
     * Creates a new FontStretch
     *
     * @param expression the font stretch
     * @exception InvalidParamException values are incorrect
     */  
    public FontStretch(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	char op = expression.getOperator();
	CssValue val = expression.getValue();
	setByUser();

	if (val.equals(all)) {
	    values.addElement(all);
	    expression.next();
	    return;
	}

	do {
	    if (expression.getValue() instanceof CssIdent) {
		int hash = ((CssIdent) expression.getValue()).hashCode();
		int i = 0;
		for (; i<hash_values.length; i++) {
		    if (hash_values[i] == hash) {
			values.addElement(FONTSTRETCH[i]);
			break;
		    }
		}
		if (i == FONTSTRETCH.length) {
		    throw new InvalidParamException("value", 
						    expression.getValue(), 
						    getPropertyName(), ac);
		}
	    } else {
		throw new InvalidParamException("value", expression.getValue(), 
						getPropertyName(), ac);
	    }
	    op = expression.getOperator();
	    expression.next();
	} while (op == CssOperator.COMMA);
	
    }
    
    public FontStretch(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret ="";
	int i = 0;

	while (i < values.size()) {
	    ret += ", " + values.elementAt(i);
	    i++;
	}

	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "font-stretch";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.fontStretch != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.fontStretch = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceFontStretch();
	} else {
	    return ((Css2Style) style).fontStretch;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
    private static int[] hash_values;
    
    static {
	hash_values = new int[FONTSTRETCH.length];
	for (int i=0; i<FONTSTRETCH.length; i++)
	    hash_values[i] = FONTSTRETCH[i].hashCode();
    }
}

--- NEW FILE: Widths.java ---
//
// $Id: Widths.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssUnicodeRange;
import org.w3c.css.values.CssValue;

/**
 */
public class Widths extends CssProperty implements CssOperator {
    
    Vector values = new Vector();
    
    /**
     * Create a new Widths
     */
    public Widths() {
	// nothing to do
    }
    
    /**
     * Creates a new Widths
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Widths(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val;
	char op;
	int i = 0;
	setByUser();	

	do {
	    val = expression.getValue();
	    op = expression.getOperator();
	    if (val instanceof CssUnicodeRange) {
		values.addElement(val);
		if (op != SPACE) {
		    throw new InvalidParamException("operator", 
						    new Character(op),
						    getPropertyName(), ac);
		}
		if (expression.end()) {
		    throw new InvalidParamException("few-value", 
						    getPropertyName(), ac);
		}
		expression.next();		
	    }
	    do {
		op = expression.getOperator();
		val = expression.getValue();
		if (val instanceof CssNumber) {
		    values.addElement(" ");
		    values.addElement(val);
		} else {
		    throw new InvalidParamException("value", 
						    val,
						    getPropertyName(), ac);
		}
		expression.next();
	    } while ((op == SPACE) && !expression.end());
	    values.addElement(", ");
	} while (op == CssOperator.COMMA);

    }
    
    public Widths(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret = "";
	int i = 0;
	while (i < (values.size() - 2)) {
	    ret += values.elementAt(i);
	    i++;
	}
	return ret;
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "widths";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.widths != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.widths = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getWidths();
	} else {
	    return ((Css2Style) style).widths;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Ascent.java ---
//
// $Id: Ascent.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Ascent extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Ascent
     */
    public Ascent() {
	// nothing to do
    }
    
    /**
     * Creates a new Ascent
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Ascent(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Ascent(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "ascent";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.ascent != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.ascent = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getAscent();
	} else {
	    return ((Css2Style) style).ascent;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Panose1.java ---
//
// $Id: Panose1.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class Panose1 extends CssProperty {
    
    CssValue[] value = new CssValue[10];
    
    /**
     * Create a new Panose1
     */
    public Panose1() {
	// nothing to do
    }
    
    /**
     * Creates a new Panose1
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Panose1(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val;
	char op;
	int i = 0;
	setByUser();	

	do {
	    val = expression.getValue();
	    op = expression.getOperator();
	    if (val instanceof CssNumber) {
		value[i++] = val;
		expression.next();
	    } else {
		throw new InvalidParamException("value", expression.getValue(),
						getPropertyName(), ac);
	    }
	} while (!expression.end() 
		 && (op == CssOperator.SPACE)
		 && (i < 10));

	if (i != 10) {
	    throw new InvalidParamException("few-value", 
					    getPropertyName(), ac);
	}
    }
    
    public Panose1(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value[0];
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret = "";
	for (int i = 0; i < 10; i++) {
	    ret += " " + value[i];
	}
	return ret.substring(1);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "panose-1";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.panose1 != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.panose1 = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getPanose1();
	} else {
	    return ((Css2Style) style).panose1;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Stemh.java ---
//
// $Id: Stemh.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Stemh extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Stemh
     */
    public Stemh() {
	// nothing to do
    }
    
    /**
     * Creates a new Stemh
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Stemh(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Stemh(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "stemh";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.stemh != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.stemh = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getStemh();
	} else {
	    return ((Css2Style) style).stemh;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Src.java ---
//
// $Id: Src.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;
import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssFunction;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssString;
import org.w3c.css.values.CssURL;
import org.w3c.css.values.CssValue;

/**
 * @version $Revision: 1.1 $
 */
public class Src extends CssProperty 
        implements CssOperator {
    
    Vector values = new Vector();
    
    /**
     * Create a new CssSrc
     */
    public Src() {
    }
    
    /**
     * Create a new CssSrc
     *
     * @param expression The expression for this property
     * @exception InvalidParamException Values are incorrect
     */  
    public Src(ApplContext ac, CssExpression expression, boolean check) 
	    throws InvalidParamException {
	CssValue val;
	char op;
	
	setByUser();
	do {
	    val = expression.getValue();
	    op = expression.getOperator();
	    if (val instanceof CssURL) {
		values.addElement(val);
		expression.next();
		if (!expression.end() && (op == SPACE)
		    && (expression.getValue() instanceof CssFunction)) {
		    val = expression.getValue();
		    // @@ HACK
		    values.addElement(" ");
		    values.addElement(recognizeFormat(ac, (CssFunction) val));
		    op = expression.getOperator();
		    expression.next();
		}
	    } else if (val instanceof CssFunction) {
		values.addElement(recognizeFontFaceName(ac, (CssFunction) val));
		expression.next();
	    } else {
		throw new InvalidParamException("value", 
						val.toString(), 
						getPropertyName(), ac);
	    }
	    // @@HACK
	    values.addElement(", ");
	} while (op == COMMA);
    }
    
    public Src(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the value of this property
     */
    public Object get() {
	return null;
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "src";
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {
	String ret = "";
	int i = 0;
	while (i != (values.size() - 1)) {
	    ret += values.elementAt(i++);
	}
	return ret;
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.src != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.src = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getSrc();
	} else {
	    return ((Css2Style) style).src;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
    private CssFunction recognizeFormat(ApplContext ac, CssFunction val) 
	    throws InvalidParamException {
	if (val.getName().equals("format")) {
	    CssExpression params = val.getParameters();
	    char op;
	    params.starts();
	    do {
		op = params.getOperator();
		if (params.getValue() instanceof CssString) {
		    // nothing
		} else {		    
		    throw new InvalidParamException("format", 
						    val, 
						    getPropertyName(), ac);
		}
		params.next();
	    } while (op == COMMA);
	    if (!params.end()) { 
		throw new InvalidParamException("format", 
						val, 
						getPropertyName(), ac);
	    }
	    params.starts();
	    return val;
	} else {
	    throw new InvalidParamException("format", 
					    val, 
					    getPropertyName(), ac);
	}
    }

    private CssFunction recognizeFontFaceName(ApplContext ac, CssFunction func) 
	    throws InvalidParamException {
	if (func.getName().equals("local")) {
	    CssExpression params = func.getParameters();
	    char op;
	    params.starts();

	    if (params.getValue() instanceof CssString) {
		if (params.getCount() == 1) {
		    return func;
		} else {		    
		    throw new InvalidParamException("local", 
						    func, 
						    getPropertyName(), ac);
		}
	    }

	    do {
		op = params.getOperator();
		if (params.getValue() instanceof CssIdent) {
		    // nothing
		} else {		    
		    throw new InvalidParamException("local", 
						    func, 
						    getPropertyName(), ac);
		}
		params.next();
	    } while (op == COMMA);
	    if (!params.end()) { 
		throw new InvalidParamException("local", 
						func, 
						getPropertyName(), ac);
	    }
	    params.starts();
	    return func;
	} else {
	    throw new InvalidParamException("local", 
					    func, 
					    getPropertyName(), ac);
	}
    }
}

--- NEW FILE: XHeight.java ---
//
// $Id: XHeight.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class XHeight extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new XHeight
     */
    public XHeight() {
	// nothing to do
    }
    
    /**
     * Creates a new XHeight
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public XHeight(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public XHeight(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "x-height";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.xHeight != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.xHeight = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getXHeight();
	} else {
	    return ((Css2Style) style).xHeight;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: Centerline.java ---
//
// $Id: Centerline.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssValue;

/**
 */
public class Centerline extends CssProperty {
    
    CssValue value;
    
    /**
     * Create a new Centerline
     */
    public Centerline() {
	// nothing to do
    }
    
    /**
     * Creates a new Centerline
     *
     * @param expression the unicode em
     * @exception InvalidParamException values are incorrect
     */  
    public Centerline(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	CssValue val = expression.getValue();
	setByUser();

	if (val instanceof CssNumber) {
	    value = val;
	    expression.next();
	} else {
	    throw new InvalidParamException("value", expression.getValue(), 
					    getPropertyName(), ac);
	}
    }
    
    public Centerline(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return value;
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	return value.toString();
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "centerline";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.centerline != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.centerline = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getCenterline();
	} else {
	    return ((Css2Style) style).centerline;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: FontSize.java ---
//
// $Id: FontSize.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssLength;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class FontSize extends CssProperty implements FontConstant {
    
    Vector values = new Vector();
    
    private static CssIdent all = new CssIdent("all");

    /**
     * Create a new FontSize
     */
    public FontSize() {
	// nothing to do
    }
    
    /**
     * Creates a new FontSize
     *
     * @param expression the font size
     * @exception InvalidParamException values are incorrect
     */  
    public FontSize(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	char op = expression.getOperator();
	CssValue val = expression.getValue();
	setByUser();

	if (val.equals(all)) {
	    values.addElement(all);
	    expression.next();
	    return;
	}

	do {
	    if (val instanceof CssLength) {
		// nothing
	    } else if (val instanceof CssNumber) {
		values.addElement(((CssNumber) val).getLength());
	    } else {
		throw new InvalidParamException("value", expression.getValue(), 
						getPropertyName(), ac);
	    }
	    values.addElement(val);
	    op = expression.getOperator();
	    expression.next();
	} while (op == CssOperator.COMMA);
	
    }
    
    public FontSize(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret ="";
	int i = 0;

	while (i < values.size()) {
	    ret += ", " + values.elementAt(i);
	    i++;
	}

	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "font-size";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.fontSize != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.fontSize = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceFontSize();
	} else {
	    return ((Css2Style) style).fontSize;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
}

--- NEW FILE: FontStyle.java ---
//
// $Id: FontStyle.java,v 1.1 2005/08/23 16:33:50 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
/*
 */
package org.w3c.css.properties.css2.font;

import java.util.Vector;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;

/**
 */
public class FontStyle extends CssProperty implements FontConstant {
    
    Vector values = new Vector();
    
    private static CssIdent all = new CssIdent("all");

    /**
     * Create a new FontStyle
     */
    public FontStyle() {
	// nothing to do
    }
    
    /**
     * Creates a new FontStyle
     *
     * @param expression the font style
     * @exception InvalidParamException values are incorrect
     */  
    public FontStyle(ApplContext ac, CssExpression expression, boolean check)
    	throws InvalidParamException {
	char op = expression.getOperator();
	CssValue val = expression.getValue();
	setByUser();

	if (val.equals(all)) {
	    values.addElement(all);
	    expression.next();
	    return;
	}

	do {
	    if (expression.getValue() instanceof CssIdent) {
		int hash = ((CssIdent) expression.getValue()).hashCode();
		int i = 0;
		for (; i<hash_values.length; i++) {
		    if (hash_values[i] == hash) {
			values.addElement(FONTSTYLE[i]);
			break;
		    }
		}
		if (i == FONTSTYLE.length) {
		    throw new InvalidParamException("value", 
						    expression.getValue(), 
						    getPropertyName(), ac);
		}
	    } else {
		throw new InvalidParamException("value", expression.getValue(), 
						getPropertyName(), ac);
	    }
	    op = expression.getOperator();
	    expression.next();
	} while (op == CssOperator.COMMA);
	
    }
    
    public FontStyle(ApplContext ac, CssExpression expression)
	    throws InvalidParamException {
	this(ac, expression, false);
    }
    
    /**
     * Returns the current value
     */  
    public Object get() {
	return values.elementAt(0);
    }
    
    /**
     * Returns a string representation of the object.
     */
    public String toString() {  
	String ret ="";
	int i = 0;

	while (i < values.size()) {
	    ret += ", " + values.elementAt(i);
	    i++;
	}

	return ret.substring(2);
    }
    
    /**
     * Returns the name of this property
     */  
    public String getPropertyName() {
	return "font-style";
    }
    
    /**
     * Add this property to the CssStyle.
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	Css2Style style0 = (Css2Style) style;
	if (style0.fontStyle != null) {
	    style0.addRedefinitionWarning(ac, this);
	}
	style0.fontStyle = this;
    }
    
    /**
     * Get this property in the style.
     *
     * @param style The style where the property is
     * @param resolve if true, resolve the style to find this property
     */  
    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
	if (resolve) {
	    return ((Css2Style) style).getFaceFontStyle();
	} else {
	    return ((Css2Style) style).fontStyle;
	}
    }
    
    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */  
    public boolean equals(CssProperty property) {
	// @@TODO
	return false;
    }
    
    /**
     * Is the value of this property is a default value.
     * It is used by all macro for the function <code>print</code>
     */  
    public boolean isDefault() {
	return false;
    }
    
    private static int[] hash_values;
    
    static {
	hash_values = new int[FONTSTYLE.length];
	for (int i=0; i<FONTSTYLE.length; i++)
	    hash_values[i] = FONTSTYLE[i].hashCode();
    }
}

Received on Tuesday, 23 August 2005 16:34:30 UTC