Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4f6f6aa
@ font-face font-weight descriptor per https://www.w3.org/TR/2021/WD-…
ylafon Sep 13, 2021
b5cb6e5
fix the 'auto' single value case
ylafon Sep 13, 2021
dd5021b
@​font-face font-stretch descriptor per https://www.w3.org/TR/2021/WD…
ylafon Sep 13, 2021
cddac56
forgot number check...
ylafon Sep 13, 2021
2937875
@​font-face font-style descriptor per https://www.w3.org/TR/2021/WD-c…
ylafon Sep 13, 2021
9a7a5f6
@ font-face font-weight descriptor per https://www.w3.org/TR/2021/WD-…
ylafon Sep 13, 2021
dc1f3f5
fix the 'auto' single value case
ylafon Sep 13, 2021
614ae37
@​font-face font-stretch descriptor per https://www.w3.org/TR/2021/WD…
ylafon Sep 13, 2021
a333b54
forgot number check...
ylafon Sep 13, 2021
e00ae04
@​font-face font-style descriptor per https://www.w3.org/TR/2021/WD-c…
ylafon Sep 13, 2021
0371dc7
Merge branch 'font-face-4' of github.com:w3c/css-validator into font-…
ylafon Sep 20, 2021
4d03595
@ font-face font-weight descriptor per https://www.w3.org/TR/2021/WD-…
ylafon Sep 13, 2021
7c94d60
fix the 'auto' single value case
ylafon Sep 13, 2021
5534c15
@​font-face font-stretch descriptor per https://www.w3.org/TR/2021/WD…
ylafon Sep 13, 2021
98a78be
forgot number check...
ylafon Sep 13, 2021
4a0040c
@​font-face font-style descriptor per https://www.w3.org/TR/2021/WD-c…
ylafon Sep 13, 2021
4055d67
Merge branch 'font-face-4' of github.com:w3c/css-validator into font-…
ylafon Sep 24, 2021
122e3d5
@​font-face font-named-instance per https://www.w3.org/TR/2021/WD-css…
ylafon Sep 24, 2021
f1b1587
@​font-face ascent-override per https://www.w3.org/TR/2021/WD-css-fon…
ylafon Sep 25, 2021
00e961d
@​font-face descent-override per https://www.w3.org/TR/2021/WD-css-fo…
ylafon Sep 25, 2021
1608148
@​font-face line-gap-override per https://www.w3.org/TR/2021/WD-css-f…
ylafon Sep 25, 2021
3615cac
@​font-face unicode-range per https://www.w3.org/TR/2021/WD-css-fonts…
ylafon Sep 25, 2021
b11e994
@​font-face font-language-override per https://www.w3.org/TR/2021/WD-…
ylafon Sep 25, 2021
ba50fee
@​font-face font-family per https://www.w3.org/TR/2021/WD-css-fonts-4…
ylafon Sep 25, 2021
aecdbb0
@​font-face font-feature-settings per https://www.w3.org/TR/2021/WD-c…
ylafon Sep 25, 2021
f54ccbe
set ident check to public to be reused in fontface
ylafon Sep 25, 2021
cb6c2a8
@​font-face font-variation-settings per https://www.w3.org/TR/2021/WD…
ylafon Sep 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
@​font-face line-gap-override per https://www.w3.org/TR/2021/WD-css-f…
  • Loading branch information
ylafon committed Sep 25, 2021
commit 1608148ba7677a813f2ad38fb9581751360f2d25
118 changes: 118 additions & 0 deletions org/w3c/css/properties/css/fontface/CssLineGapOverride.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2021.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.css.properties.css.fontface;

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

/**
* @since CSS3
*/
public class CssLineGapOverride extends CssProperty {

public CssValue value;

/**
* Create a new CssLineGapOverride
*/
public CssLineGapOverride() {
}

/**
* Creates a new CssLineGapOverride
*
* @param expression The expression for this property
* @throws InvalidParamException
* Expressions are incorrect
*/
public CssLineGapOverride(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

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

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "line-gap-override";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.fontFaceCssLineGapOverride != null) {
style.addRedefinitionWarning(ac, this);
}
s.fontFaceCssLineGapOverride = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssLineGapOverride &&
value.equals(((CssLineGapOverride) property).value));
}


/**
* 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 ((Css3Style) style).getFontFaceCssLineGapOverride();
} else {
return ((Css3Style) style).fontFaceCssLineGapOverride;
}
}
}

13 changes: 12 additions & 1 deletion org/w3c/css/properties/css3/Css3Style.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
import org.w3c.css.properties.css.fontface.CssFontStretch;
import org.w3c.css.properties.css.fontface.CssFontStyle;
import org.w3c.css.properties.css.fontface.CssFontWeight;
import org.w3c.css.properties.css.fontface.CssLineGapOverride;
import org.w3c.css.properties.css.viewport.CssMaxZoom;
import org.w3c.css.properties.css.viewport.CssMinZoom;
import org.w3c.css.properties.css.viewport.CssOrientation;
Expand Down Expand Up @@ -590,6 +591,7 @@ public class Css3Style extends ATSCStyle {
public CssFontNamedInstance fontFaceCssFontNamedInstance;
public CssAscentOverride fontFaceCssAscentOverride;
public CssDescentOverride fontFaceCssDescentOverride;
public CssLineGapOverride fontFaceCssLineGapOverride;

public CssColorAdjust cssColorAdjust;
public CssForcedColorAdjust cssForcedColorAdjust;
Expand Down Expand Up @@ -1309,7 +1311,16 @@ public CssDescentOverride getFontFaceCssDescentOverride() {
}
return fontFaceCssDescentOverride;
}


public CssLineGapOverride getFontFaceCssLineGapOverride() {
if (fontFaceCssLineGapOverride == null) {
fontFaceCssLineGapOverride =
(CssLineGapOverride) style.CascadingOrder(new CssLineGapOverride(),
style, selector);
}
return fontFaceCssLineGapOverride;
}

public CssFontNamedInstance getFontFaceCssFontNamedInstance() {
if (fontFaceCssFontNamedInstance == null) {
fontFaceCssFontNamedInstance =
Expand Down
90 changes: 90 additions & 0 deletions org/w3c/css/properties/css3/fontface/CssLineGapOverride.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2018.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css3.fontface;

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

/**
* @spec https://www.w3.org/TR/2021/WD-css-fonts-4-20210729/#descdef-font-face-line-gap-override
*/
public class CssLineGapOverride extends org.w3c.css.properties.css.fontface.CssLineGapOverride {

public static final CssIdent[] allowed_values;

static {
String[] _allowed_values = {"normal"};
allowed_values = new CssIdent[_allowed_values.length];
int i = 0;
for (String s : _allowed_values) {
allowed_values[i++] = CssIdent.getIdent(s);
}
}

public static CssIdent getAllowedIdent(CssIdent ident) {
for (CssIdent id : allowed_values) {
if (id.equals(ident)) {
return id;
}
}
return null;
}

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

/**
* Creates a new CssLineGapOverride
*
* @param expression The expression for this property
* @throws InvalidParamException Expressions are incorrect
*/
public CssLineGapOverride(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
if (check && expression.getCount() > 1) {
throw new InvalidParamException("unrecognize", ac);
}

setByUser();

char op;
CssValue val;

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

switch (val.getType()) {
case CssTypes.CSS_PERCENTAGE:
value = val;
break;
case CssTypes.CSS_IDENT:
if (getAllowedIdent(val.getIdent()) != null) {
value = val;
break;
}
default:
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
expression.next();
}

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

}