Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading two fonts causes corruption #56

Open
thetooth opened this issue Jan 19, 2024 · 0 comments
Open

Loading two fonts causes corruption #56

thetooth opened this issue Jan 19, 2024 · 0 comments

Comments

@thetooth
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant