Skip to content

Commit

Permalink
Get Kenney and Liberation to show in resources
Browse files Browse the repository at this point in the history
* Add initial graphic courtesy of @DigiDuncan

* Add SIL Open Font License to links.rst

* Add basic inset for the Liberation fonts

* Add printing for the Liberation font info + SIL link
  • Loading branch information
pushfoo committed Jan 14, 2025
1 parent e24e2f5 commit b7e775a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 15 deletions.
Binary file added doc/api_docs/images/fonts_liberation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.. Concepts
.. _CC0: https://creativecommons.org/publicdomain/#publicdomain-cc0-10
.. _Creative Commons licenses: https://creativecommons.org/share-your-work/cclicenses/
.. _SIL Open Font License: https://openfontlicense.org/

.. Licensing
.. _BibTeX: https://www.bibtex.org/Format/
Expand Down
70 changes: 55 additions & 15 deletions util/create_resources_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,27 @@ def create_resource_path(
return f"{prefix}:resources:{path.as_posix()}{suffix}"


KENNEY_TTFS = "Kenney TTFs"
LIBERATION_TTFS = "Liberation TTFs"

# pending: post-3.0 cleanup # unstructured kludge
REPLACE_TITLE_WORDS = {
"ttf": "Kenney TTFs",
"Kenney": KENNEY_TTFS,
"Liberation": LIBERATION_TTFS,
"gui": "GUI",
"window": "Window & Panel",
".": "Top-level Resources"
}
# NASTY! # pending: post-3.0 cleanup
OVERRIDE_LEVELS = {
KENNEY_TTFS: 2,
LIBERATION_TTFS: 2
}

# pending: post-3.0 cleanup # more unstructured filth
SKIP_TITLES = {
"Kenney TTFs"
"Ttf"
# "Kenney TTFs"
}


Expand Down Expand Up @@ -230,6 +241,10 @@ def process_resource_directory(out, dir: Path):

file_list = filter_dir(path, keep=is_unskipped_file)
num_files = len(file_list)
def _debug_print_files() -> None: # pending: post-3.0 cleanup
"""Nasty little temp helper"""
for file in file_list:
print(file.name)

if num_files > 0:

Expand All @@ -246,23 +261,48 @@ def process_resource_directory(out, dir: Path):
continue
as_tup = tuple(display_parts[:heading_level])
if as_tup not in visited_headings:
# NASTY! # pending: post 3.0 cleanup
if part in OVERRIDE_LEVELS:
heading_level = OVERRIDE_LEVELS[part]

# print("!!!", heading_level, part, as_tup)

do_heading(out, heading_level, part)
visited_headings.add(as_tup)

if raw_resource_handle == ":resources:images/":
for f in file_list:
print(f.name)

if raw_resource_handle == ":resources:fonts/ttf/":
for f in file_list:
print(f.name)
# pending: post-3.0 cleanup
out.write("\n")
out.write(".. figure:: images/fonts_blue.png\n")
out.write(" :alt: The bundled Kenney.nl fonts.\n")
out.write("\n")
out.write(" Arcade includes the following fonts from `Kenney.nl's font pack <https://kenney.nl/assets/kenney-fonts>`_\n")
out.write(" are available using the path and filenames below.\n")
_debug_print_files()

if raw_resource_handle.startswith(":resources:fonts/ttf/"):
_debug_print_files()
if raw_resource_handle.endswith("Kenney/"):
out.write("\n")

out.write(".. figure:: images/fonts_blue.png\n")
# out.write(" :align: center\n")
out.write(" :alt: The bundled Kenney.nl fonts.\n")
out.write("\n")
# Put the text *after* the CSS, or add <br> via .. raw:: html blocks
# since the CSS may be broken.
out.write("Arcade includes the following fonts from `Kenney.nl's font pack <https://kenney.nl/assets/kenney-fonts>`_\n")
out.write("are available using the path and filenames below.\n")
out.write("\n")

elif raw_resource_handle.endswith("Liberation/"):
out.write(
"\n"
".. figure:: images/fonts_liberation.png\n"
" :alt: The bundled Liberation font family trio.\n"
#" :align: center\n"
# Put the text *after* the CSS, or add <br> via .. raw:: html blocks
# since the CSS may be broken.
"\n"
"Arcade also includes the Liberation font family. This trio of fonts is designed as\n"
"generic, drop-in replacements for Times New Roman, Arial, and Courier.\n"
"\n"
"The Liberation font family uses the proven, commercial-friendly\n"
"`SIL Open Font License`_ widely accepted within games and design spaces.\n"
)

n_cols = get_header_num_cols(raw_resource_handle, num_files)
widths = get_column_widths_for_n(n_cols)
Expand Down

0 comments on commit b7e775a

Please sign in to comment.