Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/modules/sdl2_sdlttf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ Sizing functions

.. autofunction:: TTF_FontLineSkip

.. autofunction:: TTF_SetFontLineSkip


Style functions
^^^^^^^^^^^^^^^

Expand Down
3 changes: 3 additions & 0 deletions doc/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This describes the latest changes between the PySDL2 releases.
0.9.18 (Unreleased)
-------------------

* Updated to wrap new hints added in 2.32.0 and 2.32.2 (PR #293).
* Updated to wrap new function added in SDL_ttf 2.24.0 (PR #293).


0.9.17
------
Expand Down
4 changes: 4 additions & 0 deletions sdl2/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES",
"SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER",
"SDL_HINT_JOYSTICK_DEVICE",
'SDL_HINT_JOYSTICK_HAPTIC_AXES',
"SDL_HINT_LINUX_DIGITAL_HATS",
"SDL_HINT_LINUX_HAT_DEADZONES",
"SDL_HINT_LINUX_JOYSTICK_CLASSIC",
Expand Down Expand Up @@ -206,6 +207,7 @@
"SDL_HINT_KMSDRM_DEVICE_INDEX",
"SDL_HINT_TRACKPAD_IS_TOUCH_ONLY",
"SDL_HINT_SHUTDOWN_DBUS_ON_QUIT",
"SDL_HINT_APPLE_RWFROMFILE_USE_RESOURCES",

# Enums
"SDL_HintPriority",
Expand Down Expand Up @@ -383,6 +385,7 @@
SDL_HINT_JOYSTICK_WHEEL_DEVICES = b"SDL_JOYSTICK_WHEEL_DEVICES"
SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED = b"SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED"
SDL_HINT_JOYSTICK_DEVICE = b"SDL_JOYSTICK_DEVICE"
SDL_HINT_JOYSTICK_HAPTIC_AXES = b"SDL_JOYSTICK_HAPTIC_AXES"
SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES = b"SDL_JOYSTICK_ZERO_CENTERED_DEVICES"


Expand Down Expand Up @@ -421,6 +424,7 @@
SDL_HINT_WINDOWS_DPI_SCALING = b"SDL_WINDOWS_DPI_SCALING"
SDL_HINT_XINPUT_ENABLED = b"SDL_XINPUT_ENABLED"
SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = b"SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
SDL_HINT_APPLE_RWFROMFILE_USE_RESOURCES = b"SDL_APPLE_RWFROMFILE_USE_RESOURCES"


# Mobile Specific Hints
Expand Down
2 changes: 1 addition & 1 deletion sdl2/sdlimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_dll_file():

SDL_IMAGE_MAJOR_VERSION = 2
SDL_IMAGE_MINOR_VERSION = 8
SDL_IMAGE_PATCHLEVEL = 2
SDL_IMAGE_PATCHLEVEL = 12

def SDL_IMAGE_VERSION(x):
x.major = SDL_IMAGE_MAJOR_VERSION
Expand Down
4 changes: 2 additions & 2 deletions sdl2/sdlmixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def get_dll_file():
# Constants, enums, type definitions, and macros

SDL_MIXER_MAJOR_VERSION = 2
SDL_MIXER_MINOR_VERSION = 6
SDL_MIXER_PATCHLEVEL = 1
SDL_MIXER_MINOR_VERSION = 8
SDL_MIXER_PATCHLEVEL = 2

def SDL_MIXER_VERSION(x):
x.major = SDL_MIXER_MAJOR_VERSION
Expand Down
15 changes: 14 additions & 1 deletion sdl2/sdlttf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_dll_file():
# Constants, enums, type definitions, and macros

SDL_TTF_MAJOR_VERSION = 2
SDL_TTF_MINOR_VERSION = 22
SDL_TTF_MINOR_VERSION = 24
SDL_TTF_PATCHLEVEL = 0

def SDL_TTF_VERSION(x):
Expand Down Expand Up @@ -182,6 +182,7 @@ def HB_TAG(c1, c2, c3, c4):
SDLFunc("TTF_FontAscent", [_P(TTF_Font)], c_int),
SDLFunc("TTF_FontDescent", [_P(TTF_Font)], c_int),
SDLFunc("TTF_FontLineSkip", [_P(TTF_Font)], c_int),
SDLFunc("TTF_SetFontLineSkip", [_P(TTF_Font), c_int], None, added='2.24.0'),
SDLFunc("TTF_GetFontKerning", [_P(TTF_Font)], c_int),
SDLFunc("TTF_SetFontKerning", [_P(TTF_Font), c_int]),
SDLFunc("TTF_FontFaces", [_P(TTF_Font)], c_long),
Expand Down Expand Up @@ -884,6 +885,18 @@ def TTF_FontLineSkip(font):
"""
return _ctypes["TTF_FontLineSkip"](font)

def TTF_SetFontLineSkip(font, lineskip):
"""Sets the spacing between lines of text for a given font.

`Note: Added in SDL_ttf 2.24.0`

Args:
font (:obj:`TTF_Font`): The font object to modify.
lineskip (int): The new line skip height (in pixels) for the font.

"""
return _ctypes["TTF_SetFontLineSkip"](font, lineskip)

def TTF_GetFontKerning(font):
"""Checks whether or not kerning is enabled for a given font.

Expand Down
7 changes: 7 additions & 0 deletions sdl2/test/sdlttf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ def test_TTF_FontLineSkip(with_sdl_ttf):
last = cur
sdlttf.TTF_CloseFont(font)

@pytest.mark.skipif(sdlttf.dll.version_tuple < (2, 24, 0), reason="not available")
def test_TTF_SetFontLineSkip(with_sdl_ttf):
font = sdlttf.TTF_OpenFont(fontfile, 20)
cur = sdlttf.TTF_FontLineSkip(font)
sdlttf.TTF_SetFontLineSkip(font, cur + 10)
assert sdlttf.TTF_FontLineSkip(font) == (cur + 10)

def test_TTF_GetSetFontKerning(with_font):
font = with_font
assert sdlttf.TTF_GetFontKerning(font) == 1
Expand Down
2 changes: 1 addition & 1 deletion sdl2/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Constants, enums, & macros

SDL_MAJOR_VERSION = 2
SDL_MINOR_VERSION = 30
SDL_MINOR_VERSION = 32
SDL_PATCHLEVEL = 10

def SDL_VERSION(x):
Expand Down
Loading