Skip to content

tinyfont.WriteLine renders wrong glyphs for missing codepoints #58

Closed

Description

@rdon-key

When trying to render characters that are not included in the font, instead of skipping or showing a placeholder (e.g. □), the renderer draws an incorrect glyph from a different character.
In this case, for "①②③④⑤", only ①–③ are included in the font. However, ④ (U+2463) and ⑤ (U+2464) incorrectly display as "字" (U+5B57).

Environment

  • TinyGo × TinyFont × WebAssembly (browser rendering)
  • Example font snippet (only ①–③ are registered):
"\x00\x24\x60" + "\x00\x10\x3F" + // ① U+2460
"\x00\x24\x61" + "\x00\x10\x6F" + // ② U+2461
"\x00\x24\x62" + "\x00\x10\x9F" + // ③ U+2462
"\x00\x5B\x57" + "\x00\x10\xCF" + // 字 U+5B57

Steps to Reproduce

  1. Prepare a font with only ①②③ and "字" registered.
  2. Run:
tinyfont.WriteLine(target, &testfont, 10, 50, "①②③④⑤", color.RGBA{0, 0, 0, 255})

  1. Observe the output.
Image

Expected Behavior

  • Unregistered characters (④⑤) should not be drawn, or should render as a placeholder (e.g., □ or ?).
  • At minimum, they should not render as a completely unrelated glyph.

Actual Behavior

  • Output shows: ①②③字字
  • Unregistered ④⑤ are replaced with the glyph for "字".

Impact

  • Any unregistered character may render as a wrong but valid glyph.
  • This can lead to confusing or misleading text output, especially in UI or educational use cases where accuracy of glyphs is critical.
  • The issue is not limited to circled numbers; any missing codepoint can incorrectly map to the glyph of a different registered character.

Activity

  1. rdon-key commented on May 27, 2026

    @rdon-key
    ContributorAuthor

    This appears to have been fixed by #59 and included in 0.7.0.
    Closing this issue as resolved. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions