imgui/extra_fonts/README.txt

31 lines
1.1 KiB
Plaintext
Raw Normal View History

2014-08-30 19:02:55 +00:00
2015-01-08 23:49:17 +00:00
---------------------------------
EXTRA FONTS FOR IMGUI
---------------------------------
2014-08-30 19:02:55 +00:00
2015-01-08 23:49:17 +00:00
ImGui embeds a copy of 'ProggyClean.ttf' that you can use without any external files.
2014-08-30 19:02:55 +00:00
2015-01-08 23:49:17 +00:00
Load .TTF file with:
2014-08-30 19:02:55 +00:00
2015-01-08 23:49:17 +00: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 19:02:55 +00:00
2015-01-08 23:49:17 +00: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 00:20:56 +00:00
2015-01-08 23:49:17 +00:00
Offset font by altering the io.Font->DisplayOffset value:
2014-09-26 00:20:56 +00:00
2015-01-08 23:49:17 +00:00
io.Font->DisplayOffset.y += 1; // Render 1 pixel down
2014-08-30 19:02:55 +00:00
2015-01-08 23:49:17 +00:00
-----------------------------------
RECOMMENDED SIZES
-----------------------------------
2014-08-30 19:02:55 +00:00
2015-01-08 23:49:17 +00:00
ProggyTiny.ttf Size: 10.0f Offset: Y: +1
ProggyClean.ttf Size: 13.0f Offset: Y: +1