fonts: Provide an alternative fake Arial font.

The fake Arial already distributed with Python is based on Liberation fonts.
It is metrically compatible with the original Arial, but it doesn't support
all its glyphs (specifically, it misses Arabic).

The new one is based on Noto fonts. It support all the Arial glyphs
(I think), but it is not metrically compatible. It is enabled based
on SteamGameId when glyph coverage is considered more important than
metric compatibility.

So far it is enabled for FIFA 21 and FIFA 22.

CW-Bug-Id: #20302
This commit is contained in:
Giovanni Mascellani 2023-01-24 14:55:03 +01:00 committed by Arkadiusz Hiler
parent 77fd6c3b2d
commit 85ed53c1d8
2 changed files with 27 additions and 6 deletions

View file

@ -683,6 +683,7 @@ endif
FONTS := $(SRCDIR)/fonts FONTS := $(SRCDIR)/fonts
FONTS_OBJ := ./obj-fonts FONTS_OBJ := ./obj-fonts
ALT_FONTS_OBJ := $(FONTS_OBJ)/alt
FONTFORGE = fontforge -quiet FONTFORGE = fontforge -quiet
FONTSCRIPT = $(FONTS)/scripts/generatefont.pe FONTSCRIPT = $(FONTS)/scripts/generatefont.pe
@ -764,6 +765,8 @@ noto_sans_tamilui.ttf = $(FONTS)/noto/NotoSansTamilUI-Regular.ttf
noto_sans_teluguui.ttf = $(FONTS)/noto/NotoSansTeluguUI-Regular.ttf noto_sans_teluguui.ttf = $(FONTS)/noto/NotoSansTeluguUI-Regular.ttf
nirmala.ttf = $(FONTS_OBJ)/nirmala.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. #The use of "Arial" here is for compatibility with programs that require that exact string. This font is not Arial.
arial_NAMES := "Arial" "Arial" "Arial" arial_NAMES := "Arial" "Arial" "Arial"
arial_ORIG := LiberationSans-Regular arial_ORIG := LiberationSans-Regular
@ -784,6 +787,9 @@ courbd_ORIG := LiberationMono-Bold
$(FONTS_OBJ): $(FONTS_OBJ):
mkdir -p $@ mkdir -p $@
$(ALT_FONTS_OBJ):
mkdir -p $@
$(FONTS_OBJ)/%.ttf: $(FONTS_OBJ)/$$($$(*)_ORIG).sfd $(FONTSCRIPT) | $(FONTS_OBJ) $(FONTS_OBJ)/%.ttf: $(FONTS_OBJ)/$$($$(*)_ORIG).sfd $(FONTSCRIPT) | $(FONTS_OBJ)
$(FONTFORGE) -script $(FONTSCRIPT) $< $($(*)_NAMES) $@ $(FONTFORGE) -script $(FONTSCRIPT) $< $($(*)_NAMES) $@
@ -838,12 +844,16 @@ $(nirmala.ttf): $(FONTS)/scripts/merge.py $(noto_sans.ttf) $(noto_sans_bengaliui
$(noto_sans_oriyaui.ttf) $(noto_sans_sinhalaui.ttf) $(noto_sans_sorasompeng.ttf) $(noto_sans_tamilui.ttf) $(noto_sans_teluguui.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" $(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)
fonts: $(msyh.ttf) fonts: $(msyh.ttf)
fonts: $(simsun.ttc) fonts: $(simsun.ttc)
fonts: $(msgothic.ttc) fonts: $(msgothic.ttc)
fonts: $(malgun.ttf) fonts: $(malgun.ttf)
fonts: $(micross.ttf) fonts: $(micross.ttf)
fonts: $(nirmala.ttf) fonts: $(nirmala.ttf)
fonts: $(alt_arial.ttf)
DIST_FONTS := $(DST_DIR)/share/fonts DIST_FONTS := $(DST_DIR)/share/fonts
$(DIST_FONTS): fonts $(DIST_FONTS): fonts
@ -853,6 +863,7 @@ $(DIST_FONTS): fonts
cp $(FONTS_OBJ)/source-han/simsun.ttc "$@" cp $(FONTS_OBJ)/source-han/simsun.ttc "$@"
cp $(FONTS_OBJ)/ume-gothic/msgothic.ttc "$@" cp $(FONTS_OBJ)/ume-gothic/msgothic.ttc "$@"
cp $(FONTS_OBJ)/source-han/malgun.ttf "$@" cp $(FONTS_OBJ)/source-han/malgun.ttf "$@"
cp -r $(FONTS_OBJ)/alt "$@"
all-dist: $(DIST_FONTS) all-dist: $(DIST_FONTS)

22
proton
View file

@ -705,21 +705,31 @@ class CompatData:
if tracked_name not in prev_tracked_files: if tracked_name not in prev_tracked_files:
tracked_files.write(tracked_name + "\n") tracked_files.write(tracked_name + "\n")
def create_symlink(self, lname, fname):
if file_exists(lname, follow_symlinks=False):
if os.path.islink(lname):
os.remove(lname)
os.symlink(fname, lname)
else:
os.symlink(fname, lname)
def create_fonts_symlinks(self): def create_fonts_symlinks(self):
ALTERNATIVES = {
('1313860', 'arial.ttf'), # FIFA 21
('1506830', 'arial.ttf'), # FIFA 22
}
windowsfonts = self.prefix_dir + "/drive_c/windows/Fonts" windowsfonts = self.prefix_dir + "/drive_c/windows/Fonts"
makedirs(windowsfonts) makedirs(windowsfonts)
sgi = os.environ.get('SteamGameId', '')
for fonts_dir in [g_proton.fonts_dir, g_proton.wine_fonts_dir]: for fonts_dir in [g_proton.fonts_dir, g_proton.wine_fonts_dir]:
for font in os.listdir(fonts_dir): for font in os.listdir(fonts_dir):
if not font.endswith('.ttf') and not font.endswith('.ttc'): if not font.endswith('.ttf') and not font.endswith('.ttc'):
continue continue
lname = os.path.join(windowsfonts, font) lname = os.path.join(windowsfonts, font)
fname = os.path.join(fonts_dir, font) fname = os.path.join(fonts_dir, font)
if file_exists(lname, follow_symlinks=False): if (sgi, font) in ALTERNATIVES:
if os.path.islink(lname): fname = os.path.join(fonts_dir, 'alt', font)
os.remove(lname) self.create_symlink(lname, fname)
os.symlink(fname, lname)
else:
os.symlink(fname, lname)
def migrate_user_paths(self): def migrate_user_paths(self):
#move winxp-style paths to vista+ paths. we can't do this in #move winxp-style paths to vista+ paths. we can't do this in