Added sample fonts data
BIN
extra_fonts/ProggyClean.zip
Normal file
BIN
extra_fonts/ProggySmall.zip
Normal file
71
extra_fonts/README.txt
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
Extra fonts for ImGui.
|
||||||
|
THOSE FONTS ARE OPTIONAL.
|
||||||
|
|
||||||
|
ImGui embeds a copy of 'proggy_clean' that you can use without any external files.
|
||||||
|
Export your own font with bmfont (www.angelcode.com/products/bmfont).
|
||||||
|
|
||||||
|
bmfont reads fonts (.ttf, .fon, etc.) and output a .fnt file and a texture file, e.g:
|
||||||
|
|
||||||
|
proggy_clean.fon --> [bmfont] ---> proggy_clean_13.fnt
|
||||||
|
proggy_clean_13.png
|
||||||
|
|
||||||
|
Configure bmfont:
|
||||||
|
|
||||||
|
- Export .fnt as Binary
|
||||||
|
- Tip: uncheck "Render from TrueType outline" and "Font Smoothing" for best result with non-anti-aliased type fonts.
|
||||||
|
But you can experiment with other settings if you want anti-aliased fonts.
|
||||||
|
|
||||||
|
|
||||||
|
(A) Use font data embedded in ImGui
|
||||||
|
|
||||||
|
// Access embedded font data
|
||||||
|
const void* fnt_data; // pointer to FNT data
|
||||||
|
unsigned fnt_size; // size of FNT data
|
||||||
|
const void* png_data; // pointer to PNG data
|
||||||
|
unsigned int png_size; // size of PNG data
|
||||||
|
ImGui::GetDefaultFontData(&fnt_data, &fnt_size, &png_data, &png_size);
|
||||||
|
|
||||||
|
1. Load the .FNT data from 'fnt_data' (NB: this is done for you by default if you don't do anything)
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
io.Font = new ImBitmapFont();
|
||||||
|
io.Font->LoadFromMemory(fnt_data, fnt_size);
|
||||||
|
|
||||||
|
2. Load the .PNG data from 'png_data' into a texture
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(B) Use fonts from external files
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
1. Load the .FNT data, e.g.
|
||||||
|
|
||||||
|
// proggy_clean_13 [default]
|
||||||
|
io.Font->LoadFromFile("proggy_clean_13.fnt");
|
||||||
|
io.FontTexUvForWhite = ImVec2(0.0f/256.0f,0.0f/128);
|
||||||
|
io.FontYOffset = +1;
|
||||||
|
|
||||||
|
// proggy_small_12
|
||||||
|
io.Font = new ImBitmapFont();
|
||||||
|
io.Font->LoadFromFile("proggy_small_12.fnt");
|
||||||
|
io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64);
|
||||||
|
io.FontYOffset = +2;
|
||||||
|
|
||||||
|
// proggy_small_14
|
||||||
|
io.Font = new ImBitmapFont();
|
||||||
|
io.Font->LoadFromFile("proggy_small_14.fnt");
|
||||||
|
io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64);
|
||||||
|
io.FontYOffset = +3;
|
||||||
|
|
||||||
|
// courier_new_16
|
||||||
|
io.Font->LoadFromFile("courier_new_16.fnt");
|
||||||
|
io.FontTexUvForWhite = ImVec2(1.0f/256.0f,4.0f/128);
|
||||||
|
|
||||||
|
// courier_new_18
|
||||||
|
io.Font->LoadFromFile("courier_new_18.fnt");
|
||||||
|
io.FontTexUvForWhite = ImVec2(4.0f/256.0f,5.0f/256);
|
||||||
|
|
||||||
|
2. Load the matching .PNG data into a texture
|
||||||
|
|
BIN
extra_fonts/courier_new_16.fnt
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
extra_fonts/courier_new_16.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
extra_fonts/courier_new_18.fnt
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
extra_fonts/courier_new_18.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
extra_fonts/proggy_clean_13.fnt
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
extra_fonts/proggy_clean_13.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
extra_fonts/proggy_small_12.fnt
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
extra_fonts/proggy_small_12.png
Normal file
After Width: | Height: | Size: 949 B |
BIN
extra_fonts/proggy_small_14.fnt
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
extra_fonts/proggy_small_14.png
Normal file
After Width: | Height: | Size: 949 B |