Skip to content

Add 3 SIL Open font license "default" fonts & import them on startup #1011

@pushfoo

Description

@pushfoo

Enhancement request:

What should be added/changed?

A beginner-friendly way for users to keep text consistent across operating systems

Core Enhancement

tl;dr An easy way to achieve this would be do the following:

  1. Include three metric-compatible SIL open source license fonts for the Serif, Sans Serif, and Monospace font archetypes
  2. Load them as the default constants for font archetypes.

For example, to allow users to draw text in identical Times-like fonts on all platforms, we could provide the following constant:

# Each of these font names is a drop-in for the others
SERIF = (
    "Times New Roman",
    "Times",  # Present on Mac OS
    "Liberation Serif",  # V 2.0 onward is reportedly SIL open font license
)

Drawing with font constants would be consistent with the way we already use color constants:

# The beginner-friendly way
arcade.draw_text(
   "This text should look almost identical on every platform",
   WIDTH / 2, HEIGHT / 2,
   font_name=arcade.fonts.SERIF,
   font_color=arcade.colors.RED
)

# Object oriented
text_instance = arcade.Text(
   "This text should look almost identical on every platform",
   WIDTH / 2, HEIGHT / 2,
   font_name=arcade.fonts.SERIF,
   font_color=arcade.colors.RED
)

Since the font named in SERIF are metric-compatible with Times New Roman, using the constant should produce extremely similar results across most platforms, regardless of any styling parameters passed.

Expanding The Idea

Linux distros appear to use a variety of metric compatible font sets to provide replacements for common fonts, while macOS appears to use a mix of custom metric-compatible fonts and licensing the original (this might vary by OS version).

The following font archetypes are covered by most metric compatible font sets, so they are probably the best starting point for this ticket:

  • Serif (Times New Roman)
  • Sans Serif (Arial)
  • Courier

To provide a consistent interface for all cross-platform fonts, we could also include constants that reference the Kenney fonts already in the resources folder. This way, we would have both:

  • an easy interface for cross-platform fonts
  • a decent selection of fonts for users to style their games with

Making it Reliable

To ensure that a specified style will always be found regardless of system fonts, we can do the following:

  1. Include TTF copies of a metric compatible font set in the resources folder as a fallback
  2. Add f":resources:\fonts\{METRIC_COMPATIBLE_NAME}" at the end of each of the font constant tuples

This will ensure that the user's game always finds one of the fonts, even on stripped down or unusual systems with no font packages installed.

The Liberation Font Family appears to have a license compatible with our needs under SIL Open Font license.

The FAQ for that appears to explicitly state that software bundling the font does not need to use a specific license for the project, only ship the license with the font. Commercial use and other cases are also outlined.

What would it help with?

tl;dr reliable, easy, and cross-platform font styling makes life easier for everyone

  1. Avoiding frustration for users trying to follow the documentation
  2. Make our examples more reliable
  3. Make sharing games easier, including game jam games

I've personally run into issues with 1 and 2. While reviewing our text drawing examples, I noticed that the system font example wasn't rendering properly.
This was because Garamond isn't present on all Windows systems, breaking the example (#1008).

Beginners won't be able to debug font loading issues on their own. Since they often copy and modify source from arcade.academy, we should make the examples more reliable.

Providing training wheels for cross-platform font styling would also make the framework more rewarding for both younger students and game jam participants by increasing:

  • speed of development
  • reliability of development
  • ease of sharing their work with others

Breaking changes?

None. Advanced users are unaffected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions