Skip to content

Loading two fonts causes corruption #56

Open
@thetooth

Description

@thetooth

When using two fonts on a single plot only the first loaded texture appears to be getting bound.

	async function loadFont(name: string): Promise<Font> {
		try {
			const img = new Image()
			img.src = URL.createObjectURL(await fetch(`./${name}.png`).then((res) => res.blob()))
			const config = await fetch(`./${name}.json`).then((res) => res.json())

			return new Font(cg, img, config)
		} catch (e) {
			console.log('Failed to load custom font, loading default font')
			return createDefaultFont(cg)
		}
	}

I'm using the above and passing the created Font objects to Text instances, you can see below that the glyph information from the second font is being applied to the first font's texture. I had a look through the font and text implementation but can't find anything obvious.
download (10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions