|
14 | 14 | Load .TTF file with:
|
15 | 15 |
|
16 | 16 | ImGuiIO& io = ImGui::GetIO();
|
17 |
| - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels); |
| 17 | + io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels); |
18 | 18 |
|
19 | 19 | Detailed options:
|
20 | 20 |
|
21 | 21 | ImFontConfig config;
|
22 | 22 | config.OversampleH = 3;
|
23 | 23 | config.OversampleV = 3;
|
24 | 24 | config.GlyphExtraSpacing.x = 1.0f;
|
25 |
| - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config); |
| 25 | + io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, &config); |
26 | 26 |
|
27 | 27 | Combine two fonts into one:
|
28 | 28 |
|
|
34 | 34 | ImFontConfig config;
|
35 | 35 | config.MergeMode = true;
|
36 | 36 | io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges);
|
37 |
| - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config, io.Fonts->GetGlyphRangesJapanese()); |
| 37 | + io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, &config, io.Fonts->GetGlyphRangesJapanese()); |
38 | 38 |
|
39 | 39 | Add a fourth parameter to bake specific font ranges only:
|
40 | 40 |
|
41 | 41 | // Basic Latin, Extended Latin
|
42 |
| - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesDefault()); |
| 42 | + io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesDefault()); |
43 | 43 |
|
44 | 44 | // Include full set of about 21000 CJK Unified Ideographs
|
45 |
| - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesJapanese()); |
| 45 | + io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesJapanese()); |
46 | 46 |
|
47 | 47 | // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
48 |
| - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesChinese()); |
| 48 | + io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels, NULL, io.Fonts->GetGlyphRangesChinese()); |
49 | 49 |
|
50 | 50 | Offset font vertically by altering the io.Font->DisplayOffset value:
|
51 | 51 |
|
52 |
| - ImFont* font = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels); |
| 52 | + ImFont* font = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels); |
53 | 53 | font->DisplayOffset.y += 1; // Render 1 pixel down
|
54 | 54 |
|
55 | 55 | ---------------------------------
|
|
0 commit comments