Re: [css-font-loading] how/when do FontFace objects end up in a FontFaceSet

On Wed, Mar 19, 2014 at 11:15 PM, John Daggett <jdaggett@mozilla.com> wrote:
> >From a previous post:
>> >> Hmmm, I think we should go the other way. Have load() return a promise
>> >> and leave ready() as it was. The ready() method is the only way to
>> >> passively observe individual font loads using Promises (e.g. a user
>> >> altering a textfield may induce the loading of a fallback font).
>> >
>> > Is there a reason to passively observe an individual font using
>> > promises?  I can't think of any good ones, and the lack can be hacked
>> > around by using the events.
>>
>> Well, I don't think we should try and predict exactly when authors
>> would use promises vs. when they would use events. I can imagine
>> scenarios where they would use a mixture of font preloading and lazy
>> loading, especially if situations with user-driven content.  If the
>> promises are used to respond to font availability then I don't think
>> it makes sense to distinguish active loads vs. passive loads. So I
>> think the ready() method makes sense and it makes the FontFace
>> interface match FontFaceSet interface which is a good thing.
>
> Just to emphasize, I don't think removing ready() from FontFace is the
> right thing to do here, it forces authors who want to passively listen
> for individual font loads (rather than explicitly loading them) to use
> an event listener. I think they shouldn't be required to use events.

On the other hand, FontFaceSet#ready() does something related, but
substantially different.  (It doesn't return the same promise every
time; the promises it returns can fulfill at different times.)  The
fact that the two methods had *close* but not *identical* semantics
was apparently confusing, at least according to some internal feedback
I got on the issue.

If you can come up with a different name, I'd be happy to add the
promise back to FontFace.  Other feedback suggested that, since this
does always return the same Promise, it should be an attribute rather
than a method.  Maybe .loaded?

~TJ

Received on Tuesday, 25 March 2014 00:18:45 UTC