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 Anna Lasky
parent 60d5cc86d1
commit 9843709336
2 changed files with 28 additions and 6 deletions

View file

@ -201,6 +201,7 @@ WINEMONO_TARBALL := wine-mono-$(WINEMONO_VER)-x86.tar.xz
FONTS := $(SRCDIR)/fonts
FONTS_OBJ := ./obj-fonts
ALT_FONTS_OBJ := $(FONTS_OBJ)/alt
ifeq ($(CONTAINER),)
@ -359,6 +360,7 @@ $(DIST_FONTS): fonts
cp $(FONTS_OBJ)/source-han/simsun.ttc "$@"
cp $(FONTS_OBJ)/ume-gothic/msgothic.ttc "$@"
cp $(FONTS_OBJ)/source-han/malgun.ttf "$@"
cp -r $(FONTS_OBJ)/alt "$@"
.PHONY: dist
@ -1096,6 +1098,8 @@ noto_sans_tamilui.ttf = $(FONTS)/noto/NotoSansTamilUI-Regular.ttf
noto_sans_teluguui.ttf = $(FONTS)/noto/NotoSansTeluguUI-Regular.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.
LiberationSans-Regular_NAMES := "Arial" "Arial" "Arial"
#The use of "Arial" here is for compatibility with programs that require that exact string. This font is not Arial.
@ -1111,6 +1115,9 @@ LiberationMono-Bold_NAMES := "CourierNewPS-BoldMT" "Courier New" "Courier New Bo
$(FONTS_OBJ):
mkdir -p $@
$(ALT_FONTS_OBJ):
mkdir -p $@
ifeq ($(CONTAINER),)
fonts: container-build # trigger container build
@ -1169,12 +1176,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) \
"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: $(simsun.ttc)
fonts: $(msgothic.ttc)
fonts: $(malgun.ttf)
fonts: $(micross.ttf)
fonts: $(nirmala.ttf)
fonts: $(alt_arial.ttf)
endif # ifeq ($(CONTAINER),)
##

23
proton
View file

@ -711,7 +711,20 @@ class CompatData:
if tracked_name not in prev_tracked_files:
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):
ALTERNATIVES = {
('1313860', 'arial.ttf'), # FIFA 21
('1506830', 'arial.ttf'), # FIFA 22
}
fontsmap = [
( g_proton.fonts_dir, "LiberationSans-Regular.ttf", "arial.ttf" ),
( g_proton.fonts_dir, "LiberationSans-Bold.ttf", "arialbd.ttf" ),
@ -730,15 +743,13 @@ class CompatData:
windowsfonts = self.prefix_dir + "/drive_c/windows/Fonts"
makedirs(windowsfonts)
sgi = os.environ.get('SteamGameId', '')
for p in fontsmap:
lname = os.path.join(windowsfonts, p[2])
fname = os.path.join(p[0], p[1])
if file_exists(lname, follow_symlinks=False):
if os.path.islink(lname):
os.remove(lname)
os.symlink(fname, lname)
else:
os.symlink(fname, lname)
if (sgi, p[2]) in ALTERNATIVES:
fname = os.path.join(p[0], 'alt', p[2])
self.create_symlink(lname, fname)
def migrate_user_paths(self):
#move winxp-style paths to vista+ paths. we can't do this in