Skip to content

Conversation

@Marcos-D
Copy link
Contributor

This PR adds optional support for loading TTF fonts without anti-aliasing, addressing issue #5385.
Fixes #5385

Raylib currently always loads TTF glyphs using FONT_DEFAULT, which applies anti-aliasing.
Pixel-style fonts such as Monogram become blurry when scaled or used in low-resolution UI.

This PR introduces a simple and non-breaking addition that allows users to explicitly request bitmap/no-AA font loading.

A shared internal function handles both AA and non-AA paths:

static Font LoadFontFromMemoryInternal(..., bool antialias)

2. Existing APIs remain unchanged

LoadFontFromMemory() and LoadFontEx() still default to anti-aliasing:

LoadFontFromMemory(..., /* antialias = */ true);

3. New public API for bitmap/no-AA loading

Font LoadFontExBitmap(const char *fileName, int fontSize,
                      const int *codepoints, int codepointCount);

This function loads TTF glyphs using FONT_BITMAP, producing crisp pixel-aligned rendering without smoothing.


Usage Example

Font aa = LoadFontEx("monogram.ttf", 32, NULL, 0);           // Anti-aliased (default)
Font bitmap = LoadFontExBitmap("monogram.ttf", 32, NULL, 0); // Pixel-perfect, no AA

Visual Comparison

image

@raysan5
Copy link
Owner

raysan5 commented Dec 11, 2025

@Marcos-D Thanks for the review but I prefer to avoid adding new functions to raylib API to address a very specific use-case scenario.

@raysan5 raysan5 closed this Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rtext] Add support for disabling anti-aliasing on TTF loaded fonts

2 participants