Skip to content

Commit e736860

Browse files
committed
[css-font-loading] Make the check() function differentiate between 'your font faces don't exist' and 'none of your fonts will render that example text'.
1 parent e7c8fc3 commit e736860

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -716,13 +716,18 @@ Events</h3>
716716
and add them to <var>matched font faces</var>.
717717
The use of the {{FontFace/unicodeRange}} attribute means that this may be more than just a single font face.
718718

719+
<li>
720+
If <var>matched font faces</var> is empty,
721+
set the <var>found faces</var> flag to false.
722+
Otherwise, set it to true.
723+
719724
<li>
720725
For each font face in <var>matched font faces</var>,
721726
if its defined 'unicode-range' does not include the codepoint of at least one character in <var>text</var>,
722727
remove it from the list.
723728

724729
<li>
725-
Return <var>matched font faces</var>.
730+
Return <var>matched font faces</var> and the <var>found faces</var> flag.
726731
</ol>
727732

728733
<!--
@@ -766,7 +771,8 @@ The <code>load()</code> method</h3>
766771
<li>
767772
<a>Find the matching font faces</a> from <var>font face set</var>
768773
using the {{FontFaceSet/load()/font}} and {{FontFaceSet/load()/text}} arguments passed to the function,
769-
and let <var>font face list</var> be the return value.
774+
and let <var>font face list</var> be the return value
775+
(ignoring the <var>found faces</var> flag).
770776
If a syntax error was returned,
771777
reject <var>promise</var> with a SyntaxError exception
772778
and terminate these steps.
@@ -817,18 +823,20 @@ The <code>check()</code> method</h3>
817823
<a>Find the matching font faces</a> from <var>font face set</var>
818824
using the {{FontFaceSet/check()/font}} and {{FontFaceSet/check()/text}} arguments passed to the function,
819825
and including system fonts,
820-
and let <var>font face list</var> be the return value.
826+
and let <var>font face list</var> be the returned list of font faces,
827+
and <var>found faces</var> be the returned <var>found faces</var> flag.
821828
If a syntax error was returned,
822829
throw a SyntaxError exception
823830
and terminate these steps.
824831

825832
<li>
826-
If the <var>font face list</var> contains no font faces,
827-
return <code>false</code>.
833+
If <var>found faces</var> is false,
834+
throw an XXX error
835+
and abort this algorithm.
828836

829837
<li>
830-
If all fonts in the <var>font face list</var> have a {{FontFace/status}} attribute of "loaded",
831-
or are system fonts,
838+
If <var>font face list</var> is empty,
839+
or all fonts in the <var>font face list</var> either have a {{FontFace/status}} attribute of "loaded" or are system fonts,
832840
return <code>true</code>.
833841
Otherwise, return <code>false</code>.
834842
</ol>

0 commit comments

Comments
 (0)