WICG / local-font-access

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

IDL mismatches spec for `query()` #32

Closed domenic closed 3 years ago

domenic commented 3 years ago

The IDL says that query() returns a FontIterator. However the spec algorithm for query() says that it returns a Promise<FontIterator>.

domenic commented 3 years ago

Hmm, the code examples seem to treat it as if it returns a FontIterator... but I'm not sure how you'd do the algorithm that way.

I guess you could move all the asynchronous permission-checking stuff into the first invocation of "get the next iterator result", and have query() just return a not-yet-initialized object? In that case I don't think it should be a method, but instead it should be something like navigator.fonts. (See also #33.)

annevk commented 3 years ago

This also confused me. Is there any reason this has to be an async iterator to begin with? I realize we don't want to load the individual fonts, but it seems gathering all the relevant font names + pointers to data can be done in a single request?

jakearchibald commented 3 years ago

I'd also like to see justification for this being an async iterator.

However, if there's good reason, I don't see an issue with the permission checking stuff happening on iteration. It's kinda nice that it can happen per iteration, as it can reject if permission is revoked.

https://github.com/WICG/local-font-access/issues/27 suggests we might want options to query(), or a method like matchAll(), so it might still make sense as a method rather than a property.

jakearchibald commented 3 years ago

Did some thinking around the async iterator stuff in https://github.com/WICG/local-font-access/issues/51

inexorabletash commented 3 years ago

No longer an async iterator.