1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-14 19:17:48 +01:00
imgui/extra_fonts/README.txt

31 lines
1.1 KiB
Plaintext
Raw Normal View History

2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
---------------------------------
EXTRA FONTS FOR IMGUI
---------------------------------
2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
ImGui embeds a copy of 'ProggyClean.ttf' that you can use without any external files.
2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
Load .TTF file with:
2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
ImGuiIO& io = ImGui::GetIO();
io.Font = new ImFont();
io.Font->LoadFromFileTTF("myfontfile.ttf", size_pixels);
Add a third parameter to bake specific font ranges:
2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
io.Font->LoadFromFileTTF("myfontfile.ttf", size_pixels, ImFont::GetGlyphRangesDefault()); // Basic Latin, Extended Latin
io.Font->LoadFromFileTTF("myfontfile.ttf", size_pixels, ImFont::GetGlyphRangesJapanese()); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
io.Font->LoadFromFileTTF("myfontfile.ttf", size_pixels, ImFont::GetGlyphRangesChinese()); // Japanese + full set of about 21000 CJK Unified Ideographs
2014-09-26 02:20:56 +02:00
2015-01-09 00:49:17 +01:00
Offset font by altering the io.Font->DisplayOffset value:
2014-09-26 02:20:56 +02:00
2015-01-09 00:49:17 +01:00
io.Font->DisplayOffset.y += 1; // Render 1 pixel down
2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
-----------------------------------
RECOMMENDED SIZES
-----------------------------------
2014-08-30 21:02:55 +02:00
2015-01-09 00:49:17 +01:00
ProggyTiny.ttf Size: 10.0f Offset: Y: +1
ProggyClean.ttf Size: 13.0f Offset: Y: +1