Skip to content

Cannot load twemoji color font #6607

Closed
Closed
@misuke0

Description

@misuke0

Version/Branch of Dear ImGui:

Version: 1.89.7
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx11.cpp + imgui_impl_win32.cpp
Compiler: Visual Studio 2022
Operating System: Windows

My Issue/Question:

I cannot load the twemoji font (https://github.com/twitter/twemoji), I followed the instructions here: https://github.com/ocornut/imgui/blob/master/docs/FONTS.md#using-colorful-glyphsemojis. With seguiemj.ttf it works but not with twemoji.

ImGuiIO& io = ImGui::GetIO();
auto font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18);

static ImWchar ranges[] = { 0x1, 0x1FFFF, 0 };
static ImFontConfig cfg;
cfg.OversampleH = cfg.OversampleV = 1;
cfg.MergeMode = true;
cfg.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_LoadColor;
io.Fonts->AddFontFromFileTTF("c:\\users\\misuke\\downloads\\TwitterColorEmoji-SVGinOT.ttf", 18f, &cfg, ranges);

It throws an exception in imgui_freetype.cpp (https://github.com/ocornut/imgui/blob/master/misc/freetype/imgui_freetype.cpp#L247):

IM_ASSERT(slot->format == FT_GLYPH_FORMAT_OUTLINE || slot->format == FT_GLYPH_FORMAT_BITMAP);

If I remove this assertion, the font atlas contains only a few icons from twemoji
Screenshots/Video

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions