build(freetype): color-emoji rendering via a cross-platform FreeType backend
The chat "Emoji style: Color" option renders the merged emoji in color (COLR/CPAL Twemoji) instead of the monochrome NotoEmoji subset. This needs FreeType, which the default stb_truetype rasterizer can't do for color glyphs. - Vendor imgui_freetype (matches the bundled 1.92 ImFontLoader API) and embed a 1.4 MB COLRv0 Twemoji font (no libpng/harfbuzz needed). - CMake gains an optional FreeType path: native Linux/macOS use the system FreeType via find_package; the mingw-w64 cross-compile has none, so build.sh --win-release now cross-builds a minimal static FreeType (scripts/build-freetype-mingw.sh) and passes it in. Absent FreeType => graceful monochrome fallback, so no build breaks. - Typography selects the FreeType loader + the color font (LoadColor) when color emoji is on, else the stb loader + mono subset; toggling reloads the atlas. Both the DX11 and OpenGL backends already support the 1.92 RGBA dynamic atlas, so color glyphs render. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
15
build.sh
15
build.sh
@@ -725,12 +725,27 @@ HDR
|
||||
"$SCRIPT_DIR/scripts/fetch-libsodium.sh" --win
|
||||
fi
|
||||
|
||||
# ── FreeType for Windows (color-emoji rendering) ───────────────────────
|
||||
# The mingw toolchain ships no FreeType; cross-build a minimal static one (COLR/CPAL, no external
|
||||
# deps). Failure is non-fatal — the wallet just falls back to monochrome emoji.
|
||||
local FT_MINGW_PREFIX="$SCRIPT_DIR/third_party/freetype-mingw"
|
||||
if [[ ! -f "$FT_MINGW_PREFIX/lib/libfreetype.a" ]]; then
|
||||
info "Cross-building FreeType for Windows (color emoji) ..."
|
||||
"$SCRIPT_DIR/scripts/build-freetype-mingw.sh" "$FT_MINGW_PREFIX" \
|
||||
|| warn "FreeType cross-build failed — Windows build will use monochrome emoji"
|
||||
fi
|
||||
local FT_CMAKE_ARG=()
|
||||
if [[ -f "$FT_MINGW_PREFIX/lib/libfreetype.a" ]]; then
|
||||
FT_CMAKE_ARG=(-DDRAGONX_MINGW_FREETYPE_PREFIX="$FT_MINGW_PREFIX")
|
||||
fi
|
||||
|
||||
# ── CMake + build ────────────────────────────────────────────────────────
|
||||
info "Configuring (cross-compile) ..."
|
||||
cmake "$SCRIPT_DIR" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$bd/mingw-toolchain.cmake" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=OFF \
|
||||
"${FT_CMAKE_ARG[@]}" \
|
||||
"${CMAKE_LITE_ARGS[@]}"
|
||||
|
||||
info "Building with $JOBS jobs ..."
|
||||
|
||||
Reference in New Issue
Block a user