mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 13:37:00 +00:00
Doc: Fixed comments referring to LoadFromFileTTF() instead of AddFontFromFileTTF() (#2153)
This commit is contained in:
parent
2e6e1bec58
commit
1441756a0f
@ -775,15 +775,15 @@ CODE
|
|||||||
config.OversampleV = 1;
|
config.OversampleV = 1;
|
||||||
config.GlyphOffset.y -= 2.0f; // Move everything by 2 pixels up
|
config.GlyphOffset.y -= 2.0f; // Move everything by 2 pixels up
|
||||||
config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters
|
config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters
|
||||||
io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, &config);
|
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config);
|
||||||
|
|
||||||
// Combine multiple fonts into one (e.g. for icon fonts)
|
// Combine multiple fonts into one (e.g. for icon fonts)
|
||||||
static ImWchar ranges[] = { 0xf000, 0xf3ff, 0 };
|
static ImWchar ranges[] = { 0xf000, 0xf3ff, 0 };
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.MergeMode = true;
|
config.MergeMode = true;
|
||||||
io.Fonts->AddFontDefault();
|
io.Fonts->AddFontDefault();
|
||||||
io.Fonts->LoadFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); // Merge icon font
|
io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); // Merge icon font
|
||||||
io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs
|
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs
|
||||||
|
|
||||||
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||||||
A: When loading a font, pass custom Unicode ranges to specify the glyphs to load.
|
A: When loading a font, pass custom Unicode ranges to specify the glyphs to load.
|
||||||
|
@ -694,7 +694,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
||||||
// Please use u8"text in any language" in your application!
|
// Please use u8"text in any language" in your application!
|
||||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
||||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->LoadFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
||||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||||
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
||||||
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
||||||
|
Loading…
Reference in New Issue
Block a user