Skip to content

Commit

Permalink
Add font loading to examples
Browse files Browse the repository at this point in the history
* Add Liberation font loading to text drawing examples

* Add comments explaining usage of fonts

* Fix typo (s/bumbled/bundled/)
  • Loading branch information
pushfoo committed Jan 4, 2025
1 parent 3f20b09 commit f9333db
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions arcade/examples/drawing_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
DEFAULT_LINE_HEIGHT = 45
DEFAULT_FONT_SIZE = 20

# Load fonts bumbled with Arcade such as the Kenney fonts
# Load fonts bundled with Arcade such as the Kenney fonts
arcade.resources.load_kenney_fonts()
arcade.resources.load_liberation_fonts()


class GameView(arcade.View):
Expand Down Expand Up @@ -158,7 +159,8 @@ def on_draw(self):
font_name=(
"Times New Roman", # Comes with Windows
"Times", # MacOS may sometimes have this variant
"Liberation Serif" # Common on Linux systems
# Common on Linux systems + we ship it with Arcade
"Liberation Serif"
))

start_y -= DEFAULT_LINE_HEIGHT
Expand Down
6 changes: 4 additions & 2 deletions arcade/examples/drawing_text_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
DEFAULT_LINE_HEIGHT = 45
DEFAULT_FONT_SIZE = 20

# Load fonts bumbled with Arcade such as the Kenney fonts
# Load fonts bundled with Arcade such as the Kenney fonts
arcade.resources.load_kenney_fonts()
arcade.resources.load_liberation_fonts()


class GameView(arcade.View):
Expand Down Expand Up @@ -171,7 +172,8 @@ def __init__(self,):
font_name=(
"Times New Roman", # Comes with Windows
"Times", # MacOS may sometimes have this variant
"Liberation Serif" # Common on Linux systems
# Common on Linux systems + we ship it with Arcade
"Liberation Serif"
)
)

Expand Down
6 changes: 4 additions & 2 deletions arcade/examples/drawing_text_objects_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
import arcade
from pyglet.graphics import Batch

# Load fonts bumbled with Arcade such as the Kenney fonts
# Load fonts bundled with Arcade such as the Kenney fonts
arcade.resources.load_kenney_fonts()
arcade.resources.load_liberation_fonts()

WINDOW_WIDTH = 1280 # Window width in pixels
WINDOW_HEIGHT = 800 # Window height in pixels
Expand Down Expand Up @@ -193,7 +194,8 @@ def __init__(self):
font_name=(
"Times New Roman", # Comes with Windows
"Times", # MacOS may sometimes have this variant
"Liberation Serif" # Common on Linux systems
# Common on Linux systems + we ship it with Arcade
"Liberation Serif"
),
batch=self.batch,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/text/test_text_instance_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def instance() -> arcade.Text:
("value", "New test value"),
("x", 12.0),
("y", 12.0),
("font_name", "Times New Roman"),
("font_name", "Liberation Serif"), # Generic Times New Roman we ship in-box
("font_size", 20.0),
("width", 600),
("bold", True),
Expand Down

0 comments on commit f9333db

Please sign in to comment.