Skip to main content

Crate egui_cjk_font

Crate egui_cjk_font 

Source
Expand description

egui-cjk-font

A lightweight utility crate that loads a suitable system CJK font for egui / eframe applications on Windows, macOS, and Linux.

§Design goals

  • Automatically selects native platform UI fonts
  • Activates only for CJK locales (zh / ja / ko)
  • Provides two APIs to navigate egui’s font initialization constraints

§Two usage modes

This crate provides two APIs with different guarantees:

  • load_cjk_font: Safe to call at any time (including before Context::run()), but does not merge with existing font configuration.

  • merge_cjk_font: Merges a CJK font into the existing egui font configuration, but must be called after the first Context::run().

§Important notes

Due to egui API constraints, it is not possible to safely inspect existing font configuration before the first frame is rendered. As a result, merging fonts before Context::run() is fundamentally unsupported by egui.

Choose the API that best matches your application’s initialization flow.

Functions§

load_cjk_font
Load a suitable system CJK font into the egui context.
merge_cjk_font
Merge a suitable system CJK font into the existing egui font configuration.