W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2012

2002/css-validator/org/w3c/css/properties/css3 CssFontSynthesis.java,NONE,1.1 Css3Style.java,1.25,1.26

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 08 Aug 2012 21:05:44 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1SzDRo-0002Lr-BP@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv8777/w3c/css/properties/css3

Modified Files:
	Css3Style.java 
Added Files:
	CssFontSynthesis.java 
Log Message:
font-synthesis per http://www.w3.org/TR/2011/WD-css3-fonts-20111004/#propdef-font-synthesis

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- Css3Style.java	8 Aug 2012 10:02:08 -0000	1.25
+++ Css3Style.java	8 Aug 2012 21:05:40 -0000	1.26
@@ -30,6 +30,7 @@
 import org.w3c.css.properties.css.CssColumns;
 import org.w3c.css.properties.css.CssFontKerning;
 import org.w3c.css.properties.css.CssFontLanguageOverride;
+import org.w3c.css.properties.css.CssFontSynthesis;
 import org.w3c.css.properties.css.CssFontVariantCaps;
 import org.w3c.css.properties.css.CssFontVariantPosition;
 import org.w3c.css.properties.css.CssOpacity;
@@ -147,6 +148,7 @@
 	public CssFontLanguageOverride cssFontLanguageOverride;
 	public CssFontVariantCaps cssFontVariantCaps;
 	public CssFontVariantPosition cssFontVariantPosition;
+	public CssFontSynthesis cssFontSynthesis;
 
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -1594,6 +1596,15 @@
 		return cssFontVariantPosition;
 	}
 
+	public CssFontSynthesis getFontSynthesis() {
+		if (cssFontSynthesis == null) {
+			cssFontSynthesis =
+					(CssFontSynthesis) style.CascadingOrder(
+							new CssFontSynthesis(), style, selector);
+		}
+		return cssFontSynthesis;
+	}
+
 	public CssTextIndentCSS3 getTextIndentCSS3() {
 		if (cssTextIndentCSS3 == null) {
 			cssTextIndentCSS3 =

--- NEW FILE: CssFontSynthesis.java ---
// $Id: CssFontSynthesis.java,v 1.1 2012/08/08 21:05:41 ylafon Exp $
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css3;

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.CssTypes;
import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssValueList;

import java.util.ArrayList;

/**
 * @spec http://www.w3.org/TR/2011/WD-css3-fonts-20111004/#propdef-font-synthesis
 */
public class CssFontSynthesis extends org.w3c.css.properties.css.CssFontSynthesis {

	public static final CssIdent style;
	public static final CssIdent weight;

	static {
		style = CssIdent.getIdent("style");
		weight = CssIdent.getIdent("weight");
	}

	/**
	 * Create a new CssFontSynthesis
	 */
	public CssFontSynthesis() {
		value = initial;
	}

	/**
	 * Creates a new CssFontSynthesis
	 *
	 * @param expression The expression for this property
	 * @throws org.w3c.css.util.InvalidParamException
	 *          Expressions are incorrect
	 */
	public CssFontSynthesis(ApplContext ac, CssExpression expression, boolean check)
			throws InvalidParamException {

		if (check && expression.getCount() > 2) {
			throw new InvalidParamException("unrecognize", ac);
		}

		setByUser();

		CssValue val;
		char op;

		val = expression.getValue();
		op = expression.getOperator();

		if (val.getType() == CssTypes.CSS_IDENT) {
			CssIdent ident = (CssIdent) val;
			if (inherit.equals(ident)) {
				value = inherit;
			} else if (none.equals(ident)) {
				value = none;
			} else if (weight.equals(ident)) {
				if (expression.getCount() > 1) {
					if (op != CssOperator.SPACE) {
						throw new InvalidParamException("operator",
								((new Character(op)).toString()), ac);
					}
					expression.next();
					val = expression.getValue();
					if (!style.equals(val)) {
						throw new InvalidParamException("value",
								val.toString(),
								getPropertyName(), ac);
					}
					ArrayList<CssValue> v = new ArrayList<CssValue>(2);
					v.add(style);
					v.add(weight);
					value = new CssValueList(v);
				} else {
					value = weight;
				}
			} else if (style.equals(ident)) {
				if (expression.getCount() > 1) {
					if (op != CssOperator.SPACE) {
						throw new InvalidParamException("operator",
								((new Character(op)).toString()), ac);
					}
					expression.next();
					val = expression.getValue();
					if (!weight.equals(val)) {
						throw new InvalidParamException("value",
								val.toString(),
								getPropertyName(), ac);
					}
					ArrayList<CssValue> v = new ArrayList<CssValue>(2);
					v.add(style);
					v.add(weight);
					value = new CssValueList(v);
				} else {
					value = style;
				}
			} else {
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
			}
		} else {
			throw new InvalidParamException("value",
					val.toString(),
					getPropertyName(), ac);
		}
		expression.next();
	}

	public CssFontSynthesis(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}

}
Received on Wednesday, 8 August 2012 21:05:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:50 UTC