Skip to content

[css-typed-om] Font Family Name doesn't uniquely identify a font face #405

Open
@wilddamon

Description

@wilddamon

https://drafts.css-houdini.org/css-typed-om/#fontfacevalue-objects

(Brought up by ksakamoto@ on my CL)

I'm not quire sure how |state| attribute should behave, as font family name does not uniquely identify font face.

For example, this defines two @font-face rules for 'Roboto', one for regular weight and one for bold. When only bold face is loaded, what |state| should return?

<style>
@font-face {
   font-family: 'Roboto';
   font-style: normal;
   font-weight: 400;
   src: url(https://fonts.gstatic.com/s/roboto/v16/CWB0XYA8bzo0kSThX0UTuA.woff2);
}

@font-face {
   font-family: 'Roboto';
   font-style: normal;
   font-weight: 700;
   src: url(https://fonts.gstatic.com/s/roboto/v16/d-6IYplOFocCacKzxwXSOFtXRa8TVwTICgirnJhmVJw.woff2);
}

div {
   font-family: 'Roboto';
   font-weight: 700;
}
</style>
<div>This text kicks load of the second @font-face</div>

<script>
document.fonts.ready.then(() => {
   document.fonts.forEach(face => {
      console.log(face.weight, face.status);  // 400 unloaded, 700 loaded
   });
   let f = new CSSFontFaceValue('Roboto');
   console.log(f.state);  // ???
});
</script>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions