Skip to content

cvcGL: colour emoji and the symbols UI fonts lack, from bundled fonts (DejaVu Sans Mono, Twemoji) - #1056

Merged
transfix merged 2 commits into
masterfrom
feat/imgui-color-emoji
Nov 8, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/imgui-color-emoji

Conversation

@transfix

@transfix transfix commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Emoji, and the symbols most UI fonts lack, in the ImGui hosts: arigl, and the arigl-web page nicotina runs in, where a post's 💯 and the feed's ↩ ⇄ ♥ drew as ?.

Bundled fonts (src/cvcGL/fonts, with their licences and a README). They install to share/libcvc/fonts with cvcGL, are copied into the build tree, and are embedded at /usr/share/libcvc/fonts in the browser hosts (arigl-web, ariglx-web, cyprty). The overlay finds them in CVC_UI_FONT_DIR, beside the module holding cvcGL (<bin or lib>/../share/libcvc/fonts), or at the install's data directory.

  • DejaVu Sans Mono 2.37 (340 KB).
    • It is the UI font where nothing else resolves: the browser, which has no system fonts and used ImGui's ASCII-only face. It keeps the monospace look the pages had.
    • Under any other UI font it is merged as a fallback for arrows, symbols and box drawing.
  • Twemoji Mozilla 0.7.0 (1.4 MB, COLR/CPAL). Emoji in colour, merged under the UI font. Where none is bundled, the system's colour emoji font is used: Segoe UI Emoji, Apple Color Emoji or Noto Color Emoji.

Colour emoji need two things from imgui, which cy-pca/cvcpkg#571 (imgui 1.92.9+cvc.4) adds:

  • A 32-bit ImWchar. A 16-bit one can't hold a character past U+FFFF.
  • The FreeType loader as source. cvcGL compiles misc/freetype/imgui_freetype.cpp when the imgui package has it, against the FreeType the hosts already link (VTK's text), and ImGui draws colour glyphs.
  • ImGui then rasterises all its text with FreeType. imgui 1.92 can't give one font source a loader of its own that needs initialising.
  • With an older imgui cvcGL keeps stb_truetype and merges no emoji font; the DejaVu symbols work either way.

Golden images. ImGuiOverlay::setUiFontFallbacks(false) keeps stb_truetype and the UI font alone. cvcgl_ari_golden sets it, so its pixels don't move.

Smaller pieces.

  • ImGuiOverlay::loadUiFonts(io) loads the same fonts into a host's (or a test's) own ImGui context.
  • A static cvcGL re-finds FreeType in cvcGLConfig.cmake.
  • THIRD_PARTY_NOTICES records both fonts' licences. Twemoji's art is CC-BY 4.0, which asks for attribution.

Limits. ImGui doesn't shape text, so a ZWJ sequence (a family, a profession), a flag (two regional indicators) or a skin tone shows as its parts.

Checked (Windows, MSVC, shared, against cy-pca/cvcpkg#571's imgui built locally)

  • Configure reports "ImGui draws with FreeType (colour emoji)".
  • cvcgl_imgui_fonts:
    • ↩ ⇄ ♥ resolve;
    • U+1F4AF bakes at 32 px as a colour glyph.
  • An arigl snapshot draws these in colour:
    • 💯 😀 🎉 🔥 👍 🚀 🦀 ❤️ ✨ and the 🔒;
    • the counts' ↩ ⇄ ♥;
    • accented Latin, Greek and Cyrillic;
    • an emoji on a button.
  • The wasm build (lean arigl, imgui cvc.4 ahead of the wasm deps) also configures with FreeType. Its browser check will be added as a comment.

CI here installs imgui cvc.3 from cvcpkg.org, so it builds without the loader. The DejaVu symbols still apply, and the test's emoji part says SKIP. Colour emoji arrive with cvc.4's publish, which is a production release.

The browser pages need this and #1052 (text: emoji:) together, in a release, for nicotina's feed to show its emoji.

… (DejaVu Sans Mono, Twemoji)

A post's 💯 and a feed's ↩ ⇄ ♥ drew as '?' in the ImGui hosts, and the browser pages had only
ImGui's ASCII face.

- src/cvcGL/fonts: DejaVu Sans Mono 2.37 and Twemoji Mozilla 0.7.0 (COLR), with their licences
  (THIRD_PARTY_NOTICES too). Installed to share/libcvc/fonts, copied into the build tree, and
  embedded at /usr/share/libcvc/fonts in arigl-web, ariglx-web and cyprty. UiFonts finds them in
  CVC_UI_FONT_DIR, beside the module holding cvcGL, or at the install's data directory.
- The overlay's UI font falls back on DejaVu Sans Mono where nothing else resolves (the browser),
  and merges it under any other UI font for its symbols. Emoji: Twemoji, else the system's colour
  emoji font, merged with FreeType's colour glyphs.
- Colour glyphs need imgui's FreeType loader, which cvcpkg's imgui 1.92.9+cvc.4 ships as source
  with a 32-bit ImWchar: cvcGL compiles it when present, against the FreeType the hosts link, and
  ImGui then rasterises with FreeType. An older imgui keeps stb_truetype and no emoji font.
- setUiFontFallbacks(false) keeps stb_truetype and the UI font alone; cvcgl_ari_golden sets it.
  loadUiFonts(io) loads the same fonts into a host's own context. A static cvcGL re-finds FreeType.
- cvcgl_imgui_fonts: the symbols resolve, and with imgui cvc.4 U+1F4AF bakes as a colour glyph.
@transfix

transfix commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Checked in a browser too: a lean single-threaded arigl.wasm built from this branch against imgui 1.92.9+cvc.4 (cy-pca/cvcpkg#571) built for wasm locally, loaded through arigl-web's own page in headless Chrome.

  • The configure reports "ImGui draws with FreeType (colour emoji)".
  • The UI font is now the bundled DejaVu Sans Mono, so the page keeps its monospace look, where it used to be ImGui's ASCII-only face.
  • These draw in colour from the embedded Twemoji: 💯 😀 🎉 🔥 👍 🚀 🦀 ❤️ ✨, the 🔒, and an emoji on a button.
  • The feed counts' ↩ ⇄ ♥, accented Latin, Greek and Cyrillic, and ✓ ✗ → ← all draw.

…g> too

Windows CI builds with Visual Studio: its programs run from build/bin/Release, so share/libcvc/fonts
one level up wasn't there and cvcgl_imgui_fonts found no fallback font. Two levels up is tried too.
@transfix
transfix merged commit c951977 into master Nov 8, 2026
31 of 33 checks passed
@transfix
transfix deleted the feat/imgui-color-emoji branch November 8, 2026 14:01
transfix added a commit that referenced this pull request Nov 9, 2026
…i as the fallback (#1072)

imgui 1.92.9+cvc.4's 32-bit ImWchar (#1056's colour emoji need it) broke every published package
built against cvc.3: they name plain `imgui`, so fresh Linux and BSD installs resolved cvc.4 and
failed to load. cvc.4 is yanked, and the 32-bit build is now its own cvcpkg package, imgui-w32
(cy-pca/cvcpkg#575): headers in include/imgui-w32, libimgui-w32 (imgui-w32.lib on Windows), and
the cmake package imgui-w32 with the imgui-w32::imgui target, on every platform.

- src/cvcGL/CMakeLists.txt finds imgui-w32 first, then imgui (16-bit: emoji draw as '?'), then
  the config-less header/lib fallback, as before. The exported config re-finds whichever package
  cvcGL linked (find_dependency(imgui-w32) or imgui).
- The recipes that name imgui (cvcgl, arigl, ariglx, arigl-web, ariglx-web, libcvc-examples,
  libcvc-examples-web) name imgui-w32, so 3.7.13's bundles carry it in their required_deps, and
  no install can mix the two builds' ABIs. libcvc-examples' UI guard reads imgui-w32_DIR.
- ci.yml, publish-cvcpkg.yml, publish-cvcgl-wasm.yml and publish-pycvc-gl-wasm.yml install
  imgui-w32.
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

Successfully merging this pull request may close these issues.

1 participant