diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..92569e2cc --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +3D/fonts/*.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6860ddc65..0609218a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,14 @@ on: jobs: health_check: runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + lfs: true - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 - name: Install FontTools run: pip install fonttools pytest - name: pytest diff --git a/fonts/LICENSE b/2D/fonts/LICENSE similarity index 100% rename from fonts/LICENSE rename to 2D/fonts/LICENSE diff --git a/fonts/Noto-COLRv1-emojicompat.ttf b/2D/fonts/Noto-COLRv1-emojicompat.ttf similarity index 75% rename from fonts/Noto-COLRv1-emojicompat.ttf rename to 2D/fonts/Noto-COLRv1-emojicompat.ttf index 7bb0e5ae5..4c5783c57 100644 Binary files a/fonts/Noto-COLRv1-emojicompat.ttf and b/2D/fonts/Noto-COLRv1-emojicompat.ttf differ diff --git a/fonts/Noto-COLRv1-noflags.ttf b/2D/fonts/Noto-COLRv1-noflags.ttf similarity index 65% rename from fonts/Noto-COLRv1-noflags.ttf rename to 2D/fonts/Noto-COLRv1-noflags.ttf index 0b92f6cd8..a88cf77a3 100644 Binary files a/fonts/Noto-COLRv1-noflags.ttf and b/2D/fonts/Noto-COLRv1-noflags.ttf differ diff --git a/fonts/Noto-COLRv1.ttf b/2D/fonts/Noto-COLRv1.ttf similarity index 74% rename from fonts/Noto-COLRv1.ttf rename to 2D/fonts/Noto-COLRv1.ttf index 4d42b0d8a..d1c82373d 100644 Binary files a/fonts/Noto-COLRv1.ttf and b/2D/fonts/Noto-COLRv1.ttf differ diff --git a/fonts/NotoColorEmoji-emojicompat.ttf b/2D/fonts/NotoColorEmoji-emojicompat.ttf similarity index 61% rename from fonts/NotoColorEmoji-emojicompat.ttf rename to 2D/fonts/NotoColorEmoji-emojicompat.ttf index fed0d02cc..03c889f78 100644 Binary files a/fonts/NotoColorEmoji-emojicompat.ttf and b/2D/fonts/NotoColorEmoji-emojicompat.ttf differ diff --git a/2D/fonts/NotoColorEmoji-flagsonly.ttf b/2D/fonts/NotoColorEmoji-flagsonly.ttf new file mode 100644 index 000000000..dab0c5a03 Binary files /dev/null and b/2D/fonts/NotoColorEmoji-flagsonly.ttf differ diff --git a/fonts/NotoColorEmoji-noflags.ttf b/2D/fonts/NotoColorEmoji-noflags.ttf similarity index 59% rename from fonts/NotoColorEmoji-noflags.ttf rename to 2D/fonts/NotoColorEmoji-noflags.ttf index 2a9891f5b..bdbebfd2d 100644 Binary files a/fonts/NotoColorEmoji-noflags.ttf and b/2D/fonts/NotoColorEmoji-noflags.ttf differ diff --git a/fonts/NotoColorEmoji.ttf b/2D/fonts/NotoColorEmoji.ttf similarity index 60% rename from fonts/NotoColorEmoji.ttf rename to 2D/fonts/NotoColorEmoji.ttf index 943741df1..e605743d0 100644 Binary files a/fonts/NotoColorEmoji.ttf and b/2D/fonts/NotoColorEmoji.ttf differ diff --git a/fonts/NotoColorEmoji_WindowsCompatible.ttf b/2D/fonts/NotoColorEmoji_WindowsCompatible.ttf similarity index 60% rename from fonts/NotoColorEmoji_WindowsCompatible.ttf rename to 2D/fonts/NotoColorEmoji_WindowsCompatible.ttf index d51e33eb8..a8a20c176 100644 Binary files a/fonts/NotoColorEmoji_WindowsCompatible.ttf and b/2D/fonts/NotoColorEmoji_WindowsCompatible.ttf differ diff --git a/3D/fonts/LICENSE b/3D/fonts/LICENSE new file mode 100644 index 000000000..d952d62c0 --- /dev/null +++ b/3D/fonts/LICENSE @@ -0,0 +1,92 @@ +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. diff --git a/3D/fonts/Noto-3D-128-flagsonly.ttf b/3D/fonts/Noto-3D-128-flagsonly.ttf new file mode 100644 index 000000000..d265b7aa5 --- /dev/null +++ b/3D/fonts/Noto-3D-128-flagsonly.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b6f85282ca413efcdf2cbdc6ca3b20f958e3faf4ec39974a9d37557df39ccb9 +size 7208244 diff --git a/3D/fonts/Noto-3D-128-noflags.ttf b/3D/fonts/Noto-3D-128-noflags.ttf new file mode 100644 index 000000000..22acd64b1 --- /dev/null +++ b/3D/fonts/Noto-3D-128-noflags.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fdfec3dbefb214750465b5c17ac8f7c47286fc0c88d8605c12cd45e86613f7c +size 140952312 diff --git a/3D/fonts/Noto-3D-128.ttf b/3D/fonts/Noto-3D-128.ttf new file mode 100644 index 000000000..800c88142 --- /dev/null +++ b/3D/fonts/Noto-3D-128.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f4312a7c02d0c9de88095ee65e320ffe9316d2d8d56e4c515e7181fca5ed439 +size 147882884 diff --git a/3D/fonts/Noto-3D-192-flagsonly.ttf b/3D/fonts/Noto-3D-192-flagsonly.ttf new file mode 100644 index 000000000..ce7536802 --- /dev/null +++ b/3D/fonts/Noto-3D-192-flagsonly.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d67d40f3cdbf285b1732d7fa6abbe785d40a810fcfc26c9bf738e8cb493454e +size 11040224 diff --git a/3D/fonts/Noto-3D-192-noflags.ttf b/3D/fonts/Noto-3D-192-noflags.ttf new file mode 100644 index 000000000..1d0a43de4 --- /dev/null +++ b/3D/fonts/Noto-3D-192-noflags.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ca3f637dfebc8da8f887ffc4e5fcd433802f93994f813f7ff9f179e6a8dd625 +size 218345004 diff --git a/3D/fonts/Noto-3D-192.ttf b/3D/fonts/Noto-3D-192.ttf new file mode 100644 index 000000000..0d5ea8af7 --- /dev/null +++ b/3D/fonts/Noto-3D-192.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:278e14dfc2c7f528f42a7e7d34eb1e302250d6b400e0fceb07a4ad2da72b617a +size 228959280 diff --git a/3D/fonts/Noto-3D-watch-flagsonly.ttf b/3D/fonts/Noto-3D-watch-flagsonly.ttf new file mode 100644 index 000000000..7983c8721 --- /dev/null +++ b/3D/fonts/Noto-3D-watch-flagsonly.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3a4c6f6d84354209abffef719d34d2661e7e64ad8900cd414b2f334ed92736f +size 1810272 diff --git a/3D/fonts/Noto-3D-watch-noflags.ttf b/3D/fonts/Noto-3D-watch-noflags.ttf new file mode 100644 index 000000000..2bec9c380 --- /dev/null +++ b/3D/fonts/Noto-3D-watch-noflags.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d141379ae1339189b3d52e4e8e4b1a58d6d1ef04ea1ffcf6ab6ea50c4889b628 +size 33855964 diff --git a/3D/fonts/Noto-3D-watch.ttf b/3D/fonts/Noto-3D-watch.ttf new file mode 100644 index 000000000..eae2a7699 --- /dev/null +++ b/3D/fonts/Noto-3D-watch.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5934469c144a951d26be9ae7173a702a6231418e18bfb395fbda3683891838c +size 35598452 diff --git a/about_fonts.py b/about_fonts.py index c1d8d1abb..4a76b94a5 100644 --- a/about_fonts.py +++ b/about_fonts.py @@ -13,8 +13,12 @@ def name(font, name_id): def main(): - font_files = sorted(p for p in (Path(__file__).parent / "fonts").iterdir() if p.suffix == ".ttf") - max_name_len = max(len(p.name) for p in font_files) + font_files = [] + for sub_dir in [Path(__file__).parent / "2D" / "fonts", Path(__file__).parent / "3D" / "fonts"]: + if sub_dir.is_dir(): + font_files.extend(sub_dir.rglob("*.ttf")) + font_files.sort(key=lambda p: p.name) + max_name_len = max(len(p.name) for p in font_files) if font_files else 0 for font_file in font_files: font = ttLib.TTFont(font_file) diff --git a/fonts/NotoColorEmoji-flagsonly.ttf b/fonts/NotoColorEmoji-flagsonly.ttf deleted file mode 100644 index e06b7614b..000000000 Binary files a/fonts/NotoColorEmoji-flagsonly.ttf and /dev/null differ diff --git a/tests/basic_test.py b/tests/basic_test.py index f73b7cd60..2ff347c49 100644 --- a/tests/basic_test.py +++ b/tests/basic_test.py @@ -11,53 +11,51 @@ NAME_ID_POSTSCRIPT_NAME = 6 def test_consistent_version(): - fonts_dir = Path("fonts") - assert fonts_dir.is_dir() + for sub_dir in [Path("2D/fonts"), Path("3D/fonts")]: + assert sub_dir.is_dir() - name5_re = re.compile(r"^Version (\d+.\d+);GOOG;noto-emoji:\d+:[a-z0-9]+$") + name5_re = re.compile(r"^Version (\d+.\d+);GOOG;noto-emoji:\d+:[a-z0-9]+$") - debug_versions = [] - versions = set() - for font_file in fonts_dir.rglob("*.ttf"): - font = ttLib.TTFont(font_file) - head_ver = f"{font['head'].fontRevision:.03f}" - versions.add(head_ver) - debug_versions.append(f"{font_file.name} head {head_ver}") - for name in font["name"].names: - # name 5 is version - if name.nameID != 5: - continue - if not name.isUnicode(): - continue - match = name5_re.match(name.toUnicode()) - assert match is not None, f"{name.toUnicode()} is malformed" - versions.add(match.group(1)) - debug_versions.append(f"{font_file.name} name {match.group(1)}") - debug_versions = "\n".join(debug_versions) - assert ( - len(versions) == 1 - ), f"Should have a consistent version, found\n{debug_versions}" + debug_versions = [] + versions = set() + for font_file in sub_dir.rglob("*.ttf"): + font = ttLib.TTFont(font_file) + head_ver = f"{font['head'].fontRevision:.03f}" + versions.add(head_ver) + debug_versions.append(f"{font_file.name} head {head_ver}") + for name in font["name"].names: + # name 5 is version + if name.nameID != 5: + continue + if not name.isUnicode(): + continue + match = name5_re.match(name.toUnicode()) + assert match is not None, f"{name.toUnicode()} is malformed in {font_file.name}" + versions.add(match.group(1)) + debug_versions.append(f"{font_file.name} name {match.group(1)}") + debug_versions_str = "\n".join(debug_versions) + assert ( + len(versions) == 1 + ), f"Should have a consistent version under {sub_dir}, found\n{debug_versions_str}" def test_consistent_fstype(): - fonts_dir = Path("fonts") - assert fonts_dir.is_dir() + for sub_dir in [Path("2D/fonts"), Path("3D/fonts")]: + assert sub_dir.is_dir() - name5_re = re.compile(r"^Version (\d+.\d+);GOOG;noto-emoji:\d+:[a-z0-9]+$") - - debug_fstypes = [] - fstypes = set() - for font_file in fonts_dir.rglob("*.ttf"): - font = ttLib.TTFont(font_file) - fstype = font["OS/2"].fsType - fstypes.add(fstype) - debug_fstypes.append(f"{font_file.name} fsType {fstype}") - debug_fstypes = "\n".join(debug_fstypes) - assert fstypes == {0}, f"All fsType's should be 0, found\n{debug_fstypes}" + debug_fstypes = [] + fstypes = set() + for font_file in sub_dir.rglob("*.ttf"): + font = ttLib.TTFont(font_file) + fstype = font["OS/2"].fsType + fstypes.add(fstype) + debug_fstypes.append(f"{font_file.name} fsType {fstype}") + debug_fstypes_str = "\n".join(debug_fstypes) + assert fstypes == {0}, f"All fsType's should be 0 under {sub_dir}, found\n{debug_fstypes_str}" def test_has_emojicompat(): - fonts_dir = Path("fonts") + fonts_dir = Path("2D/fonts") assert fonts_dir.is_dir() ec_fonts = set(fonts_dir.rglob("*-emojicompat.ttf")) @@ -84,18 +82,21 @@ def name(font, name_id): def test_flagsonly_name(): - fonts_dir = Path("fonts") - assert fonts_dir.is_dir() - font_file = fonts_dir / "NotoColorEmoji-flagsonly.ttf" - font = ttLib.TTFont(font_file) - assert [ - "Noto Color Emoji Flags", - "Noto Color Emoji Flags", - "Noto Color Emoji Flags", - "NotoColorEmojiFlags", - ] == [ - name(font, NAME_ID_FAMILY), - name(font, NAME_ID_FULLNAME), - name(font, NAME_ID_UNIQUE_ID), - name(font, NAME_ID_POSTSCRIPT_NAME), - ] + found = False + for sub_dir in [Path("2D/fonts"), Path("3D/fonts")]: + assert sub_dir.is_dir() + for font_file in sub_dir.rglob("*flagsonly.ttf"): + found = True + font = ttLib.TTFont(font_file) + assert [ + "Noto Color Emoji Flags", + "Noto Color Emoji Flags", + "Noto Color Emoji Flags", + "NotoColorEmojiFlags", + ] == [ + name(font, NAME_ID_FAMILY), + name(font, NAME_ID_FULLNAME), + name(font, NAME_ID_UNIQUE_ID), + name(font, NAME_ID_POSTSCRIPT_NAME), + ] + assert found, "Should find at least one flagsonly font to test"