Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

Write the Palatino substitute only when that Windows name is absent.

Nathan Pierce29deba3ea1c5
diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swift
index ed4212f..78ddbf3 100644
--- a/Sources/HighballKit/WineRunner.swift
+++ b/Sources/HighballKit/WineRunner.swift
@@ -23,10 +23,11 @@ public enum MacFontSubstitutes {
("Palatino Linotype", "Palatino"),
]
- /// Pairs whose Windows name is absent or points somewhere else.
+ /// Pairs whose Windows name has no value yet. A value already stored is left as it is,
+ /// including one a player or a recipe set to another face.
public static func missing(in systemReg: String) -> [(windowsName: String, macName: String)] {
pairs.filter { pair in
- RegistryText.value(in: systemReg, key: fileKey, name: pair.windowsName) != "\"\(pair.macName)\""
+ RegistryText.value(in: systemReg, key: fileKey, name: pair.windowsName) == nil
}
}
}
@@ -560,10 +561,11 @@ public struct WineRunner: Sendable {
static let dllOverridesKey = #"HKCU\Software\Wine\DllOverrides"#
- /// Writes the Mac font names that stand in for Windows face names. One write per missing
- /// name, then nothing: the prefix registry is what every later process reads, including a
- /// game that an already-running Steam starts. `start` calls this. A registry file that does
- /// not exist yet (a bottle still in its first boot) is left alone.
+ /// Writes the Mac font names that stand in for Windows face names. One write per name that
+ /// has no value yet, then nothing: a value already stored is kept. The prefix registry is
+ /// what every later process reads, including a game that an already-running Steam starts.
+ /// `start` calls this. A registry file that does not exist yet (a bottle still in its first
+ /// boot) is left alone.
func syncMacFontSubstitutes() async {
let regURL = bottle.url.appending(path: "system.reg")
guard let text = try? String(contentsOf: regURL, encoding: .utf8) else { return }
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index 85ec84f..05d6311 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -1534,7 +1534,7 @@ extension RegressionTests {
[Software\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\FontSubstitutes] 1
"Palatino Linotype"="Times New Roman"
"""
- XCTAssertEqual(MacFontSubstitutes.missing(in: other).map(\.macName), ["Palatino"])
+ XCTAssertTrue(MacFontSubstitutes.missing(in: other).isEmpty)
}
// Play-gate: only provably harmless steps may run silently at Play (no wine process —