Skip to content

Commit

Permalink
fix handling of external font definitions
Browse files Browse the repository at this point in the history
fixes #771
  • Loading branch information
bcamper committed Dec 19, 2020
1 parent e8f5dde commit 6743110
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/scene/scene_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,11 @@ const SceneLoader = {
normalizeFonts(config, bundle) {
config.fonts = config.fonts || {};

for (const family in config.fonts) {
if (Array.isArray(config.fonts[family])) {
config.fonts[family].forEach(face => {
face.url = face.url && bundle.urlFor(face.url);
});
}
else {
const face = config.fonts[family];
face.url = face.url && bundle.urlFor(face.url);
}
// Add scene base path for URL-based fonts (skip "external" fonts referencing CSS-loaded resources)
const fonts = Object.values(config.fonts).filter(face => face !== 'external');
for (const face of fonts) {
const faces = (Array.isArray(face) ? face : [face]); // can be single value or array
faces.forEach(face => face.url = bundle.urlFor(face.url));
}

return config;
Expand Down

0 comments on commit 6743110

Please sign in to comment.