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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page.

- Fixed an issue causing a crash when closing the window
- Added `Window.close` (bool) attribute indicating if the window is closed
- GUI
- Fix `UILabel` with enabled multiline sometimes cut off text

## Version 3.2

Expand Down
7 changes: 4 additions & 3 deletions arcade/gui/widgets/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def __init__(
self._strong_background = True

if adaptive_multiline:
# +1 is required to prevent line wrap
width = self._label.content_width + 1
# +1 is required to prevent line wrap, +1 is required to prevent issues with kerning
width = self._label.content_width + 2

super().__init__(
x=x,
Expand Down Expand Up @@ -242,7 +242,8 @@ def _update_label(self):

def _update_size_hint_min(self):
"""Update the minimum size hint based on the label content size."""
min_width = self._label.content_width + 1 # +1 required to prevent line wrap
# +1 is required to prevent line wrap, +1 is required to prevent issues with kerning
min_width = self._label.content_width + 2
min_width += self._padding_left + self._padding_right + 2 * self._border_width

min_height = self._label.content_height
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/gui/test_uilabel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from unittest.mock import Mock

import pytest
from pyglet.math import Vec2

from arcade.gui import UILabel
Expand Down Expand Up @@ -192,7 +191,7 @@ def test_integration_with_layout_fit_to_content(ui):
ui.execute_layout()

# auto size should fit the text
assert label.rect.width == 44
assert label.rect.width == 45
assert label.rect.height == 12

# even when text changed
Expand Down Expand Up @@ -221,7 +220,7 @@ def test_fit_content_overrides_width(ui):

label.fit_content()

assert label.rect.width == 44
assert label.rect.width == 45
assert label.rect.height == 12


Expand Down
Loading