Home Page
Search
\begin{md} ## ImGui 加载中文字库不全导致部分汉字无法显示 在项目中使用到了 ImGui 这个库,但是部分汉字显示不全,以 "?" 展示。查找后发现原因是为了减少加载时间,加载的汉字字库不全。 ``` c++ // 只加载2500个常用汉字 //io.Fonts->AddFontFromFileTTF("c:/Windows/Fonts/simhei.ttf", 16.f, nullptr, io.Fonts->GetGlyphRangesChineseSimplifiedCommon()); // 加载字体中的所有汉字 io.Fonts->AddFontFromFileTTF("c:/Windows/Fonts/simhei.ttf", 16.f, nullptr, io.Fonts->GetGlyphRangesChineseFull()); ``` **参考** - [解决Dear ImGUI无法显示中文的问题](https://www.joven.top/archives/192) \end{md}
Home Page