@@ -206,15 +206,15 @@ export function areFontAdvancesMonospace(advances: readonly number[]): boolean {
206206/**
207207 * Probing a family is up to 32 measureText calls, and setting the canvas font
208208 * to a new family string forces engine font matching on top, so verdicts are
209- * kept keyed by the normalized family list. A failure always names a resolved
210- * face and is final. A pass may be the generic fallback speaking for a face
211- * that has not loaded yet, so it is only kept once the family resolves;
212- * until then every call probes again, which is what lets the terminal
213- * revalidate after a late face loads and still reject a proportional one.
209+ * kept keyed by the normalized family list. Until every family in the list
210+ * resolves, the verdict may be a fallback speaking for a face that has not
211+ * loaded yet, so it is not kept and each call probes again. That is what lets
212+ * the terminal revalidate after a late face loads and still reject a
213+ * proportional one.
214214 */
215215export function createCachedFamilyProbe (
216216 probe : ( families : string ) => boolean ,
217- resolves : ( families : string ) => boolean ,
217+ resolves : ( family : string ) => boolean ,
218218) : ( family : string ) => boolean {
219219 const verdicts = new Map < string , boolean > ( ) ;
220220 return ( family ) => {
@@ -223,7 +223,8 @@ export function createCachedFamilyProbe(
223223 const cached = verdicts . get ( families ) ;
224224 if ( cached !== undefined ) return cached ;
225225 const verdict = probe ( families ) ;
226- if ( ! verdict || resolves ( families ) ) verdicts . set ( families , verdict ) ;
226+ // Names never contain a comma (the input was split on it), so this is exact.
227+ if ( families . split ( ", " ) . every ( resolves ) ) verdicts . set ( families , verdict ) ;
227228 return verdict ;
228229 } ;
229230}
0 commit comments