Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable FreeType bitmap glyphs #3879

Closed
wants to merge 1 commit into from

Conversation

metarutaiga
Copy link

@metarutaiga metarutaiga commented Mar 5, 2021

This PR is support TTF bitmap for CJK.
We need it because the font is not clear when screen resolution is 1080P or below.
the freetype support bitmap, the stb_truetype don't support it yet.

Before :
B

Before : (Monochrome)
C

After :
A

Example code :

    ImFontConfig font_config;
    font_config.SizePixels = 13.0f;
    font_config.FontBuilderFlags = ImGuiFreeTypeBuilderFlags_Bitmap;
    io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\msgothic.ttc", 13.0f, &font_config, io.Fonts->GetGlyphRangesJapanese());

@Demonese
Copy link
Contributor

Demonese commented Mar 5, 2021

Nice, I'm using WenQuanYi and want to display bitmap glyphs (because of 800x600 LCD screen).
Thank you!

@ocornut
Copy link
Owner

ocornut commented Mar 5, 2021

Merged, thank you!
It's a little unclear to me how this affect sizes (via FT_SIZE_REQUEST_TYPE_NOMINAL vs FT_SIZE_REQUEST_TYPE_REAL_DIM) in different use cases... but at least works very well with msgothic.

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

Successfully merging this pull request may close these issues.

3 participants