feat(chat): render emoji in messages and user text (Q12)
Merge a monochrome Noto Emoji subset into the text fonts so chat messages, the composer, contact names, and memos render emoji (😀 🎉 ❤ 🔥 👍 …) instead of tofu. - Enable IMGUI_USE_WCHAR32 (imconfig.h): emoji live above the BMP (U+1F300+), so 16-bit ImWchar literally can't address them. This widens ImWchar build-wide; the only ImWchar uses in-tree are glyph-range arrays and one BMP private-use codepoint, so nothing else is affected. Tests + full build pass. - Bundle res/fonts/NotoEmoji-Subset.ttf — the OFL monochrome Noto Emoji (color CBDT/COLR fonts can't be rasterized by ImGui's stb_truetype) pinned to wght=400 and subset to the emoji planes (1411 glyphs, 747 KB). Reproducible via scripts/build_emoji_subset.py. Embedded via INCBIN like the CJK subset. - Typography::loadFont merges it (MergeMode) only into the small text fonts (Body/Subtitle/Caption/Button) — not headers, which don't need 1400 emoji. The base font keeps precedence for U+2600–26FF, so text-style symbols stay. Limits: ImGui does no shaping, so single-codepoint emoji render but ZWJ sequences (family/profession) and regional-indicator flags won't compose; emoji are monochrome (the OS emoji picker still inputs them fine, and the composer byte counter already counts their 4-byte UTF-8 cost against the on-chain cap). Verified headless: sizeof(ImWchar)==4 and every probed emoji is in-font and bakes into the atlas. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,7 +67,8 @@
|
||||
//#define IMGUI_USE_LEGACY_CRC32_ADLER
|
||||
|
||||
//---- Use 32-bit for ImWchar (default is 16-bit) to support Unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
|
||||
//#define IMGUI_USE_WCHAR32
|
||||
//---- Enabled so chat can render emoji (U+1F300+, above the BMP) — see Typography::loadFont emoji merge (Q12).
|
||||
#define IMGUI_USE_WCHAR32
|
||||
|
||||
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
||||
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
|
||||
|
||||
Reference in New Issue
Block a user