font fallback?
This commit is contained in:
@@ -11,6 +11,14 @@ namespace anm2ed::resource
|
||||
pointer = ImGui::GetIO().Fonts->AddFontFromMemoryTTF(data, length, size, &config);
|
||||
}
|
||||
|
||||
Font::Font(const char* path, int size, int number)
|
||||
{
|
||||
ImFontConfig config;
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
config.FontNo = number;
|
||||
pointer = ImGui::GetIO().Fonts->AddFontFromFileTTF(path, size);
|
||||
}
|
||||
|
||||
void Font::append(void* data, size_t length, int size)
|
||||
{
|
||||
ImFontConfig config;
|
||||
@@ -19,6 +27,15 @@ namespace anm2ed::resource
|
||||
ImGui::GetIO().Fonts->AddFontFromMemoryTTF(data, length, size, &config);
|
||||
}
|
||||
|
||||
bool Font::append(const char* path, int size, int number)
|
||||
{
|
||||
ImFontConfig config;
|
||||
config.MergeMode = true;
|
||||
config.FontDataOwnedByAtlas = false;
|
||||
config.FontNo = number;
|
||||
return ImGui::GetIO().Fonts->AddFontFromFileTTF(path, size, &config);
|
||||
}
|
||||
|
||||
Font::~Font()
|
||||
{
|
||||
if (get()) ImGui::GetIO().Fonts->RemoveFont(pointer);
|
||||
|
||||
@@ -47321,7 +47321,9 @@ namespace anm2ed::resource
|
||||
public:
|
||||
Font();
|
||||
Font(void*, size_t, int);
|
||||
Font(const char* path, int size, int number = 0);
|
||||
void append(void*, size_t, int);
|
||||
bool append(const char* path, int size, int number = 0);
|
||||
~Font();
|
||||
ImFont* get();
|
||||
Font& operator=(Font&&) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user