Skip to content

Commit cbe748f

Browse files
committed
Website updates
1 parent aaa63cb commit cbe748f

11 files changed

Lines changed: 34 additions & 19 deletions

dist/en/main/examples/common.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/offscreen-canvas.worker.worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/offscreen-canvas.worker.worker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/tiled-layer-rendering-in-offscreen-canvas.worker.worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/tiled-layer-rendering-in-offscreen-canvas.worker.worker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/render/canvas.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/render/canvas.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,28 +227,43 @@ export const registerFont = (function () {
227227
*/
228228
async function isAvailable(fontSpec) {
229229
await fontFaceSet.ready;
230-
const fontFaces = await fontFaceSet.load(fontSpec);
231-
if (fontFaces.length === 0) {
232-
return false;
233-
}
234230
const font = getFontParameters(fontSpec);
235231
const checkFamily = font.families[0].toLowerCase();
236232
const checkWeight = font.weight;
237-
return fontFaces.some(
233+
/** @type {Array<FontFace>} */
234+
const matching = [];
235+
fontFaceSet.forEach(
238236
/**
239-
* @param {import('../css.js').FontParameters} f Font.
240-
* @return {boolean} Font matches.
237+
* @param {FontFace} f Font face.
241238
*/
242239
(f) => {
243240
const family = f.family.replace(/^['"]|['"]$/g, '').toLowerCase();
244241
const weight = fontWeights[f.weight] || f.weight;
245-
return (
242+
if (
246243
family === checkFamily &&
247244
f.style === font.style &&
248245
weight == checkWeight
249-
);
246+
) {
247+
matching.push(f);
248+
}
250249
},
251250
);
251+
if (matching.length === 0) {
252+
return false;
253+
}
254+
// Load each matching face with `FontFace.load()` instead of querying the
255+
// set with `FontFaceSet.load()`. The latter only resolves faces whose
256+
// `unicode-range` covers its (default) test string, so subset fonts -
257+
// e.g. those served by Google Fonts - would never be detected.
258+
const loaded = await Promise.all(
259+
matching.map((f) =>
260+
f.load().then(
261+
() => true, // available
262+
() => false, // not available
263+
),
264+
),
265+
);
266+
return loaded.some((available) => available);
252267
}
253268

254269
async function check() {

0 commit comments

Comments
 (0)