Add better font support.
This commit is contained in:
parent
8125c18ae6
commit
47bba754f4
|
@ -38,7 +38,7 @@
|
|||
#include "imgui_freetype.h"
|
||||
#include "imgui_internal.h" // ImMin,ImMax,ImFontAtlasBuild*,
|
||||
#include <stdint.h>
|
||||
#include <freetype2/ft2build.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H // <freetype/freetype.h>
|
||||
#include FT_MODULE_H // <freetype/ftmodapi.h>
|
||||
#include FT_GLYPH_H // <freetype/ftglyph.h>
|
||||
|
|
17
kge.cc
17
kge.cc
|
@ -15,6 +15,9 @@
|
|||
#include "fonts/brassmono.h"
|
||||
|
||||
|
||||
static const float fontPixelSizes[] = {16, 10, 12, 14, 18};
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
|
@ -78,7 +81,19 @@ main()
|
|||
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
|
||||
ImGui_ImplOpenGL3_Init(glsl_version);
|
||||
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(B612Mono_Regular_compressed_data, B612Mono_Regular_compressed_size, 12);
|
||||
for (auto pixelSize : fontPixelSizes) {
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(BrassMono_Regular_compressed_data, BrassMono_Regular_compressed_size, pixelSize);
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(B612Mono_Regular_compressed_data, B612Mono_Regular_compressed_size, pixelSize);
|
||||
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(B612Mono_Bold_compressed_data, B612Mono_Bold_compressed_size, pixelSize);
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(BrassMono_Bold_compressed_data, BrassMono_Bold_compressed_size, pixelSize);
|
||||
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(B612Mono_BoldItalic_compressed_data, B612Mono_BoldItalic_compressed_size, pixelSize);
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(BrassMono_BoldItalic_compressed_data, BrassMono_BoldItalic_compressed_size, pixelSize);
|
||||
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(B612Mono_Italic_compressed_data, B612Mono_Italic_compressed_size, pixelSize);
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(BrassMono_Italic_compressed_data, BrassMono_Italic_compressed_size, pixelSize);
|
||||
}
|
||||
|
||||
bool done = false;
|
||||
bool show_demo_window = true;
|
||||
|
|
Loading…
Reference in New Issue