tangram icon indicating copy to clipboard operation
tangram copied to clipboard

Error loading external fonts

Open ianthetechie opened this issue 4 years ago • 3 comments

TANGRAM VERSION:

Tangram v0.21.1

ENVIRONMENT:

macOS Big Sur running Firefox 83.

TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:

Add an external font to my scene file like so:

fonts:
  Open Sans Regular: external

RESULT:

Tangram v0.21.1 [error]: Scene.load() failed to load "scene.yaml": can't assign to property "url" on "external": not an object TypeError: can't assign to property "url" on "external": not an object

EXPECTED RESULT:

Per https://tangrams.readthedocs.io/en/master/Syntax-Reference/fonts/#external, it looks like external fonts are supported via this syntax. However, it looks like the current JS (https://github.com/tangrams/tangram/blob/990d2608c7dce2c3801c2cfd676e5c2e5b74c743/src/scene/scene_loader.js#L131) now assumes that there will be an object with a URL property.

ianthetechie avatar Dec 15 '20 07:12 ianthetechie

Yikes, you're right, external fonts do appear to have been broken for some quite awhile 😬 It's an easy fix. I almost wonder if this functionality should just be deprecated, but it does have a logical use, for example in cases where you have brand-specific font you're already loading in your app and don't want to duplicate resources.

bcamper avatar Dec 19 '20 01:12 bcamper

Fixed in master but usually keep issues open until shipped in a production release.

bcamper avatar Dec 19 '20 02:12 bcamper

No worries. I'm not convinced I need the feature either, but I was trying some stuff out and noticed that it was busted ;) Thanks for the quick fix!

ianthetechie avatar Dec 20 '20 04:12 ianthetechie