On 24/06/14 16:30, Jonas Sicking wrote:
I don't understand why anyone would want to key gets and sets using
FontFace instances. I.e. why would you want to ever call
fontFaceSet.has(myFontFace). That returning false doesn't really tell
you anything about what fonts are or are not loaded.

It tells you whether they're available to the document, though. (But true enough I'm not sure how often one would need to do that.)

For get() operations (including has()) you likely want to pass in a
url-string or a family name as key. For delete() operations passing in
a FontFace object might make sense, but passing in a url-string or a
family name is probably as commonly useful.

So document.fonts.has("http://something/";) would mean "are there any font faces active that have that URL at any position in its [[Urls]]". That'd be equivalent to "are there any @font-face rules that have that URL at any position in its src descriptor". I'm not sure how useful that would be.

I can see passing in a family name and getting back the list of faces that are active for that family name being useful. It's not too hard to do without a method for it though:

  [f for (f of document.fonts) if f.family == "SuperFont"]

assuming document.fonts is iterable.

FontFace objects pretty much correspond to the same thing as @font-face rules but without a style sheet representation. FontFaceSet is the set of FontFaces (@font-face rules) that are available to the document (currently in a style sheet). And the FontFaceSet defines a set of families each of which has one or more faces.

I think we at least need to be able to add/remove individual FontFace objects, so having at least add() and delete() makes sense to me.

If family names are required to be unique, then maybe keying on family
name for both get() and delete() operations is the way to go.

No you can have multiple faces for a given family.

The alternative I suppose is to have document.fonts be keyed on families, and their values would be a set of faces. But I think the current design of exposing a flat set of faces works well enough.

Either way, these are the things that would be great to sort out.
Right now it feels to me like everyone is acting like the spec is
done, when in fact a good chunk of the API surface is still missing.

As I said, I'll write to www-style with what I end up feeling works. But if you feel like the design should differ markedly from "add/has/delete methods that take FontFaces, and an iterator to get at them", feel free to start a thread on www-style.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to