Build replacement fonts

This commit is contained in:
Nikolay Sivov 2018-10-12 14:20:49 +03:00 committed by Andrew Eikum
parent 83b804f15e
commit 17e50d67ab
6 changed files with 111 additions and 2 deletions

3
.gitmodules vendored
View file

@ -16,3 +16,6 @@
[submodule "cmake"] [submodule "cmake"]
path = cmake path = cmake
url = https://github.com/Kitware/CMake url = https://github.com/Kitware/CMake
[submodule "fonts/liberation-fonts"]
path = fonts/liberation-fonts
url = https://github.com/liberationfonts/liberation-fonts

View file

@ -215,6 +215,9 @@ CMAKE_OBJ64 := ./obj-cmake64
CMAKE_BIN32 := $(CMAKE_OBJ32)/built/bin/cmake CMAKE_BIN32 := $(CMAKE_OBJ32)/built/bin/cmake
CMAKE_BIN64 := $(CMAKE_OBJ64)/built/bin/cmake CMAKE_BIN64 := $(CMAKE_OBJ64)/built/bin/cmake
FONTS := $(SRCDIR)/fonts
FONTS_OBJ := ./obj-fonts
## Object directories ## Object directories
OBJ_DIRS := $(TOOLS_DIR32) $(TOOLS_DIR64) \ OBJ_DIRS := $(TOOLS_DIR32) $(TOOLS_DIR64) \
$(OPENAL_OBJ32) $(OPENAL_OBJ64) \ $(OPENAL_OBJ32) $(OPENAL_OBJ64) \
@ -248,9 +251,11 @@ DIST_LICENSE := $(DST_BASE)/LICENSE
DIST_GECKO_DIR := $(DST_DIR)/share/wine/gecko DIST_GECKO_DIR := $(DST_DIR)/share/wine/gecko
DIST_GECKO32 := $(DIST_GECKO_DIR)/$(GECKO32_MSI) DIST_GECKO32 := $(DIST_GECKO_DIR)/$(GECKO32_MSI)
DIST_GECKO64 := $(DIST_GECKO_DIR)/$(GECKO64_MSI) DIST_GECKO64 := $(DIST_GECKO_DIR)/$(GECKO64_MSI)
DIST_FONTS := $(DST_DIR)/share/fonts
DIST_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_OVR32) $(DIST_OVR64) \ DIST_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_OVR32) $(DIST_OVR64) \
$(DIST_GECKO32) $(DIST_GECKO64) $(DIST_COMPAT_MANIFEST) $(DIST_LICENSE) $(DIST_GECKO32) $(DIST_GECKO64) $(DIST_COMPAT_MANIFEST) $(DIST_LICENSE) \
$(DIST_FONTS)
DEPLOY_COPY_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_LICENSE) DEPLOY_COPY_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_LICENSE)
@ -302,6 +307,10 @@ $(DIST_GECKO32): | $(DIST_GECKO_DIR)
cp "$(SRCDIR)/contrib/$(GECKO32_MSI)" "$@"; \ cp "$(SRCDIR)/contrib/$(GECKO32_MSI)" "$@"; \
fi fi
$(DIST_FONTS): fonts
mkdir -p $@
cp $(FONTS_OBJ)/*.ttf "$@"
.PHONY: dist .PHONY: dist
ALL_TARGETS += dist ALL_TARGETS += dist
@ -312,7 +321,11 @@ GOAL_TARGETS += dist
dist: $(DIST_TARGETS) | $(WINE_OUT) $(filter $(MAKECMDGOALS),wine64 wine32 wine) $(DST_DIR) dist: $(DIST_TARGETS) | $(WINE_OUT) $(filter $(MAKECMDGOALS),wine64 wine32 wine) $(DST_DIR)
rm -rf $(abspath $(DIST_PREFIX)) && \ rm -rf $(abspath $(DIST_PREFIX)) && \
WINEPREFIX=$(abspath $(DIST_PREFIX)) $(WINE_OUT_BIN) wineboot && \ WINEPREFIX=$(abspath $(DIST_PREFIX)) $(WINE_OUT_BIN) wineboot && \
WINEPREFIX=$(abspath $(DIST_PREFIX)) $(WINE_OUT_SERVER) -w WINEPREFIX=$(abspath $(DIST_PREFIX)) $(WINE_OUT_SERVER) -w && \
ln -s $(FONTLINKPATH)/LiberationSans-Regular.ttf $(abspath $(DIST_PREFIX))/drive_c/windows/Fonts/arial.ttf && \
ln -s $(FONTLINKPATH)/LiberationSans-Bold.ttf $(abspath $(DIST_PREFIX))/drive_c/windows/Fonts/arialbd.ttf && \
ln -s $(FONTLINKPATH)/LiberationSerif-Regular.ttf $(abspath $(DIST_PREFIX))/drive_c/windows/Fonts/times.ttf && \
ln -s $(FONTLINKPATH)/LiberationMono-Regular.ttf $(abspath $(DIST_PREFIX))/drive_c/windows/Fonts/cour.ttf
deploy: dist | $(filter-out dist deploy install,$(MAKECMDGOALS)) deploy: dist | $(filter-out dist deploy install,$(MAKECMDGOALS))
mkdir -p $(DEPLOY_DIR) && \ mkdir -p $(DEPLOY_DIR) && \
@ -916,6 +929,53 @@ endif # NO_DXVK
# build_vrclient64_tests # build_vrclient64_tests
# build_vrclient32_tests # build_vrclient32_tests
ALL_TARGETS += fonts
GOAL_TARGETS += fonts
.PHONY: fonts
FONTFORGE = fontforge -quiet
FONTSCRIPT = $(FONTS)/scripts/generatefont.pe
FONTLINKPATH = ../../../../fonts
LIBERATION_SRCDIR = $(FONTS)/liberation-fonts/src
LIBERATION_SANS_REGULAR_SFD = LiberationSans-Regular.sfd
LIBERATION_SANS_BOLD_SFD = LiberationSans-Bold.sfd
LIBERATION_SERIF_REGULAR_SFD = LiberationSerif-Regular.sfd
LIBERATION_MONO_REGULAR_SFD = LiberationMono-Regular.sfd
LIBERATION_SANS_REGULAR_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_SANS_REGULAR_SFD:.sfd=.ttf))
LIBERATION_SANS_BOLD_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_SANS_BOLD_SFD:.sfd=.ttf))
LIBERATION_SERIF_REGULAR_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_SERIF_REGULAR_SFD:.sfd=.ttf))
LIBERATION_MONO_REGULAR_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_MONO_REGULAR_SFD:.sfd=.ttf))
LIBERATION_SFDS = $(LIBERATION_SANS_REGULAR_SFD) $(LIBERATION_SANS_BOLD_SFD) $(LIBERATION_SERIF_REGULAR_SFD) $(LIBERATION_MONO_REGULAR_SFD)
FONT_TTFS = $(LIBERATION_SANS_REGULAR_TTF) $(LIBERATION_SANS_BOLD_TTF) \
$(LIBERATION_SERIF_REGULAR_TTF) $(LIBERATION_MONO_REGULAR_TTF)
FONTS_SRC = $(FONT_TTFS:.ttf=.sfd)
$(LIBERATION_SANS_REGULAR_TTF): $(FONTS_SRC) $(FONTSCRIPT)
$(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "Arial" "Arial" "Arial"
$(LIBERATION_SANS_BOLD_TTF): $(FONTS_SRC) $(FONTSCRIPT)
$(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "Arial-Bold" "Arial" "Arial Bold"
$(LIBERATION_SERIF_REGULAR_TTF): $(FONTS_SRC) $(FONTSCRIPT)
$(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "TimesNewRoman" "Times New Roman" "Times New Roman"
$(LIBERATION_MONO_REGULAR_TTF): $(FONTS_SRC) $(FONTSCRIPT)
patch $(@:.ttf=.sfd) $(FONTS)/patches/$(LIBERATION_MONO_REGULAR_SFD:.sfd=.patch)
$(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "CourierNew" "Courier New" "Courier New"
$(FONTS_OBJ):
mkdir -p $@
$(FONTS_SRC): $(FONTS_OBJ)
cp -n $(addprefix $(LIBERATION_SRCDIR)/, $(LIBERATION_SFDS)) $<
fonts: $(LIBERATION_SANS_REGULAR_TTF) $(LIBERATION_SANS_BOLD_TTF) \
$(LIBERATION_SERIF_REGULAR_TTF) $(LIBERATION_MONO_REGULAR_TTF) | $(FONTS_SRC)
## ##
## Targets ## Targets

@ -0,0 +1 @@
Subproject commit 9510ebd130bcb4dfc76b053b438d8a97a3ed4600

View file

@ -0,0 +1,15 @@
diff --git a/LiberationMono-Regular.sfd b/LiberationMono-Regular.sfd
index 0cedbd4..13b9a63 100644
--- a/LiberationMono-Regular.sfd
+++ b/LiberationMono-Regular.sfd
@@ -3931,6 +3931,10 @@ ShortTable: maxp 16
3
1
EndShort
+TtfTable: VDMX 94
+!!!!"!!**$!<E0/!"B2J!!iQ/s8E!)!"&](!"&]4s8;p*!"8i*!"8i9s8;p,!"Ao*!"Ju<s82j-
+!"Ju+!"],?s82j/!"],,!"o8Bs8)d0!"f2-!#,DFs8)cr
+EndTtf
LangName: 1033 "" "" "Regular" "Ascender - Liberation Mono" "" "Version 2.00.3" "" "Liberation is a trademark of Red Hat, Inc. registered in U.S. Patent and Trademark Office and certain other jurisdictions." "Ascender Corporation" "Steve Matteson" "Based on Cousine, which was designed by Steve Matteson as an innovative, refreshing sans serif design that is metrically compatible with Courier New+ISIA. Cousine offers improved on-screen readability characteristics and the pan-European WGL character set and solves the needs of developers looking for width-compatible fonts to address document portability across platforms." "http://www.ascendercorp.com/" "http://www.ascendercorp.com/typedesigners.html" "Licensed under the SIL Open Font License, Version 1.1" "http://scripts.sil.org/OFL"
GaspTable: 3 8 2 17 1 65535 3 0
Encoding: UnicodeBmp

View file

@ -0,0 +1,7 @@
if ($argc != 5)
Error ("Expected arguments - FileName, PSName, FamilyName, FaceName")
endif
Open($1)
SetFontNames($argv[2], $argv[3], $argv[4])
Generate($1:r + ".ttf")

23
proton
View file

@ -127,6 +127,7 @@ basedir = os.path.dirname(sys.argv[0])
bindir = basedir + "/dist/bin/" bindir = basedir + "/dist/bin/"
libdir = basedir + "/dist/lib" libdir = basedir + "/dist/lib"
lib64dir = basedir + "/dist/lib64" lib64dir = basedir + "/dist/lib64"
fontsdir = basedir + "/dist/share/fonts"
wine_path = bindir + "/wine" wine_path = bindir + "/wine"
#extract if needed #extract if needed
@ -221,6 +222,25 @@ if "SteamGameId" in env:
else: else:
env["WINEDEBUG"] = "-all" env["WINEDEBUG"] = "-all"
def create_fonts_symlinks(prefix_path):
fontsmap = [
( "LiberationSans-Regular.ttf", "arial.ttf" ),
( "LiberationSans-Bold.ttf", "arialbd.ttf" ),
( "LiberationSerif-Regular.ttf", "times.ttf" ),
( "LiberationMono-Regular.ttf", "cour.ttf" ),
]
windowsfonts = prefix_path + "/drive_c/windows/Fonts"
for p in fontsmap:
lname = os.path.join(windowsfonts, p[1])
fname = os.path.join(fontsdir, p[0])
if os.path.lexists(lname):
if os.path.islink(lname):
os.remove(lname)
os.symlink(fname, lname)
else:
os.symlink(fname, lname)
prefix_lock = FileLock(os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx.lock", timeout=-1) prefix_lock = FileLock(os.environ["STEAM_COMPAT_DATA_PATH"] + "/pfx.lock", timeout=-1)
with prefix_lock: with prefix_lock:
version_file = os.environ["STEAM_COMPAT_DATA_PATH"] + "/version" version_file = os.environ["STEAM_COMPAT_DATA_PATH"] + "/version"
@ -238,6 +258,9 @@ with prefix_lock:
with open(version_file, "w") as f: with open(version_file, "w") as f:
f.write(CURRENT_PREFIX_VERSION + "\n") f.write(CURRENT_PREFIX_VERSION + "\n")
#create font files symlinks
create_fonts_symlinks(prefix)
#copy steam files into place #copy steam files into place
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ: if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ:
#modern steam client sets this #modern steam client sets this