Compare commits

..

No commits in common. "main" and "v2.028" have entirely different histories.
main ... v2.028

3105 changed files with 10816 additions and 74136 deletions

View file

@ -1,20 +0,0 @@
name: Continuous Test + Deploy
on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
branches: [main]
jobs:
health_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3
uses: actions/setup-python@v2
- name: Install FontTools
run: pip install fonttools pytest
- name: pytest
run: pytest

1
.gitignore vendored
View file

@ -3,4 +3,3 @@ __pycache__/
waveflag
build/
venv/
emojicompat/

View file

@ -1,47 +0,0 @@
# Build instructions
Typically build the CBDT then the COLRv1 as COLRv1 copies some information from CBDT.
## Is this a Unicode rev?
* Update https://github.com/notofonts/nototools, publish the new version
* Must be done by a Googler. See internal instructions.
* Update emojicompat
* https://github.com/googlefonts/emojicompat?tab=readme-ov-file#support-new-unicode-sequences
* Update artwork
* Must be done by a Googler. Work with the emoji design team using internal instructions.
## Update version
Edit `NotoColorEmoji.tmpl.ttx.tmpl`
* In `<head>` find `fontRevision`.
* It should be of the form 2.xxx
* Increment xxx by 1
* In `<name>` find `<namerecord nameID="5" platformID="3" platEncID="1"
langID="0x409">`
* It should look like `Version
2.017;GOOG;noto-emoji:20180810:f1da3bc656f9`
* Update Version to match `<head>` (`Version 2.017` in the example)
* Update the date (`20180810` in the example)
* Update the commit
## Update new flags
* Add new flags to list in Makefile ([example](https://github.com/googlefonts/noto-emoji-next/commit/21bdd6107fac60979737ac95c2655cb02824d144))
* Update `third_party/region-flags`. For example, for CQ (Sark) update:
* `third_party/region-flags/png/CQ.png`
* This file can be highres, it will be resized by the CBDT build process
* This file should have the proportions of the flag
* `third_party/region-flags/svg/CQ.svg`
* This file is *not* required to have the `0 0 128 128` viewbox files in `/svg` have to have
* `third_party/region-flags/waved-svg/emoji_u1f1e8_1f1f6.svg`
* This file is produced using https://github.com/rsheeter/warp
* New flags are added to `wave_list.txt`
* To wave only the new flag delete other entries locally
## Rebuild the fonts
```bash
# Build CBDT, COLR, flags-only, and emojicompat fonts
$ ./full_rebuild.sh
```

View file

@ -1,3 +1,27 @@
We don't accept pull requests, or design requests in general.
Want to contribute? Great! First, read this page (including the small print
at the end).
The Google Emoji team leads this project internally, and this repo exists to ease integration of the Emoji font binaries (and SVG 'binaries', which are not true sources).
### Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License
Agreement](https://cla.developers.google.com/about/google-individual)
(CLA), which you can do online. The CLA is necessary mainly because you own the
copyright to your changes, even after your contribution becomes part of our
codebase, so we need your permission to use and distribute your code. We also
need to be sure of various other things—for instance that you'll tell us if you
know that your code infringes on other people's patents. You don't have to sign
the CLA until after you've submitted your code for review and a member has
approved it, but you must do it before we can put your code into our codebase.
Before you start working on a larger contribution, you should get in touch with
us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.
### Code reviews
All submissions, including submissions by project members, require review.
We use Github pull requests for this purpose.
### The small print
Contributions made by corporations are covered by a different agreement than
the one above, the [Software Grant and Corporate Contributor License
Agreement](https://cla.developers.google.com/about/google-corporate).

258
LICENSE
View file

@ -1,93 +1,201 @@
Copyright 2013 Google LLC
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
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:
https://scripts.sil.org/OFL
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
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.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
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.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
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.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"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.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
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:
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
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.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
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.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
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.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
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.
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
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.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -55,7 +55,7 @@ COMPRESSED_DIR := $(BUILD_DIR)/compressed_pngs
LIMITED_FLAGS = CN DE ES FR GB IT JP KR RU US
SELECTED_FLAGS = AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ \
BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BW BY BZ \
CA CC CD CF CG CH CI CK CL CM CN CO CQ CR CU CV CW CX CY CZ \
CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ \
DE DJ DK DM DO DZ \
EC EE EG EH ER ES ET EU \
FI FJ FK FM FO FR \
@ -241,11 +241,6 @@ clean:
rm -f waveflag
rm -rf $(BUILD_DIR)
# This prints the value of a Makefile variable: e.g. `make print-SELECTED_FLAGS`
# will print the content of SELECTED_FLAGS.
# Source: https://apprize.best/linux/gnu/3.html
print-%: ; @echo $* = $($*)
.SECONDARY: $(EMOJI_FILES) $(FLAG_FILES) $(RESIZED_FLAG_FILES) $(RENAMED_FLAG_FILES) \
$(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES)

View file

@ -78,7 +78,7 @@
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="2.047"/>
<fontRevision value="2.028"/>
<checkSumAdjustment value="0x4d5a161a"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00001011"/>
@ -231,7 +231,7 @@
<name>
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
Copyright 2022 Google Inc.
Copyright 2013 Google Inc.
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Noto Color Emoji
@ -246,7 +246,7 @@
Noto Color Emoji
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 2.047;GOOG;noto-emoji:20240827:6c211821b8442ab3683a502f9a79b2034293fced
Version 2.028;GOOG;noto-emoji:20210625:BETA
</namerecord>
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
NotoColorEmoji

View file

@ -1,18 +1,36 @@
![Noto](https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fab4b4276-9bb0-42a6-a675-510fcb6055df_1940x1088.png)
![Noto](images/noto.png)
# Noto Emoji
Noto Emoji (Stands for No Tofu) is an open source (Open Font License 1.1) emoji library that provides standard Unicode emoji support and tools for working with them including:
Color and Black-and-White Noto emoji fonts, and tools for working with them.
- A Unicode compliant color emoji [font](https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf).
- A full library of Noto color emoji font files including vector svgs and pngs
- [Metadata](https://github.com/googlefonts/emoji-metadata) for Emoji Input (including shortcodes, emoji ordering, ascii equivalents)
## Prerequisites
Building Noto Color Emoji requires:
- Python 3
- [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
- [pngquant](https://pngquant.org/)
- [zopflipng](https://github.com/google/zopfli)
- [cairo](https://www.cairographics.org/)
- [imagemagick](https://imagemagick.org/)
## Color Font
## Building NotoColorEmoji
This project uses a virtual environment to manage dependencies. Use the following steps to get up and running:
The latest font file is found [here](https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf). If you want to download a specific version, please look at the gh-pages branch, where you will find the built assets for both our latest and older versions.
```shell
# make sure you have the Prerequisites
## Monochrome Font
# create & activate a virtual environment
python3 -m venv venv
source venv/bin/activate
The black-and-white emoji font is back under active development and is available as a [variable font](https://fonts.google.com/noto/specimen/Noto+Emoji)
# install python requirements
pip install -r requirements.txt
time make -j
```
Intermediate products (compressed image files, for example) will be put into a build subdirectory. Two fonts will be saved at the top level:
* `NotoColorEmoji.ttf`, for general use.
* `NotoColorEmoji_WindowsCompatible.ttf`, which is the same font but with an additional empty `glyf` table and `cmap` format 4 subtable. This is required by Windows 10 if you want to _install_ the font.
## Using NotoColorEmoji
@ -21,9 +39,25 @@ and Chrome/Chromium OS. Windows supports it starting with Windows 10 Anniversar
Update in Chrome and Edge. On macOS, only Chrome supports it, while on Linux it will
support it with some fontconfig tweaking, see [issue #36](https://github.com/googlei18n/noto-emoji/issues/36). Currently we do not build other color font formats.
## A note about PNGs
## Color emoji assets
The assets provided in the repo are all those used to build the NotoColorEmoji font. With one exception: the flag images in the font are PNG images to which transforms have been applied to standardize the size and generate the wave and border shadow. We do not have SVG versions that reflect these transforms.
The assets provided in the repo are all those used to build the NotoColorEmoji
font. Note however that NotoColorEmoji often uses the same assets to represent
different character sequences-- notably, most gender-neutral characters or
sequences are represented using assets named after one of the gendered
sequences. This means that some sequences appear to be missing. Definitions of
the aliasing used appear in the emoji_aliases.txt file.
Also note that the images in the font might differ from the original assets. In
particular the flag images in the font are PNG images to which transforms have
been applied to standardize the size and generate the wave and border shadow. We
do not have SVG versions that reflect these transforms.
## B/W emoji font
The black-and-white emoji font is not under active development. Its repertoire of
emoji is now several years old, and the design does not reflect the current color
emoji design. Currently we have no plans to update this font.
## License
@ -36,3 +70,9 @@ otherwise exempt from copyright ([more info](third_party/region-flags/LICENSE)).
## Contributing
Please read [CONTRIBUTING](CONTRIBUTING.md) if you are thinking of contributing to this project.
## News
* 2017-09-13: Emoji redesign released.
* 2015-12-09: Unicode 7 and 8 emoji image data (.png format) added.
* 2015-09-29: All Noto fonts now licensed under the SIL Open Font License.

View file

@ -1,37 +0,0 @@
"""Prints info about emoji fonts."""
from fontTools import ttLib
from pathlib import Path
import sys
NAME_ID_VERSION = 5
def name(font, name_id):
return ",".join(n.toUnicode() for n in font["name"].names if n.isUnicode() and n.nameID == 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)
for font_file in font_files:
font = ttLib.TTFont(font_file)
font_type = []
if "CBDT" in font:
font_type.append("CBDT")
if "COLR" in font:
font_type.append("COLR")
if "meta" in font and "Emji" in font["meta"].data:
font_type.append("EmojiCompat")
font_type.append(f"fontRevision:{font['head'].fontRevision:.3f}")
font_type.append(name(font, NAME_ID_VERSION))
font_type = ", ".join(font_type)
print(f"{font_file.name:{max_name_len + 1}} {font_type}")
if __name__ == '__main__':
main()

View file

@ -140,7 +140,7 @@ def create_simple_gsub(lookups, script='DFLT', feature='ccmp'):
def reg_indicator(letter):
"""Return a regional indicator character from corresponding capital letter.
"""Return a regional indicator charater from corresponing capital letter.
"""
return 0x1F1E6 + ord(letter) - ord('A')

View file

@ -122,7 +122,7 @@ def _check_valid_emoji_cps(sorted_seq_to_filepath, unicode_version):
coverage_pass = False
if not coverage_pass:
exit("Please fix the problems mentioned above or run: make BYPASS_SEQUENCE_CHECK='True'")
exit("Please fix the problems metioned above or run: make BYPASS_SEQUENCE_CHECK='True'")
def _check_zwj(sorted_seq_to_filepath):
@ -144,7 +144,7 @@ def _check_zwj(sorted_seq_to_filepath):
pcp = seq[i-1]
if pcp != EMOJI_VS and not unicode_data.is_emoji(pcp):
print(
f'check zwj: non-emoji {pcp} precedes ZWJ in {fp}',
f'check zwj: non-emoji {pcp} preceeds ZWJ in {fp}',
file=sys.stderr)
if i < len(seq) - 1:
fcp = seq[i+1]
@ -313,7 +313,7 @@ def _check_coverage(seq_to_filepath, unicode_version):
coverage_pass = False
if not coverage_pass:
exit("Please fix the problems mentioned above or run: make BYPASS_SEQUENCE_CHECK='True'")
exit("Please fix the problems metioned above or run: make BYPASS_SEQUENCE_CHECK='True'")
def check_sequence_to_filepath(seq_to_filepath, unicode_version, coverage):

View file

@ -98,7 +98,7 @@ def copy_with_rename(src_dir, dst_dir, accept_pred=None, rename=None):
def build_svg_dir(dst_dir, clean=False, emoji_dir='', flags_dir=''):
"""Copies/renames files from emoji_dir and then flags_dir, giving them the
standard format and prefix ('emoji_u' followed by codepoints expressed in hex
separated by underscore). If clean, removes the target dir before proceeding.
separated by underscore). If clean, removes the target dir before proceding.
If either emoji_dir or flags_dir are empty, skips them."""
dst_dir = tool_utils.ensure_dir_exists(dst_dir, clean=clean)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,188 +0,0 @@
"""Utility to add soft-light effect to NotoColorEmoji-COLRv1 region flags."""
import sys
import subprocess
from fontTools import ttLib
from fontTools.ttLib.tables import otTables as ot
from fontTools.ttLib.tables.C_P_A_L_ import Color
from fontTools.colorLib.builder import LayerListBuilder
from add_aliases import read_default_emoji_aliases
from flag_glyph_name import flag_code_to_glyph_name
from map_pua_emoji import get_glyph_name_from_gsub
REGIONAL_INDICATOR_RANGE = range(0x1F1E6, 0x1F1FF + 1)
BLACK_FLAG = 0x1F3F4
CANCEL_TAG = 0xE007F
TAG_RANGE = range(0xE0000, CANCEL_TAG + 1)
def is_flag(sequence):
# regular region flags are comprised of regional indicators
if all(cp in REGIONAL_INDICATOR_RANGE for cp in sequence):
return True
# subdivision flags start with black flag, contain some tag characters and end with
# a cancel tag
if (
len(sequence) > 2
and sequence[0] == BLACK_FLAG
and sequence[-1] == CANCEL_TAG
and all(cp in TAG_RANGE for cp in sequence[1:-1])
):
return True
return False
def read_makefile_variable(var_name):
# see `print-%` command in Makefile
value = subprocess.run(
["make", f"print-{var_name}"], capture_output=True, check=True
).stdout.decode("utf-8")
return value[len(var_name) + len(" = ") :].strip()
def flag_code_to_sequence(flag_code):
# I use the existing code to first convert from flag code to glyph name,
# and then convert names back to integer codepoints since it already
# handles both the region indicators and subdivision tags.
name = flag_code_to_glyph_name(flag_code)
assert name.startswith("u")
return tuple(int(v, 16) for v in name[1:].split("_"))
def all_flag_sequences():
"""Return the set of all noto-emoji's region and subdivision flag sequences.
These include those in SELECTED_FLAGS Makefile variable plus those listed
in the 'emoji_aliases.txt' file.
"""
result = {
flag_code_to_sequence(flag_code)
for flag_code in read_makefile_variable("SELECTED_FLAGS").split()
}
result.update(seq for seq in read_default_emoji_aliases() if is_flag(seq))
return result
_builder = LayerListBuilder()
def _build_paint(source):
return _builder.buildPaint(source)
def _paint_composite(source, mode, backdrop):
return _build_paint(
{
"Format": ot.PaintFormat.PaintComposite,
"SourcePaint": source,
"CompositeMode": mode,
"BackdropPaint": backdrop,
}
)
def _palette_index(cpal, color):
assert len(cpal.palettes) == 1
palette = cpal.palettes[0]
try:
i = palette.index(color)
except ValueError:
i = len(palette)
palette.append(color)
cpal.numPaletteEntries += 1
assert len(palette) == cpal.numPaletteEntries
return i
WHITE = Color.fromHex("#FFFFFFFF")
GRAY = Color.fromHex("#808080FF")
BLACK = Color.fromHex("#000000FF")
def _soft_light_gradient(cpal):
return _build_paint(
{
"Format": ot.PaintFormat.PaintLinearGradient,
"ColorLine": {
"Extend": "pad",
"ColorStop": [
{
"StopOffset": 0.0,
"PaletteIndex": _palette_index(cpal, WHITE),
"Alpha": 0.5,
},
{
"StopOffset": 0.5,
"PaletteIndex": _palette_index(cpal, GRAY),
"Alpha": 0.5,
},
{
"StopOffset": 1.0,
"PaletteIndex": _palette_index(cpal, BLACK),
"Alpha": 0.5,
},
],
},
"x0": 47,
"y0": 790,
"x1": 890,
"y1": -342,
"x2": -1085,
"y2": -53,
},
)
def flag_ligature_glyphs(font):
"""Yield ligature glyph names for all the region/subdivision flags in the font."""
for flag_sequence in all_flag_sequences():
flag_name = get_glyph_name_from_gsub(flag_sequence, font)
if flag_name is not None:
yield flag_name
def add_soft_light_to_flags(font, flag_glyph_names=None):
"""Add soft-light effect to region and subdivision flags in CORLv1 font."""
if flag_glyph_names is None:
flag_glyph_names = flag_ligature_glyphs(font)
colr_glyphs = {
rec.BaseGlyph: rec
for rec in font["COLR"].table.BaseGlyphList.BaseGlyphPaintRecord
}
cpal = font["CPAL"]
for flag_name in flag_glyph_names:
flag = colr_glyphs[flag_name]
flag.Paint = _paint_composite(
source=_paint_composite(
source=_soft_light_gradient(cpal),
mode=ot.CompositeMode.SRC_IN,
backdrop=flag.Paint,
),
mode=ot.CompositeMode.SOFT_LIGHT,
backdrop=flag.Paint,
)
def main():
try:
input_file, output_file = sys.argv[1:]
except ValueError:
print("usage: colrv1_add_soft_light_to_flags.py INPUT_FONT OUTPUT_FONT")
return 2
font = ttLib.TTFont(input_file)
if "COLR" not in font or font["COLR"].version != 1:
print("error: missing required COLRv1 table")
return 1
add_soft_light_to_flags(font)
font.save(output_file)
if __name__ == "__main__":
sys.exit(main())

View file

@ -1,99 +0,0 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Generate config files for Noto-COLRv1
from nanoemoji.util import rel
from pathlib import Path
_NOTO_FAMILY_NAME = "Noto Color Emoji"
_NOTO_SVG_DIR = Path("svg")
_REGIONAL_INDICATORS = {
Path(_NOTO_SVG_DIR / f"emoji_u{i:x}.svg") for i in range(0x1F1E6, 0x1F1FF + 1)
}
_NOTO_WAVED_FLAG_SVG_DIR = Path("third_party/region-flags/waved-svg")
_NOTO_SUBDIVISION_FLAGS = (
_NOTO_WAVED_FLAG_SVG_DIR / "emoji_u1f3f4_e0067_e0062_e0065_e006e_e0067_e007f.svg",
_NOTO_WAVED_FLAG_SVG_DIR / "emoji_u1f3f4_e0067_e0062_e0073_e0063_e0074_e007f.svg",
_NOTO_WAVED_FLAG_SVG_DIR / "emoji_u1f3f4_e0067_e0062_e0077_e006c_e0073_e007f.svg",
)
_CONFIG_DIR = Path("colrv1")
def _write_config(config_name, output_file, svg_files):
svg_files = [rel(_CONFIG_DIR, Path(f)) for f in svg_files]
config_file = f"{config_name}.toml"
for svg_file in svg_files:
assert _CONFIG_DIR.joinpath(
svg_file
).is_file(), f"{svg_file} not found relative to {_CONFIG_DIR}"
svg_list = ",\n ".join(f'"{f}"' for f in sorted(svg_files)).rstrip()
with open(_CONFIG_DIR / config_file, "w") as f:
f.write(
f"""
family = "{_NOTO_FAMILY_NAME}"
output_file = "{output_file}"
color_format = "glyf_colr_1"
clipbox_quantization = 32
[axis.wght]
name = "Weight"
default = 400
[master.regular]
style_name = "Regular"
srcs = [
{svg_list},
]
[master.regular.position]
wght = 400
"""
)
def _write_all_noto_configs():
# includes all of noto-emoji svgs plus all the waved region flags
regular = tuple(_NOTO_SVG_DIR.glob("*.svg"))
flags = tuple(_NOTO_WAVED_FLAG_SVG_DIR.glob("*.svg"))
dups = {p.name for p in regular} & {p.name for p in flags}
if dups:
raise ValueError(f"Flags *and* regular have {dups}")
svgs = regular + flags
_write_config("all", "NotoColorEmoji.ttf", svgs)
def _write_noto_noflag_configs():
# Does not contain regional indicators and the region flags that are
# composed with them. It still includes the England, Scotland and Wales
# 'subdivision' flags, as those are not composed with Unicode regional
# indicators, but use sequences of Unicode Tag letters prefixed with
# the Black Flag and ending with a Cancel Tag.
svgs = (
tuple(p for p in _NOTO_SVG_DIR.glob("*.svg") if p not in _REGIONAL_INDICATORS)
+ _NOTO_SUBDIVISION_FLAGS
)
_write_config("noflags", "NotoColorEmoji-noflags.ttf", svgs)
def main():
_write_all_noto_configs()
_write_noto_noflag_configs()
if __name__ == "__main__":
main()

View file

@ -1,345 +0,0 @@
"""
Post-nanoemoji processing of the Noto COLRv1 Emoji files.
Adds additional sequences to properly support Safari, corrects 'name', etc.
For now substantially based on copying from a correct bitmap build.
"""
from absl import app
import functools
from fontTools.feaLib.builder import addOpenTypeFeaturesFromString
from fontTools import ttLib
from fontTools.ttLib.tables import _g_l_y_f as glyf
from fontTools.ttLib.tables import otTables as ot
import map_pua_emoji
from nototools import add_vs_cmap
from nototools import font_data
from nototools import unicode_data
from pathlib import Path
import re
from colrv1_add_soft_light_to_flags import add_soft_light_to_flags
_CBDT_FILE = Path("fonts/NotoColorEmoji.ttf")
_COLR_FILES = {
Path("fonts/Noto-COLRv1-noflags.ttf"),
Path("fonts/Noto-COLRv1.ttf"),
}
def _is_colrv1(font):
return "COLR" in font and font["COLR"].version == 1
def _is_cbdt(font):
return "CBDT" in font
def _set_name(name_table, nameID):
name_table.getName(value, nameID, 3, 1, 0x409)
def _set_name(name_table, nameID, value):
name_table.setName(value, nameID, 3, 1, 0x409)
def _copy_names(colr_font, cbdt_font):
colr_font["name"] = cbdt_font["name"]
name_table = colr_font["name"]
assert all(
(n.platformID, n.platEncID, n.langID) == (3, 1, 0x409) for n in name_table.names
), "Should only have names Android uses"
# Amendments
_set_name(name_table, 10, "Color emoji font using COLRv1.")
_set_name(name_table, 11, "https://github.com/googlefonts/noto-emoji")
_set_name(name_table, 12, "https://github.com/googlefonts/noto-emoji")
# CBDT build step: @$(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua"
def _add_vs_cmap(colr_font):
emoji_variants = unicode_data.get_unicode_emoji_variants() | {
0x2640,
0x2642,
0x2695,
}
add_vs_cmap.modify_font("COLRv1 Emoji", colr_font, "emoji", emoji_variants)
def _is_variation_selector_cmap_table(table):
assert table.format in {4, 12, 14}
return table.format == 14
def _lookup_in_cmap(colr_font, codepoint):
result = set()
for table in colr_font["cmap"].tables:
if _is_variation_selector_cmap_table(table):
continue
assert codepoint in table.cmap
result.add(table.cmap[codepoint])
assert len(result) == 1, f"Ambiguous mapping for {codepoint}: {result}"
return next(iter(result))
def _add_cmap_entries(colr_font, codepoint, glyph_name):
for table in colr_font["cmap"].tables:
if _is_variation_selector_cmap_table(table):
continue
if not _is_bmp(codepoint) and table.format == 4:
continue
table.cmap[codepoint] = glyph_name
#print(f"Map 0x{codepoint:04x} to {glyph_name}, format {table.format}")
FLAG_TAGS = set(range(0xE0030, 0xE0039 + 1)) | set(range(0xE0061, 0xE007A + 1))
CANCEL_TAG = 0xE007F
def _map_missing_flag_tag_chars_to_empty_glyphs(colr_font):
# Add all tag characters used in flags + cancel tag
tag_cps = FLAG_TAGS | {CANCEL_TAG}
# Anything already cmap'd is fine
tag_cps -= set(_Cmap(colr_font).keys())
# CBDT maps these to blank glyphs
glyf_table = colr_font["glyf"]
hmtx_table = colr_font["hmtx"]
glyph_order_size = len(glyf_table.glyphOrder)
for cp in tag_cps:
#print(f"Map 0x{cp:04x} to a blank glyf")
glyph_name = f"u{cp:04X}"
assert glyph_name not in glyf_table, f"{glyph_name} already in glyf"
assert glyph_name not in hmtx_table.metrics, f"{glyph_name} already in hmtx"
glyf_table[glyph_name] = glyf.Glyph()
hmtx_table[glyph_name] = (0, 0)
_add_cmap_entries(colr_font, cp, glyph_name)
def _is_bmp(cp):
return cp in range(0x0000, 0xFFFF + 1)
def _ligaset_for_glyph(lookup_list, glyph_name):
for lookup in lookup_list.Lookup:
if lookup.LookupType != 4:
continue
for liga_set in lookup.SubTable:
if glyph_name in liga_set.ligatures:
return liga_set.ligatures[glyph_name]
return None
def _Cmap(ttfont):
def _Reducer(acc, u):
acc.update(u)
return acc
unicode_cmaps = (t.cmap for t in ttfont["cmap"].tables if t.isUnicode())
return functools.reduce(_Reducer, unicode_cmaps, {})
def _add_vertical_layout_tables(cbdt_font, colr_font):
upem_scale = colr_font["head"].unitsPerEm / cbdt_font["head"].unitsPerEm
vhea = colr_font["vhea"] = ttLib.newTable("vhea")
vhea.tableVersion = 0x00010000
vhea.ascent = round(cbdt_font["vhea"].ascent * upem_scale)
vhea.descent = round(cbdt_font["vhea"].descent * upem_scale)
vhea.lineGap = 0
# most of the stuff below is recalculated by the compiler, but still needs to be
# initialized... ¯\_(ツ)_/¯
vhea.advanceHeightMax = 0
vhea.minTopSideBearing = 0
vhea.minBottomSideBearing = 0
vhea.yMaxExtent = 0
vhea.caretSlopeRise = 0
vhea.caretSlopeRun = 0
vhea.caretOffset = 0
vhea.reserved0 = 0
vhea.reserved1 = 0
vhea.reserved2 = 0
vhea.reserved3 = 0
vhea.reserved4 = 0
vhea.metricDataFormat = 0
vhea.numberOfVMetrics = 0
# emoji font is monospaced -- except for an odd uni0000 (NULL) glyph which happens
# to have height=0; but colrv1 font doesn't have that anyway, so I just skip it
cbdt_heights = set(h for h, _ in cbdt_font["vmtx"].metrics.values() if h != 0)
assert len(cbdt_heights) == 1, "NotoColorEmoji CBDT font should be monospaced!"
height = round(cbdt_heights.pop() * upem_scale)
vmtx = colr_font["vmtx"] = ttLib.newTable("vmtx")
vmtx.metrics = {}
for gn in colr_font.getGlyphOrder():
vmtx.metrics[gn] = height, 0
UNKNOWN_FLAG_PUA = 0xFE82B
BLACK_FLAG = 0x1F3F4
REGIONAL_INDICATORS = set(range(0x1F1E6, 0x1F1FF + 1))
def _add_fallback_subs_for_unknown_flags(colr_font):
"""Add GSUB lookups to replace unsupported flag sequences with the 'unknown flag'.
In order to locate the unknown flag, the glyph must be mapped to 0xFE82B PUA code;
the latter is removed from the cmap table after the GSUB has been updated.
"""
cmap = _Cmap(colr_font)
unknown_flag = cmap[UNKNOWN_FLAG_PUA]
black_flag = cmap[BLACK_FLAG]
cancel_tag = cmap[CANCEL_TAG]
flag_tags = sorted(cmap[cp] for cp in FLAG_TAGS)
# in the *-noflags.ttf font there are no region flags thus this list is empty
regional_indicators = sorted(cmap[cp] for cp in REGIONAL_INDICATORS if cp in cmap)
classes = f'@FLAG_TAGS = [{" ".join(flag_tags)}];\n'
if regional_indicators:
classes += f"""
@REGIONAL_INDICATORS = [{" ".join(regional_indicators)}];
@UNKNOWN_FLAG = [{" ".join([unknown_flag] * len(regional_indicators))}];
"""
lookups = (
# the first lookup is a dummy that stands for the emoji sequences ligatures
# from the destination font; we only use it to ensure the lookup indices match.
# We can't leave it empty otherwise feaLib optimizes it away.
f"""
lookup placeholder {{
sub {unknown_flag} {unknown_flag} by {unknown_flag};
}} placeholder;
"""
+ "\n".join(
["lookup delete_glyph {"]
+ [f" sub {g} by NULL;" for g in sorted(regional_indicators + flag_tags)]
+ ["} delete_glyph;"]
)
+ (
"""
lookup replace_with_unknown_flag {
sub @REGIONAL_INDICATORS by @UNKNOWN_FLAG;
} replace_with_unknown_flag;
"""
if regional_indicators
else "\n"
)
)
features = (
"languagesystem DFLT dflt;\n"
+ classes
+ lookups
+ "feature ccmp {"
+ f"""
lookup placeholder;
sub {black_flag} @FLAG_TAGS' lookup delete_glyph;
sub {black_flag} {cancel_tag} by {unknown_flag};
"""
+ (
"""
sub @REGIONAL_INDICATORS' lookup replace_with_unknown_flag
@REGIONAL_INDICATORS' lookup delete_glyph;
"""
if regional_indicators
else ""
)
+ "} ccmp;"
)
# feaLib always builds a new GSUB table (can't update one in place) so we have to
# use an empty TTFont and then update our GSUB with the newly built lookups
temp_font = ttLib.TTFont()
temp_font.setGlyphOrder(colr_font.getGlyphOrder())
addOpenTypeFeaturesFromString(temp_font, features)
temp_gsub = temp_font["GSUB"].table
# sanity check
assert len(temp_gsub.FeatureList.FeatureRecord) == 1
assert temp_gsub.FeatureList.FeatureRecord[0].FeatureTag == "ccmp"
temp_ccmp = temp_gsub.FeatureList.FeatureRecord[0].Feature
colr_gsub = colr_font["GSUB"].table
ccmps = [
r.Feature for r in colr_gsub.FeatureList.FeatureRecord if r.FeatureTag == "ccmp"
]
assert len(ccmps) == 1, f"expected only 1 'ccmp' feature record, found {len(ccmps)}"
colr_ccmp = ccmps[0]
colr_lookups = colr_gsub.LookupList.Lookup
assert (
len(colr_lookups) == 1
), f"expected only 1 lookup in COLRv1's GSUB.LookupList, found {len(colr_lookups)}"
assert (
colr_lookups[0].LookupType == 4
), f"expected Lookup[0] of type 4 in COLRv1, found {colr_lookups[0].LookupType}"
colr_lookups.extend(temp_gsub.LookupList.Lookup[1:])
colr_gsub.LookupList.LookupCount = len(colr_lookups)
colr_ccmp.LookupListIndex = temp_ccmp.LookupListIndex
colr_ccmp.LookupCount = len(colr_ccmp.LookupListIndex)
# get rid of the Unknown Flag private codepoint as no longer needed
font_data.delete_from_cmap(colr_font, [UNKNOWN_FLAG_PUA])
def _set_no_font_embedding_restrictions(colr_font):
# The CBDT/CBLC NotoColorEmoji has OS/2.fsType = 0 (i.e. no embedding restrictions)
# so the COLRv1 variant must also have no such restrictions.
# https://github.com/notofonts/noto-fonts/issues/2408
# https://github.com/google/fonts/issues/5729
colr_font["OS/2"].fsType = 0
def _set_head_version_to_name_version(colr_font):
# head.fontRevision and the version on name 5 should match
name_version = colr_font['name'].getName(5, 3, 1, 0x409)
assert name_version is not None, "No version found in 'name'"
name_version = name_version.toUnicode()
match = re.match(r'^Version (\d+[.]\d+);GOOG;', name_version)
assert match is not None, f"Unable to parse version from '{name_version}'"
colr_font["head"].fontRevision = float(match.group(1))
def _font(path, check_fn, check_fail_str):
assert path.is_file(), path
font = ttLib.TTFont(path)
if not check_fn(font):
raise ValueError(path + check_fail_str)
return font
def main(_):
cbdt_font = _font(_CBDT_FILE, _is_cbdt, " must be a CBDT font")
for colr_file in _COLR_FILES:
colr_font = _font(colr_file, _is_colrv1, " must be a COLRv1 font")
print(f"Updating {colr_file} from {_CBDT_FILE}")
_copy_names(colr_font, cbdt_font)
# CBDT build step: @$(PYTHON) $(PUA_ADDER) "$@" "$@-with-pua"
map_pua_emoji.add_pua_cmap_to_font(colr_font)
_add_vs_cmap(colr_font)
_map_missing_flag_tag_chars_to_empty_glyphs(colr_font)
add_soft_light_to_flags(colr_font)
_add_vertical_layout_tables(cbdt_font, colr_font)
_add_fallback_subs_for_unknown_flags(colr_font)
_set_no_font_embedding_restrictions(colr_font)
_set_head_version_to_name_version(colr_font)
print("Writing", colr_file)
colr_font.save(colr_file)
if __name__ == "__main__":
app.run(main)

View file

@ -1,48 +0,0 @@
"""Removes regional indicators from a font."""
from fontTools import subset
from fontTools import ttLib
import functools
from pathlib import Path
import sys
from typing import Set
def codepoints(font: ttLib.TTFont) -> Set[int]:
unicode_cmaps = (t.cmap.keys() for t in font['cmap'].tables if t.isUnicode())
return functools.reduce(lambda acc, u: acc | u, unicode_cmaps, set())
def is_regional_indicator(cp: int) -> bool:
return 0x1F1E6 <= cp <= 0x1F1FF
def main(argv):
for font_file in sorted(argv[1:]):
font_file = Path(font_file)
assert font_file.is_file(), font_file
noflags_file = font_file.with_stem(font_file.stem + "-noflags")
if noflags_file.is_file():
print(font_file, "already has", noflags_file, "; nop")
continue
font = ttLib.TTFont(font_file)
cps = codepoints(font)
cps_without_flags = {cp for cp in cps if not is_regional_indicator(cp)}
if cps == cps_without_flags:
print(font_file, "has no regional indicators")
continue
subsetter = subset.Subsetter()
subsetter.populate(unicodes=cps_without_flags)
subsetter.subset(font)
font.save(noflags_file)
print(font_file, "=>" , noflags_file)
if __name__ == '__main__':
main(sys.argv)

View file

@ -1,36 +0,0 @@
"""Set COLRv1 fontRevision from CBDT.
Used for bugfix, should fix to set properly on build instead.
"""
from fontTools import ttLib
from pathlib import Path
import sys
NAME_ID_VERSION = 5
def name(font, name_id):
return ",".join(n.toUnicode() for n in font["name"].names if n.isUnicode() and n.nameID == name_id)
def main():
colr_font_files = sorted(p for p in (Path(__file__).parent / "fonts").iterdir() if p.name.startswith("Noto-COLRv1"))
for colr_font_file in colr_font_files:
cbdt_font_file = colr_font_file.with_stem(colr_font_file.stem.replace("Noto-COLRv1", "NotoColorEmoji"))
colr_font = ttLib.TTFont(colr_font_file)
cbdt_font = ttLib.TTFont(cbdt_font_file)
assert "CBDT" in cbdt_font
assert "COLR" in colr_font
colr_font["head"].fontRevision = cbdt_font["head"].fontRevision
colr_font.save(colr_font_file)
if __name__ == '__main__':
main()

View file

@ -1,36 +0,0 @@
U+1f1e6
U+1f1e7
U+1f1e8
U+1f1e9
U+1f1ea
U+1f1eb
U+1f1ec
U+1f1ed
U+1f1ee
U+1f1ef
U+1f1f0
U+1f1f1
U+1f1f2
U+1f1f3
U+1f1f4
U+1f1f5
U+1f1f6
U+1f1f7
U+1f1f8
U+1f1f9
U+1f1fa
U+1f1fb
U+1f1fc
U+1f1fd
U+1f1fe
U+1f1ff
U+fe4e5
U+fe4e6
U+fe4e7
U+fe4e8
U+fe4e9
U+fe4ea
U+fe4eb
U+fe4ec
U+fe4ed
U+fe4ee

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
fonts/NotoEmoji-Regular.ttf Normal file

Binary file not shown.

View file

@ -1,60 +0,0 @@
#!/usr/bin/env bash
set -e
set -v
# We have to have hb-subset on PATH
which hb-subset
# Build the CBDT font
rm -rf venv # in case you have an old borked venv!
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
rm -rf emojicompat
git clone git@github.com:googlefonts/emojicompat.git
pip install emojicompat/
# Validation
python size_check.py
rm -rf build/ && time make -j 48
# Should take 2-3 minutes to create noto-emoji/NotoColorEmoji.ttf
mv *.ttf fonts/
# make noflags CBDT font
rm fonts/NotoColorEmoji-noflags.ttf
python drop_flags.py fonts/NotoColorEmoji.ttf
# Build the COLRv1 font (slow)
python colrv1_generate_configs.py
git diff colrv1/*.toml
# Compile the fonts
# Should take ~20 minutes
(cd colrv1 && rm -rf build/ && time nanoemoji *.toml)
cp colrv1/build/NotoColorEmoji.ttf fonts/Noto-COLRv1.ttf
cp colrv1/build/NotoColorEmoji-noflags.ttf fonts/Noto-COLRv1-noflags.ttf
# Post-process them
python colrv1_postproc.py
# Produce emojicompat variants
# Add support for new sequences per https://github.com/googlefonts/emojicompat#support-new-unicode-sequences
pushd fonts
cp NotoColorEmoji.ttf NotoColorEmoji-emojicompat.ttf
cp Noto-COLRv1.ttf Noto-COLRv1-emojicompat.ttf
emojicompat --op setup --font NotoColorEmoji-emojicompat.ttf
emojicompat --op setup --font Noto-COLRv1-emojicompat.ttf
emojicompat --op check --font NotoColorEmoji-emojicompat.ttf
emojicompat --op check --font Noto-COLRv1-emojicompat.ttf
popd
hb-subset --unicodes-file=flags-only-unicodes.txt \
--output-file=fonts/NotoColorEmoji-flagsonly.ttf \
fonts/NotoColorEmoji.ttf
python update_flag_name.py

View file

@ -29,15 +29,15 @@ at commit a8a215d2e889 and date 20170220 (since dates are a bit easier
to locate in time than commit hashes).
For building with external data we don't include the commit id as we
might be using different resources. Instead the version string is:
might be using different resoruces. Instead the version string is:
Version 1.39;GOOG;noto-emoji:20170518;BETA <msg>
Here the date is the current date, and the message after 'BETA ' is
provided using the '-b' flag. There's no commit hash. This also
bypasses some checks about the state of the repo.
The release number should have 2 or 3 minor digits. Right now we've been
using 2 but at the next major release we probably want to use 3. This
The relase number should have 2 or 3 minor digits. Right now we've been
using 2 but at the next major relase we probably want to use 3. This
supports both. It will bump the version number if none is provided,
maintaining the minor digit length.
"""
@ -153,7 +153,7 @@ def _replace_existing_version(lines, version, version_str):
def update_version(srcfile, dstfile, version, beta):
"""Update version in srcfile and write to dstfile. If version is None,
bumps the current version, else version must be greater than the
current version."""
current verison."""
with open(srcfile, 'r') as f:
lines = f.readlines()

View file

@ -50,7 +50,9 @@ def get_glyph_name_from_gsub(char_seq, font):
return None
def add_pua_cmap_to_font(font):
def add_pua_cmap(source_file, target_file):
"""Add PUA characters to the cmap of the first font and save as second."""
font = ttLib.TTFont(source_file)
cmap = font_data.get_cmap(font)
for pua, (ch1, ch2) in itertools.chain(
add_emoji_gsub.EMOJI_KEYCAPS.items(), add_emoji_gsub.EMOJI_FLAGS.items()
@ -59,12 +61,6 @@ def add_pua_cmap_to_font(font):
glyph_name = get_glyph_name_from_gsub([ch1, ch2], font)
if glyph_name is not None:
cmap[pua] = glyph_name
def add_pua_cmap(source_file, target_file):
"""Add PUA characters to the cmap of the first font and save as second."""
font = ttLib.TTFont(source_file)
add_pua_cmap_to_font(font)
font.save(target_file)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Some files were not shown because too many files have changed in this diff Show more