WICG / local-font-access

Web API for enumerating fonts on the local system
https://wicg.github.io/local-font-access
Apache License 2.0
77 stars 16 forks source link

Create a definition for getting fonts from the system #53

Closed jakearchibald closed 2 years ago

jakearchibald commented 3 years ago

Right now the spec says "For each local font font on the system".

I think it'd be better to create definitions for this. Eg:

Font metadata has:

A system font is a font that is available system-wide by the operating system.

To read a system font as a font representation… (this lets you detail the kinds of filtering a browser may perform here)

To get all system font metadata, perform the following steps:

  1. Let |fonts| be a subset of [=system fonts=] [=read as font representations=]. Subsetting may be defined by the user agent, and can include safelists, or a selection UI shown to the user.
  2. Let |fontMetadatas| be a new list.
  3. [=For each=] |font| of |fonts|:
    1. Let |metadata| be a new [=font metadata=].
    2. Set |metadata|'s [=postscript name=] to…
    3. Etc etc
  4. Sort |fontMetadatas| by…
  5. Return |fontMetadatas|.