Skip to content

Port TTF_SetFontOutline #2452

Open
Open
@Starbuck5

Description

@Starbuck5

Description

SDL_TTF has outlining functionality! https://wiki.libsdl.org/SDL2_ttf/TTF_SetFontOutline.

We should port this functionality such that people can effectively render outlines on their text.

To do this, we could directly port the attribute and get/set it on the font, but then people will need two render calls, one for the outline and one for the text. For example:

font.outline = 2
text = font.render("Hello world", True, "orange")
win.blit(text, (10, 10))

font.outline = 0
text = font.render("Hello world", True, "black")
win.blit(text, (10 + width, 10 + width))

outlined

We could also have something higher level, where it auto renders the outline in font.render. Random notes of that:

font.outline_width (attribute, get/set with TTF_ outline)
font.outline_color (attribute, defaults to black)

Render with an outline:
font.render

Render only the outline:
font.render(outline_only kwarg) | font.render_outline_only() | font.outline_only

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions