fonts: Include in fake Arial all the codepoints from the original font.

New fonts are from https://github.com/notofonts/noto-fonts.git at
2725c70baa8b0176c7577093ba1fc6179aa79478, in the hinted/ttf folder.
This commit is contained in:
Giovanni Mascellani 2023-01-25 19:40:10 +01:00 committed by Arkadiusz Hiler
parent a6f3965460
commit 3d635bd789
7 changed files with 206 additions and 21 deletions

View file

@ -740,31 +740,34 @@ noto_sans.ttf = $(FONTS)/noto/NotoSans-Regular.ttf
noto_sans_arabic.ttf = $(FONTS)/noto/NotoSansArabic-Regular.ttf
noto_sans_armenian.ttf = $(FONTS)/noto/NotoSansArmenian-Regular.ttf
noto_sans_bengali.ttf = $(FONTS)/noto/NotoSansBengali-Regular.ttf
noto_sans_bengaliui.ttf = $(FONTS)/noto/NotoSansBengaliUI-Regular.ttf
noto_sans_coptic.ttf = $(FONTS)/noto/NotoSansCoptic-Regular.ttf
noto_sans_devanagariui.ttf = $(FONTS)/noto/NotoSansDevanagariUI-Regular.ttf
noto_sans_georgian.ttf = $(FONTS)/noto/NotoSansGeorgian-Regular.ttf
noto_sans_gujarati.ttf = $(FONTS)/noto/NotoSansGujarati-Regular.ttf
noto_sans_hebrew.ttf = $(FONTS)/noto/NotoSansHebrew-Regular.ttf
noto_sans_khmer.ttf = $(FONTS)/noto/NotoSansKhmer-Regular.ttf
noto_sans_tamil.ttf = $(FONTS)/noto/NotoSansTamil-Regular.ttf
noto_sans_thaana.ttf = $(FONTS)/noto/NotoSansThaana-Regular.ttf
noto_sans_thai.ttf = $(FONTS)/noto/NotoSansThai-Regular.ttf
micross.ttf = $(FONTS_OBJ)/micross.ttf
noto_sans_bengaliui.ttf = $(FONTS)/noto/NotoSansBengaliUI-Regular.ttf
noto_sans_devanagariui.ttf = $(FONTS)/noto/NotoSansDevanagariUI-Regular.ttf
noto_sans_gujaratiui.ttf = $(FONTS)/noto/NotoSansGujaratiUI-Regular.ttf
noto_sans_gurmukhiui.ttf = $(FONTS)/noto/NotoSansGurmukhiUI-Regular.ttf
noto_sans_hebrew.ttf = $(FONTS)/noto/NotoSansHebrew-Regular.ttf
noto_sans_kannadaui.ttf = $(FONTS)/noto/NotoSansKannadaUI-Regular.ttf
noto_sans_khmer.ttf = $(FONTS)/noto/NotoSansKhmer-Regular.ttf
noto_sans_malayalamui.ttf = $(FONTS)/noto/NotoSansMalayalamUI-Regular.ttf
noto_sans_math.ttf = $(FONTS)/noto/NotoSansMath-Regular.ttf
noto_sans_meeteimayek.ttf = $(FONTS)/noto/NotoSansMeeteiMayek-Regular.ttf
noto_sans_mono.ttf = $(FONTS)/noto/NotoSansMono-Regular.ttf
noto_sans_olchiki.ttf = $(FONTS)/noto/NotoSansOlChiki-Regular.ttf
noto_sans_oriyaui.ttf = $(FONTS)/noto/NotoSansOriyaUI-Regular.ttf
noto_sans_sinhalaui.ttf = $(FONTS)/noto/NotoSansSinhalaUI-Regular.ttf
noto_sans_sorasompeng.ttf = $(FONTS)/noto/NotoSansSoraSompeng-Regular.ttf
noto_sans_symbols.ttf = $(FONTS)/noto/NotoSansSymbols-Regular.ttf
noto_sans_symbols2.ttf = $(FONTS)/noto/NotoSansSymbols2-Regular.ttf
noto_sans_tamil.ttf = $(FONTS)/noto/NotoSansTamil-Regular.ttf
noto_sans_tamilui.ttf = $(FONTS)/noto/NotoSansTamilUI-Regular.ttf
noto_sans_teluguui.ttf = $(FONTS)/noto/NotoSansTeluguUI-Regular.ttf
nirmala.ttf = $(FONTS_OBJ)/nirmala.ttf
noto_sans_thaana.ttf = $(FONTS)/noto/NotoSansThaana-Regular.ttf
noto_sans_thai.ttf = $(FONTS)/noto/NotoSansThai-Regular.ttf
micross.ttf = $(FONTS_OBJ)/micross.ttf
nirmala.ttf = $(FONTS_OBJ)/nirmala.ttf
alt_arial.ttf = $(ALT_FONTS_OBJ)/arial.ttf
#The use of "Arial" here is for compatibility with programs that require that exact string. This font is not Arial.
@ -834,7 +837,7 @@ $(micross.ttf): $(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_arabic.tt
$(noto_sans_thaana.ttf) $(noto_sans_thai.ttf)
$(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_arabic.ttf) $(noto_sans_armenian.ttf) $(noto_sans_bengali.ttf) \
$(noto_sans_coptic.ttf) $(noto_sans_georgian.ttf) $(noto_sans_gujarati.ttf) $(noto_sans_hebrew.ttf) $(noto_sans_khmer.ttf) \
$(noto_sans_tamil.ttf) $(noto_sans_thaana.ttf) $(noto_sans_thai.ttf) "MicrosoftSansSerif" "Microsoft Sans Serif" "Regular" $(micross.ttf)
$(noto_sans_tamil.ttf) $(noto_sans_thaana.ttf) $(noto_sans_thai.ttf) "MicrosoftSansSerif" "Microsoft Sans Serif" "Regular" /dev/null $(micross.ttf)
$(nirmala.ttf): $(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_bengaliui.ttf) $(noto_sans_devanagariui.ttf) $(noto_sans_gujaratiui.ttf) $(noto_sans_gurmukhiui.ttf) \
$(noto_sans_kannadaui.ttf) $(noto_sans_malayalamui.ttf) $(noto_sans_meeteimayek.ttf) $(noto_sans_olchiki.ttf) $(noto_sans_oriyaui.ttf) \
@ -842,10 +845,12 @@ $(nirmala.ttf): $(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_bengaliui
$(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_bengaliui.ttf) $(noto_sans_devanagariui.ttf) $(noto_sans_gujaratiui.ttf) \
$(noto_sans_gurmukhiui.ttf) $(noto_sans_kannadaui.ttf) $(noto_sans_malayalamui.ttf) $(noto_sans_meeteimayek.ttf) $(noto_sans_olchiki.ttf) \
$(noto_sans_oriyaui.ttf) $(noto_sans_sinhalaui.ttf) $(noto_sans_sorasompeng.ttf) $(noto_sans_tamilui.ttf) $(noto_sans_teluguui.ttf) \
"NirmalaUI" "Nirmala UI" "Regular" $(nirmala.ttf)
"NirmalaUI" "Nirmala UI" "Regular" /dev/null $(nirmala.ttf)
$(alt_arial.ttf): $(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_arabic.ttf) $(noto_sans_hebrew.ttf) | $(ALT_FONTS_OBJ)
$(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_arabic.ttf) $(noto_sans_hebrew.ttf) "Arial" "Arial" "Regular" $(alt_arial.ttf)
$(alt_arial.ttf): $(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_arabic.ttf) $(noto_sans_hebrew.ttf) $(noto_sans_armenian.ttf) $(noto_sans_coptic.ttf) \
$(noto_sans_math.ttf) $(noto_sans_symbols.ttf) $(noto_sans_symbols2.ttf) $(noto_sans_mono.ttf) | $(ALT_FONTS_OBJ)
$(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_arabic.ttf) $(noto_sans_hebrew.ttf) $(noto_sans_armenian.ttf) $(noto_sans_coptic.ttf) \
$(noto_sans_math.ttf) $(noto_sans_symbols.ttf) $(noto_sans_symbols2.ttf) $(noto_sans_mono.ttf) "Arial" "Arial" "Regular" $(FONTS)/ranges/arial $(alt_arial.ttf)
fonts: $(msyh.ttf)
fonts: $(simsun.ttc)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

140
fonts/ranges/arial Normal file
View file

@ -0,0 +1,140 @@
0020-007E
00A0-0377
037A-037F
0384-038A
038C
038E-03A1
03A3-052F
0531-0556
0559-055F
0561-0587
0589-058A
058D-058F
0591-05C7
05D0-05EA
05F0-05F4
0600-061C
061E-06FF
0750-077F
08A0-08B4
08B6-08BD
08D4-08FF
1D00-1DCA
1DFE-1F15
1F18-1F1D
1F20-1F45
1F48-1F4D
1F50-1F57
1F59
1F5B
1F5D
1F5F-1F7D
1F80-1FB4
1FB6-1FC4
1FC6-1FD3
1FD6-1FDB
1FDD-1FEF
1FF2-1FF4
1FF6-1FFE
2000-200F
2012-2022
2026
202A-2030
2032-2034
2039-203A
203C-203E
2044
205E
206A-2070
2074-2079
207F
2090-2094
20A0-20BF
20F0
2105
2113
2116-2117
2122
2126
212E
214D-214E
2153-2154
215B-215E
2184
2190-2195
21A8
2202
2206
220F
2211-2212
2215
2219-221A
221E-221F
2229
222B
2248
2260-2261
2264-2265
2302
2310
2320-2321
2500
2502
250C
2510
2514
2518
251C
2524
252C
2534
253C
2550-256C
2580
2584
2588
258C
2590-2593
25A0-25A1
25AA-25AC
25B2
25BA
25BC
25C4
25CA-25CC
25CF
25D8-25D9
25E6
263A-263C
2640
2642
2660
2663
2665-2666
266A-266B
266F
2C60-2C7F
2E17
A717-A7AE
A7B0-A7B7
A7F7-A7FF
AB30-AB65
FB00-FB06
FB13-FB17
FB1D-FB36
FB38-FB3C
FB3E
FB40-FB41
FB43-FB44
FB46-FBC1
FBD3-FBFF
FC5E-FC63
FCF2-FCF4
FD3C-FD3F
FDF2
FDF4
FDFA-FDFD
FE20-FE23
FE70-FE74
FE76-FEFC
FFFC

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python3
# This script was created by Giovanni Mascellani for CodeWeavers
# Based on merge_noto.py and merge_fonts.py from the nototools
# (https://github.com/googlefonts/nototools), with the following
# copyright notice:
@ -25,6 +27,15 @@
# Copyright 2019 Christopher Simpkins
# MIT License
# The font subsetting logic is taken from
# https://github.com/fonttools/fonttools/blob/main/Lib/fontTools/subset/__init__.py
# with the following copyright notice:
# Copyright 2013 Google, Inc. All Rights Reserved.
# Google Author(s): Behdad Esfahbod
# The whole fonttools repository is distributed under the MIT license.
"""Merges a number of Noto fonts and then sets a given name to the
result.
@ -36,6 +47,7 @@ import os
from fontTools import merge
from fontTools import ttLib
from fontTools import subset
from fontTools.ttLib.tables import otTables
def read_line_metrics(font):
@ -215,26 +227,54 @@ def add_gsub_to_font(fontfile):
font.save(target_file)
return target_file
def parse_unicodes(s):
import re
s = re.sub(r"0[xX]", " ", s)
s = re.sub(r"[<+>,;&#\\xXuU\n ]", " ", s)
l = []
for item in s.split():
fields = item.split("-")
if len(fields) == 1:
l.append(int(item, 16))
else:
start, end = fields
l.extend(range(int(start, 16), int(end, 16) + 1))
return l
def main():
output_filename = sys.argv[-1]
weight = sys.argv[-2]
font_name = sys.argv[-3]
ps_name = sys.argv[-4]
input_filenames = sys.argv[1:-4]
ranges_filename = sys.argv[-2]
weight = sys.argv[-3]
font_name = sys.argv[-4]
ps_name = sys.argv[-5]
input_filenames = sys.argv[1:-5]
# Add a GSUB table to the fonts that do not have one
# Add a GSUB table to the fonts that do not have one, otherwise
# the merger will complain
for index, filename in enumerate(input_filenames):
if not has_gsub_table(filename):
input_filenames[index] = add_gsub_to_font(filename)
# Merge the fonts together
merger = merge.Merger()
font = merger.merge(input_filenames)
# Use the line metrics defined by the first font
# Use the line metrics defined by the first font, which is
# supposed to be the basic NotoSans
metrics = read_line_metrics(ttLib.TTFont(input_filenames[0]))
set_line_metrics(font, metrics)
# Select the subset we care about
options = subset.Options(ignore_missing_unicodes=False)
subsetter = subset.Subsetter(options)
unicodes = []
with open(ranges_filename) as ranges:
for line in ranges:
unicodes.extend(parse_unicodes(line.split("#")[0]))
if len(unicodes) != 0:
subsetter.populate(unicodes=unicodes)
subsetter.subset(font)
# Rename the result
for record in font['name'].names:
if record.nameID == 1: