Skip to content

Commit

Permalink
Added TTF_SetFontLineSkip()
Browse files Browse the repository at this point in the history
Fixes #353

(cherry picked from commit 8b9ccb6)
(cherry picked from commit 4297e5f)
  • Loading branch information
slouken committed Dec 13, 2024
1 parent 4af1aee commit 1796af8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3011,6 +3011,15 @@ int TTF_FontLineSkip(const TTF_Font *font)
return font->lineskip;
}

void TTF_SetFontLineSkip(TTF_Font *font, int lineskip)
{
if (!font) {
return;
}

font->lineskip = lineskip;
}

int TTF_GetFontKerning(const TTF_Font *font)
{
return font->allow_kerning;
Expand Down
14 changes: 12 additions & 2 deletions SDL_ttf.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,25 @@ extern DECLSPEC int SDLCALL TTF_FontAscent(const TTF_Font *font);
extern DECLSPEC int SDLCALL TTF_FontDescent(const TTF_Font *font);

/**
* Query the recommended spacing between lines of text for a font.
* Query the spacing between lines of text for a font.
*
* \param font the font to query.
* \returns the font's recommended spacing.
* \returns the font's line spacing.
*
* \since This function is available since SDL_ttf 2.0.12.
*/
extern DECLSPEC int SDLCALL TTF_FontLineSkip(const TTF_Font *font);

/**
* Set the spacing between lines of text for a font.
*
* \param font the font to modify.
* \param lineskip the new line spacing for the font.
*
* \since This function is available since SDL_ttf 2.22.0.
*/
extern DECLSPEC void SDLCALL TTF_SetFontLineSkip(TTF_Font *font, int lineskip);

/**
* Query whether or not kerning is allowed for a font.
*
Expand Down

2 comments on commit 1796af8

@sezero
Copy link
Contributor

@sezero sezero commented on 1796af8 Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this, a new api addition, in the release branch? Shouldn't such things happen in SDL2 branch?

@slouken
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I was thinking that we added APIs in point releases, but I think we haven't, and don't want to.

I won't ship this, I'll make the next release 2.24.0.

Please sign in to comment.