diff --git a/source b/source index 91a98c390ef..d03ada738ef 100644 --- a/source +++ b/source @@ -65274,6 +65274,7 @@ interface mixin CanvasPathDrawingStyles { interface mixin CanvasTextDrawingStyles { // text + attribute DOMString lang; // (default: "inherit") attribute DOMString font; // (default 10px sans-serif) attribute CanvasTextAlign textAlign; // (default: "start") attribute CanvasTextBaseline textBaseline; // (default: "alphabetic") @@ -65738,6 +65739,7 @@ context.fillRect(100,0,50,50); // only this square remains data-x="dom-context-2d-shadowOffsetX">shadowOffsetX, shadowOffsetY, shadowBlur, lang, font, textAlign, textBaseline,
Text styles
+
context.lang [ = value ]
+
styles.lang [ = value ]
+
+

Returns the current language setting.

+ +

Can be set, to change the language used when resolving fonts. The syntax and valid values + are the same as those for the lang element attribute, or the + value "inherit".

+ +

The default is "inherit", which uses the lang of the + canvas element, or the Document associated with a Worker when there is no + canvas element, or a user-agent default language when neither source exists.

+
+
context.font [ = value ]
styles.font [ = value ]
@@ -66410,15 +66426,56 @@ worker.postMessage(offscreenCanvas, [offscreenCanvas]); Notice that the font is only loaded inside the worker, and not in the document context.

+

The choice of fonts and glyphs within a font may vary according to the lang + IDL attribute. On setting, lang must be + a valid BCP 47 language tag or the string "inherit". + To determine the used value + for lang, use the following steps:

+ +
    +
  1. If object's lang value is + "inherit", then

    +
      +
    1. If object's font style source object is a canvas + element, then return the element's lang atribute + value.

    2. + +
    3. +

      Otherwise, object's font style source object is an + OffscreenCanvas object:

      + +
        +
      1. Let global be object's relevant global + object.

      2. + +
      3. If global is a Window object, then return the + lang attribute from global's + associated Document.

      4. + +
      5. Otherwise, return a user-agent-defined default lang.

      6. +
      +
    4. +
    +
  2. Otherwise, the used value is the lang + value.

  3. +
+ +

The lang IDL attribute, on getting, must return + the current value.

+

The font IDL attribute, on setting, must be parsed as a CSS <'font'> value (but without supporting property-independent style sheet syntax like 'inherit'), and the resulting font - must be assigned to the context, with the 'line-height' component forced to 'normal', - with the 'font-size' component converted to CSS pixels, - and with system fonts being computed to explicit values. If the new value is syntactically - incorrect (including using property-independent style sheet syntax like 'inherit' or 'initial'), - then it must be ignored, without assigning a new font value. CSS

+ must be assigned to the context, with the primary language set to the used-value for lang, with the 'line-height' + component forced to 'normal', with the 'font-size' component converted to CSS pixels, and with system fonts being computed to explicit values. If the + new value is syntactically incorrect (including using property-independent style sheet syntax + like 'inherit' or 'initial'), then it must be ignored, without assigning a new font value. + CSS

Font family names must be interpreted in the context of the font style source object when the font is to be used; any fonts embedded using

inherit -

Default to the directionality of the canvas element or Document - as appropriate.

+

Use the following process to determine which direction to treat input to the text preparation algorithm

+ +
    +
  1. If object's font style source object is a canvas + element:

    + +
      +
    1. If dir attribute of the element is + auto then use the element's computed value of + 'direction' as the direction.

    2. + +
    3. Otherwise, use the value of the dir attribute of the element + as the direction.

    4. +
    + +
  2. +

    Otherwise, object's font style source object is an + OffscreenCanvas object:

    + +
      +
    1. Let global be object's relevant global + object.

    2. + +
    3. If global is a Window object:

      +
        +
      1. Let Document be the global's + associated Document.

      2. + +
      3. If the value of the dir attribute from + Document is auto then use the + Document's computed value of 'direction' + as the direction.

      4. + +
      5. Otherwise, use the value of the dir attribute from + Document as the direction.

      6. +
      +
    4. + +
    5. Otherwise, treat input to the text preparation algorithm as left-to-right text.

    6. +
    +
  3. +
+

The fontKerning attribute's allowed keywords @@ -146515,6 +146613,7 @@ INSERT INTERFACES HERE Ştefan Vargyas, Stefan Weiss, Steffen Meschkat, + Stephen Chenney, Stephen Ma, Stephen Stewart, Stephen White,