Various build pipeline fixes
- Copy copyright information - Copy version number - Use correct weight information for output files
This commit is contained in:
6
COPYRIGHT
Normal file
6
COPYRIGHT
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Newsreader (c) 2020 The Newsreader Project Authors (http://github.com/productiontype/Newsreader)
|
||||||
|
Readerly (c) 2026 Nico Verbruggen (https://github.com/nicoverbruggen/readerly)
|
||||||
|
|
||||||
|
Readerly is originally based on the OFL version of Newsreader (9pt) with some alterations,
|
||||||
|
and is also available under the same OFL license; for legal reasons it is considered a
|
||||||
|
modified version of the original Newsreader with a new name.
|
||||||
93
LICENSE
Normal file
93
LICENSE
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
Newsreader (c) 2020 The Newsreader Project Authors (http://github.com/productiontype/Newsreader)
|
||||||
|
Readerly (c) 2026 Nico Verbruggen (https://github.com/nicoverbruggen/readerly)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
@@ -16,6 +16,7 @@ To accomplish this, I wanted to start from the 9pt font, which I exported. Then,
|
|||||||
- `metrics.py`: sets vertical metrics (OS/2 Typo, Win, hhea)
|
- `metrics.py`: sets vertical metrics (OS/2 Typo, Win, hhea)
|
||||||
- `lineheight.py`: adjusts OS/2 Typo metrics to control line spacing
|
- `lineheight.py`: adjusts OS/2 Typo metrics to control line spacing
|
||||||
- `rename.py`: updates font name metadata from Newsreader to Readerly
|
- `rename.py`: updates font name metadata from Newsreader to Readerly
|
||||||
|
- `version.py`: sets the font version from `./VERSION`
|
||||||
- `./src_processed`: intermediate files after instancing/processing (generated)
|
- `./src_processed`: intermediate files after instancing/processing (generated)
|
||||||
- `./out`: final TTF fonts (generated)
|
- `./out`: final TTF fonts (generated)
|
||||||
|
|
||||||
|
|||||||
16
build.py
16
build.py
@@ -34,11 +34,17 @@ FLATPAK_APP = "org.fontforge.FontForge"
|
|||||||
REGULAR_VF = os.path.join(SRC_DIR, "Newsreader-VariableFont_opsz,wght.ttf")
|
REGULAR_VF = os.path.join(SRC_DIR, "Newsreader-VariableFont_opsz,wght.ttf")
|
||||||
ITALIC_VF = os.path.join(SRC_DIR, "Newsreader-Italic-VariableFont_opsz,wght.ttf")
|
ITALIC_VF = os.path.join(SRC_DIR, "Newsreader-Italic-VariableFont_opsz,wght.ttf")
|
||||||
|
|
||||||
|
with open(os.path.join(ROOT_DIR, "VERSION")) as _vf:
|
||||||
|
FONT_VERSION = _vf.read().strip()
|
||||||
|
|
||||||
|
with open(os.path.join(ROOT_DIR, "COPYRIGHT")) as _cf:
|
||||||
|
COPYRIGHT_TEXT = _cf.read().strip()
|
||||||
|
|
||||||
VARIANTS = [
|
VARIANTS = [
|
||||||
# (output_name, source_vf, wght, opsz)
|
# (output_name, source_vf, wght, opsz)
|
||||||
("Readerly-Regular", REGULAR_VF, 430, 9),
|
("Readerly-Regular", REGULAR_VF, 450, 9),
|
||||||
("Readerly-Bold", REGULAR_VF, 550, 9),
|
("Readerly-Bold", REGULAR_VF, 550, 9),
|
||||||
("Readerly-Italic", ITALIC_VF, 430, 9),
|
("Readerly-Italic", ITALIC_VF, 450, 9),
|
||||||
("Readerly-BoldItalic", ITALIC_VF, 550, 9),
|
("Readerly-BoldItalic", ITALIC_VF, 550, 9),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -187,6 +193,8 @@ def main():
|
|||||||
metrics_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "metrics.py"))
|
metrics_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "metrics.py"))
|
||||||
lineheight_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "lineheight.py"))
|
lineheight_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "lineheight.py"))
|
||||||
rename_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "rename.py"))
|
rename_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "rename.py"))
|
||||||
|
version_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "version.py"))
|
||||||
|
license_code = load_script_as_function(os.path.join(SCRIPTS_DIR, "license.py"))
|
||||||
|
|
||||||
for name in variant_names:
|
for name in variant_names:
|
||||||
sfd_path = os.path.join(MUTATED_DIR, f"{name}.sfd")
|
sfd_path = os.path.join(MUTATED_DIR, f"{name}.sfd")
|
||||||
@@ -195,12 +203,16 @@ def main():
|
|||||||
|
|
||||||
# Set fontname so rename.py can detect the correct style suffix
|
# Set fontname so rename.py can detect the correct style suffix
|
||||||
set_fontname = f'f.fontname = {name!r}'
|
set_fontname = f'f.fontname = {name!r}'
|
||||||
|
set_version = f'VERSION = {FONT_VERSION!r}'
|
||||||
|
set_license = f'COPYRIGHT_TEXT = {COPYRIGHT_TEXT!r}'
|
||||||
|
|
||||||
script = build_per_font_script(sfd_path, sfd_path, [
|
script = build_per_font_script(sfd_path, sfd_path, [
|
||||||
("Setting vertical metrics", metrics_code),
|
("Setting vertical metrics", metrics_code),
|
||||||
("Adjusting line height", lineheight_code),
|
("Adjusting line height", lineheight_code),
|
||||||
("Setting fontname for rename", set_fontname),
|
("Setting fontname for rename", set_fontname),
|
||||||
("Updating font names", rename_code),
|
("Updating font names", rename_code),
|
||||||
|
("Setting version", set_version + "\n" + version_code),
|
||||||
|
("Setting license", set_license + "\n" + license_code),
|
||||||
])
|
])
|
||||||
run_fontforge_script(script)
|
run_fontforge_script(script)
|
||||||
|
|
||||||
|
|||||||
21
scripts/license.py
Normal file
21
scripts/license.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"""
|
||||||
|
FontForge: Set copyright information
|
||||||
|
─────────────────────────────────────
|
||||||
|
Sets the copyright notice from COPYRIGHT_TEXT injected by build.py.
|
||||||
|
|
||||||
|
Run inside FontForge (or via build.py which sets `f` and `COPYRIGHT_TEXT` before running this).
|
||||||
|
"""
|
||||||
|
|
||||||
|
import fontforge
|
||||||
|
|
||||||
|
f = fontforge.activeFont()
|
||||||
|
|
||||||
|
# COPYRIGHT_TEXT is injected by build.py before this script runs
|
||||||
|
|
||||||
|
lang = "English (US)"
|
||||||
|
|
||||||
|
f.copyright = COPYRIGHT_TEXT
|
||||||
|
f.appendSFNTName(lang, "Copyright", COPYRIGHT_TEXT)
|
||||||
|
|
||||||
|
print(f" Copyright: {COPYRIGHT_TEXT.splitlines()[0]}")
|
||||||
|
print("Done.")
|
||||||
@@ -17,12 +17,12 @@ f = fontforge.activeFont()
|
|||||||
|
|
||||||
FAMILY = "Readerly"
|
FAMILY = "Readerly"
|
||||||
|
|
||||||
# Map style suffixes to weight strings
|
# Map style suffixes to display names, PS weight strings, and OS/2 weight classes
|
||||||
STYLE_MAP = {
|
STYLE_MAP = {
|
||||||
"Regular": "Regular",
|
"Regular": ("Regular", "Book", 400),
|
||||||
"Bold": "Bold",
|
"Bold": ("Bold", "Bold", 700),
|
||||||
"Italic": "Italic",
|
"Italic": ("Italic", "Book", 400),
|
||||||
"BoldItalic": "Bold Italic",
|
"BoldItalic": ("Bold Italic", "Bold", 700),
|
||||||
}
|
}
|
||||||
|
|
||||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
@@ -31,7 +31,7 @@ STYLE_MAP = {
|
|||||||
|
|
||||||
# Determine style from the current fontname (e.g. "Readerly-BoldItalic")
|
# Determine style from the current fontname (e.g. "Readerly-BoldItalic")
|
||||||
style_suffix = f.fontname.split("-")[-1] if "-" in f.fontname else "Regular"
|
style_suffix = f.fontname.split("-")[-1] if "-" in f.fontname else "Regular"
|
||||||
style_display = STYLE_MAP.get(style_suffix, style_suffix)
|
style_display, ps_weight, os2_weight = STYLE_MAP.get(style_suffix, (style_suffix, "Book", 400))
|
||||||
|
|
||||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# UPDATE FONT PROPERTIES
|
# UPDATE FONT PROPERTIES
|
||||||
@@ -40,6 +40,8 @@ style_display = STYLE_MAP.get(style_suffix, style_suffix)
|
|||||||
f.fontname = f"{FAMILY}-{style_suffix}"
|
f.fontname = f"{FAMILY}-{style_suffix}"
|
||||||
f.familyname = FAMILY
|
f.familyname = FAMILY
|
||||||
f.fullname = f"{FAMILY} {style_display}"
|
f.fullname = f"{FAMILY} {style_display}"
|
||||||
|
f.weight = ps_weight
|
||||||
|
f.os2_weight = os2_weight
|
||||||
|
|
||||||
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
# UPDATE SFNT NAME TABLE
|
# UPDATE SFNT NAME TABLE
|
||||||
@@ -67,4 +69,5 @@ count = 0
|
|||||||
for name in f.sfnt_names:
|
for name in f.sfnt_names:
|
||||||
count += 1
|
count += 1
|
||||||
print(f" Updated {count} name entries for {FAMILY} {style_display}")
|
print(f" Updated {count} name entries for {FAMILY} {style_display}")
|
||||||
|
print(f" PS weight: {ps_weight}, OS/2 usWeightClass: {os2_weight}")
|
||||||
print("Done.")
|
print("Done.")
|
||||||
|
|||||||
24
scripts/version.py
Normal file
24
scripts/version.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"""
|
||||||
|
FontForge: Set font version
|
||||||
|
────────────────────────────
|
||||||
|
Sets the font version from a VERSION variable injected by build.py.
|
||||||
|
|
||||||
|
Run inside FontForge (or via build.py which sets `f` and `VERSION` before running this).
|
||||||
|
"""
|
||||||
|
|
||||||
|
import fontforge
|
||||||
|
|
||||||
|
f = fontforge.activeFont()
|
||||||
|
|
||||||
|
# VERSION is injected by build.py before this script runs
|
||||||
|
# e.g. VERSION = "1.0"
|
||||||
|
|
||||||
|
version_str = "Version " + VERSION
|
||||||
|
|
||||||
|
f.version = VERSION
|
||||||
|
f.sfntRevision = float(VERSION)
|
||||||
|
f.appendSFNTName("English (US)", "Version", version_str)
|
||||||
|
|
||||||
|
print(f" Version set to: {version_str}")
|
||||||
|
print(f" head.fontRevision set to: {float(VERSION)}")
|
||||||
|
print("Done.")
|
||||||
Reference in New Issue
Block a user