diff options
author | Roozbeh Pournader <roozbeh@google.com> | 2015-06-04 19:16:19 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2015-06-05 11:13:31 -0700 |
commit | b9baf6673f863cd96744c4063264193b6a1d7686 (patch) | |
tree | 8ccf1053773cf81608f5dddcdc4434b07d7b3f50 | |
parent | f68ac3267f67c0011c6c1ed87ecd60df716b9228 (diff) | |
download | noto-fonts-b9baf6673f863cd96744c4063264193b6a1d7686.tar.gz |
Subset Noto Sans Symbols in a curated way.
Noto Sans Symbols is now subsetted in a curated way. Changes include:
* Currency symbols now included in Roboto are removed.
* All combining marks for symbols (except for combining keycap) are
added, to combine with other symbols if needed.
* Characters in symbol blocks that are also covered by Noto CJK fonts
are added, for better harmony with the rest of the fonts in non-CJK
settings. The dentistry characters at U+23BE..23CC are not added,
since they appear to be Japan-only and full-width.
* Characters that UTR #51 defines as default text are added, although
they may also exist in the color emoji font, to make sure they get
a default text style.
* Characters that UTR #51 defines as default emoji are removed, to
make sure they don't block the fallback to the color emoji font.
* A few math symbols that are currently included in Roboto are added,
to prepare for potentially removing them from Roboto when they are
lower-quality in Roboto.
The superset font, NotoSansSymbols-Regular.ttf is also updated to the
result of 'make android' target in upstream Noto, catching up with
the rest of the fonts.
Bug: 17244669
Bug: 20954421
Bug: 21500703
Bug: 21501669
Bug: 21502245
Bug: 21502678
Bug: 21503807
Bug: 21503952
Bug: 21517912
Bug: 21518544
Bug: 21520316
Bug: 21521330
Bug: 21524018
Bug: 21524421
Bug: 21525012
Bug: 21525318
Bug: 21525905
Bug: 21561723
Change-Id: I49d8c865339fd35a06af5a2320bbea34e3159955
-rw-r--r-- | Android.mk | 23 | ||||
-rw-r--r-- | other/NotoSansSymbols-Regular-Subsetted-Extended.ttf | bin | 248484 -> 0 bytes | |||
-rw-r--r-- | other/NotoSansSymbols-Regular-Subsetted.ttf | bin | 133624 -> 273528 bytes | |||
-rw-r--r-- | other/NotoSansSymbols-Regular.ttf | bin | 775080 -> 769016 bytes | |||
-rwxr-xr-x | other/subset_noto_sans_symbols.py | 200 |
5 files changed, 202 insertions, 21 deletions
@@ -212,7 +212,8 @@ font_src_files += \ NotoSansGeorgian-Regular.ttf \ NotoSansGeorgian-Bold.ttf \ NotoSansHebrew-Regular.ttf \ - NotoSansHebrew-Bold.ttf + NotoSansHebrew-Bold.ttf \ + NotoSansSymbols-Regular-Subsetted.ttf endif # !MINIMAL_FONT_FOOTPRINT $(foreach f, $(font_src_files), $(call build-one-font-module, $(f))) @@ -220,26 +221,6 @@ build-one-font-module := font_src_files := ############################################################################# -# Use a larger subset of Noto Sans Symbols on EXTENDED_FONT_FOOTPRINT -# builds, but a smaller subset on other devices. -############################################################################# -ifeq ($(EXTENDED_FONT_FOOTPRINT),true) -noto_symbols_src := NotoSansSymbols-Regular-Subsetted-Extended.ttf -else # !EXTENDED_FONT_FOOTPRINT -noto_symbols_src := NotoSansSymbols-Regular-Subsetted.ttf -endif # EXTENDED_FONT_FOOTPRINT - -include $(CLEAR_VARS) -LOCAL_MODULE := NotoSansSymbols-Regular-Subsetted.ttf -LOCAL_SRC_FILES := $(noto_symbols_src) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts -include $(BUILD_PREBUILT) - -noto_symbols_src := - -############################################################################# # Use Noto Color Emoji with all the flags on EXTENDED_FONT_FOOTPRINT builds, # but without it on other builds. On SMALLER_FONT_FOOTPRINT devices, no # color emoji font is included. diff --git a/other/NotoSansSymbols-Regular-Subsetted-Extended.ttf b/other/NotoSansSymbols-Regular-Subsetted-Extended.ttf Binary files differdeleted file mode 100644 index 57ed32c..0000000 --- a/other/NotoSansSymbols-Regular-Subsetted-Extended.ttf +++ /dev/null diff --git a/other/NotoSansSymbols-Regular-Subsetted.ttf b/other/NotoSansSymbols-Regular-Subsetted.ttf Binary files differindex 7c4227e..6495140 100644 --- a/other/NotoSansSymbols-Regular-Subsetted.ttf +++ b/other/NotoSansSymbols-Regular-Subsetted.ttf diff --git a/other/NotoSansSymbols-Regular.ttf b/other/NotoSansSymbols-Regular.ttf Binary files differindex 5f38857..d97bf96 100644 --- a/other/NotoSansSymbols-Regular.ttf +++ b/other/NotoSansSymbols-Regular.ttf diff --git a/other/subset_noto_sans_symbols.py b/other/subset_noto_sans_symbols.py new file mode 100755 index 0000000..3c0a23e --- /dev/null +++ b/other/subset_noto_sans_symbols.py @@ -0,0 +1,200 @@ +#!/usr/bin/python +# coding=UTF-8 +# +# Copyright 2014 Google Inc. All rights reserved. +# +# 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. + +"""Create a curated subset of NotoSansSymbols for Android.""" + +__author__ = 'roozbeh@google.com (Roozbeh Pournader)' + +import sys + +from nototools import subset +from nototools import unicode_data + +# Unicode blocks that we want to include in the font +BLOCKS_TO_INCLUDE = """ +20D0..20FF; Combining Diacritical Marks for Symbols +2100..214F; Letterlike Symbols +2190..21FF; Arrows +2200..22FF; Mathematical Operators +2300..23FF; Miscellaneous Technical +2400..243F; Control Pictures +2440..245F; Optical Character Recognition +2460..24FF; Enclosed Alphanumerics +2500..257F; Box Drawing +2580..259F; Block Elements +25A0..25FF; Geometric Shapes +2600..26FF; Miscellaneous Symbols +2700..27BF; Dingbats +27C0..27EF; Miscellaneous Mathematical Symbols-A +27F0..27FF; Supplemental Arrows-A +2800..28FF; Braille Patterns +2A00..2AFF; Supplemental Mathematical Operators +""" + +# One-off characters to be included, needed for backward compatibility and +# supporting various character sets, including ARIB sets and black and white +# emoji +ONE_OFF_ADDITIONS = { + 0x27D0, # ⟐ WHITE DIAMOND WITH CENTRED DOT + 0x2934, # ⤴ ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS + 0x2935, # ⤵ ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS + 0x2985, # ⦅ LEFT WHITE PARENTHESIS + 0x2986, # ⦆ RIGHT WHITE PARENTHESIS + 0x2B05, # ⬅ LEFTWARDS BLACK ARROW + 0x2B06, # ⬆ UPWARDS BLACK ARROW + 0x2B07, # ⬇ DOWNWARDS BLACK ARROW + 0x2B24, # ⬤ BLACK LARGE CIRCLE + 0x2B2E, # ⬮ BLACK VERTICAL ELLIPSE + 0x2B2F, # ⬯ WHITE VERTICAL ELLIPSE + 0x2B56, # ⭖ HEAVY OVAL WITH OVAL INSIDE + 0x2B57, # ⭗ HEAVY CIRCLE WITH CIRCLE INSIDE + 0x2B58, # ⭘ HEAVY CIRCLE + 0x2B59, # ⭙ HEAVY CIRCLED SALTIRE +} + +# letter-based characters, provided by Roboto +LETTERLIKE_CHARS_IN_ROBOTO = { + 0x2100, # ℀ ACCOUNT OF + 0x2101, # ℁ ADDRESSED TO THE SUBJECT + 0x2103, # ℃ DEGREE CELSIUS + 0x2105, # ℅ CARE OF + 0x2106, # ℆ CADA UNA + 0x2109, # ℉ DEGREE FAHRENHEIT + 0x2113, # ℓ SCRIPT SMALL L + 0x2116, # № NUMERO SIGN + 0x2117, # ℗ SOUND RECORDING COPYRIGHT + 0x211E, # ℞ PRESCRIPTION TAKE + 0x211F, # ℟ RESPONSE + 0x2120, # ℠ SERVICE MARK + 0x2121, # ℡ TELEPHONE SIGN + 0x2122, # ™ TRADE MARK SIGN + 0x2123, # ℣ VERSICLE + 0x2125, # ℥ OUNCE SIGN + 0x2126, # Ω OHM SIGN + 0x212A, # K KELVIN SIGN + 0x212B, # Å ANGSTROM SIGN + 0x212E, # ℮ ESTIMATED SYMBOL + 0x2132, # Ⅎ TURNED CAPITAL F + 0x213B, # ℻ FACSIMILE SIGN + 0x214D, # ⅍ AKTIESELSKAB + 0x214F, # ⅏ SYMBOL FOR SAMARITAN SOURCE +} + +# default emoji characters in the BMP, based on +# http://www.unicode.org/draft/Public/emoji/1.0/emoji-data.txt +# We exclude these, so we don't block color emoji. +BMP_DEFAULT_EMOJI = { + 0x231A, # ⌚ WATCH + 0x231B, # ⌛ HOURGLASS + 0x23E9, # ⏩ BLACK RIGHT-POINTING DOUBLE TRIANGLE + 0x23EA, # ⏪ BLACK LEFT-POINTING DOUBLE TRIANGLE + 0x23EB, # ⏫ BLACK UP-POINTING DOUBLE TRIANGLE + 0x23EC, # ⏬ BLACK DOWN-POINTING DOUBLE TRIANGLE + 0x23F0, # ⏰ ALARM CLOCK + 0x23F3, # ⏳ HOURGLASS WITH FLOWING SAND + 0x25FD, # ◽ WHITE MEDIUM SMALL SQUARE + 0x25FE, # ◾ BLACK MEDIUM SMALL SQUARE + 0x2614, # ☔ UMBRELLA WITH RAIN DROPS + 0x2615, # ☕ HOT BEVERAGE + 0x2648, # ♈ ARIES + 0x2649, # ♉ TAURUS + 0x264A, # ♊ GEMINI + 0x264B, # ♋ CANCER + 0x264C, # ♌ LEO + 0x264D, # ♍ VIRGO + 0x264E, # ♎ LIBRA + 0x264F, # ♏ SCORPIUS + 0x2650, # ♐ SAGITTARIUS + 0x2651, # ♑ CAPRICORN + 0x2652, # ♒ AQUARIUS + 0x2653, # ♓ PISCES + 0x267F, # ♿ WHEELCHAIR SYMBOL + 0x2693, # ⚓ ANCHOR + 0x26A1, # ⚡ HIGH VOLTAGE SIGN + 0x26AA, # ⚪ MEDIUM WHITE CIRCLE + 0x26AB, # ⚫ MEDIUM BLACK CIRCLE + 0x26BD, # ⚽ SOCCER BALL + 0x26BE, # ⚾ BASEBALL + 0x26C4, # ⛄ SNOWMAN WITHOUT SNOW + 0x26C5, # ⛅ SUN BEHIND CLOUD + 0x26CE, # ⛎ OPHIUCHUS + 0x26D4, # ⛔ NO ENTRY + 0x26EA, # ⛪ CHURCH + 0x26F2, # ⛲ FOUNTAIN + 0x26F3, # ⛳ FLAG IN HOLE + 0x26F5, # ⛵ SAILBOAT + 0x26FA, # ⛺ TENT + 0x26FD, # ⛽ FUEL PUMP + 0x2705, # ✅ WHITE HEAVY CHECK MARK + 0x270A, # ✊ RAISED FIST + 0x270B, # ✋ RAISED HAND + 0x2728, # ✨ SPARKLES + 0x274C, # ❌ CROSS MARK + 0x274E, # ❎ NEGATIVE SQUARED CROSS MARK + 0x2753, # ❓ BLACK QUESTION MARK ORNAMENT + 0x2754, # ❔ WHITE QUESTION MARK ORNAMENT + 0x2755, # ❕ WHITE EXCLAMATION MARK ORNAMENT + 0x2757, # ❗ HEAVY EXCLAMATION MARK SYMBOL + 0x2795, # ➕ HEAVY PLUS SIGN + 0x2796, # ➖ HEAVY MINUS SIGN + 0x2797, # ➗ HEAVY DIVISION SIGN + 0x27B0, # ➰ CURLY LOOP + 0x27BF, # ➿ DOUBLE CURLY LOOP + 0x2B1B, # ⬛ BLACK LARGE SQUARE + 0x2B1C, # ⬜ WHITE LARGE SQUARE + 0x2B50, # ⭐ WHITE MEDIUM STAR + 0x2B55, # ⭕ HEAVY LARGE CIRCLE +} + + +def main(argv): + """Subset the Noto Symbols font. + + The first argument is the source file name, and the second argument is + the target file name. + """ + + target_coverage = set() + # Add all characters in BLOCKS_TO_INCLUDE + for first, last, _ in unicode_data._parse_code_ranges(BLOCKS_TO_INCLUDE): + target_coverage.update(range(first, last+1)) + + # Add one-off characters + target_coverage |= ONE_OFF_ADDITIONS + # Remove characters preferably coming from Roboto + target_coverage -= LETTERLIKE_CHARS_IN_ROBOTO + # Remove characters that are supposed to default to emoji + target_coverage -= BMP_DEFAULT_EMOJI + + # Remove dentistry symbols, as their main use appears to be for CJK: + # http://www.unicode.org/L2/L2000/00098-n2195.pdf + target_coverage -= set(range(0x23BE, 0x23CC+1)) + + # Remove COMBINING ENCLOSING KEYCAP. It's needed for Android's color emoji + # mechanism to work properly + target_coverage.remove(0x20E3) + + source_file_name = argv[1] + target_file_name = argv[2] + subset.subset_font( + source_file_name, + target_file_name, + include=target_coverage) + + +if __name__ == '__main__': + main(sys.argv) |