Re: [css-font-loading] load, check and testing for character coverage

> On Apr 1, 2016, at 1:29 PM, Edward O'Connor <eoconnor@apple.com> wrote:
> 
> Hi Tab,
> 
> You wrote:
> 
>> I have not so far heard *any* justification for why calling .check()
>> with a font that *does not exist* is something that an author would
>> want to do on purpose[…]
> 
> But earlier in the thread, John provided you with justification. You wrote:
> 
>>> The third case is that the search for matching font faces returns
>>> nothing, indicating that some of your sample characters can't be
>>> rendered by *any* of the fonts in the list. This is an error
>>> condition; either you misspelled your font names, or you're planning
>>> on using some characters that nothing can render. Either way, we
>>> definitely shouldn't return "true" (using that font string won't
>>> render like you expected), and probably shouldn't return "false"
>>> either (.load() won't do anything). This is why, near the end of the
>>> f2f, I suggested throwing in this case instead.
> 
> And John replied:
> 
>> It's not correct to say that it's an "error". Fontlists may or may not
>> cover the range of characters used. Look at the localization links at
>> the bottom of the Facebook landing page (www.facebook.com) for which
>> the fontlist is always 'arial, helvetica, lucida grande, sans-serif'.
>> For some of the items in the list, system font fallback will occur.
>> That's not an "error", that's the nature of fontlists in CSS.
>> 
>> The check() method is there simply to allow users to determine whether
>> all fonts that might need to be loaded have actually been loaded[…]
> 
> I find John's example to be a pretty compelling one.

I think part of the problem here is that check() is a terrible name for a function, since 
it’s hard to know what the return value means. Currently, it means “font is available or
additional loads won’t do anything”, but flipping this around allows the return value to mean
“additional load is required”, so the function could be better named as:

document.fonts.requiresLoad(…)

or 

document.fonts.requiresAdditionalLoad(...)

These make it clearer that no additional loads are going to help for a garbage font name.

Simon

Received on Friday, 1 April 2016 20:58:38 UTC