Skip to content

Bad font scaling when using SDL_LOGICAL_PRESENTATION_LETTERBOX #639

Description

@MetabaronCZ

Hello.

In my SDL3 app (v3.4.12) I am using standard 2D SDL_Renderer with rendering logical presentation set to SDL_LOGICAL_PRESENTATION_LETTERBOX. I also use SDL3 TTF (v3.2.2) for dynamic text rendering using TTF_CreateRendererTextEngine. I use the TTF_Text - not texts rendered to textures.

My window is 1280x960. When I render texts in this window, they look great (thank you for your work). But when I maximize window or set fullscreen the texts have missplaced pixels (they are not blurred).

The standard textures with images are scaled with "linear" algorithm and look blurry as expected (thats OK). But it seems the texts are scaled with "nearest" algorithm (thats not expected).

I am not talking about setting text/font scale, but screen scaling done by the SDL_LOGICAL_PRESENTATION_LETTERBOX.

Here is screenshot of original text with no scaling:
Image

Here is screenshot of text on scaled window (112.5% scale; from 1280x960 to 1920x1080). The top image is the same text rendered as texture (you see its blurry, thats expected result) and the bottom image is actual text rendered:
Image
(click on image to see detail)

My understanding was, that SDL_LOGICAL_PRESENTATION_LETTERBOX renders the scene in 1280x960 and then scales this image/texture to window + add letterbox. But here it seems that textures and texts are rendered/scaled separately and then composed.

Anyway, does SDL_ttf scales text in "nearest" algorithm. And if yes, can I set it to "linear"?

No activity

Activity on this issue will appear here.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions