Skip to content

Commit

Permalink
Don't rename imported fonts. Respring improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ginsudev committed Jan 30, 2023
1 parent 6412171 commit 6be5d0f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
4 changes: 2 additions & 2 deletions WDBFontOverwrite.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@
"$(inherited)",
"$(PROJECT_DIR)/WDBFontOverwrite",
);
MARKETING_VERSION = 1.10.6;
MARKETING_VERSION = 1.10.7;
PRODUCT_BUNDLE_IDENTIFIER = com.ginsu.WDBFontOverwrite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -473,7 +473,7 @@
"$(inherited)",
"$(PROJECT_DIR)/WDBFontOverwrite",
);
MARKETING_VERSION = 1.10.6;
MARKETING_VERSION = 1.10.7;
PRODUCT_BUNDLE_IDENTIFIER = com.ginsu.WDBFontOverwrite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
19 changes: 2 additions & 17 deletions WDBFontOverwrite/FontMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct FontMap {
"/System/Library/Fonts/CoreAddition/AppleColorEmoji-160px.ttc",
"/System/Library/Fonts/Core/AppleColorEmoji.ttc",
]),
localPath: "CustomAppleColorEmoji.woff2"
localPath: "CustomAppleColorEmoji.ttc"
)

static func populateFontMap() async throws {
Expand All @@ -30,13 +30,10 @@ struct FontMap {
guard !font.contains("AppleColorEmoji") else {
continue
}
guard let validatedLocalPath = validateFont(name: font) else {
continue
}
fontMap[key(forFont: font)] = CustomFont(
name: font,
targetPath: .single("\(fontDirPath)\(dir)/\(font)"),
localPath: "Custom\(validatedLocalPath)"
localPath: "Custom\(font)"
)
}
}
Expand All @@ -51,16 +48,4 @@ struct FontMap {
}
return rejoinedString
}

private static func validateFont(name: String) -> String? {
var components = name.components(separatedBy: ".")
guard components.last != "woff2" else {
return components.joined(separator: ".")
}
guard components.last == "ttc" || components.last == "ttf" else {
return nil
}
components[components.count - 1] = "woff2"
return components.joined(separator: ".")
}
}
10 changes: 5 additions & 5 deletions WDBFontOverwrite/MainInterface/ActionButtons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ struct ActionButtons: View {
}

private func respring() {
let sharedApplication = UIApplication.shared
let windows = sharedApplication.windows
if let window = windows.first {
while true {
window.snapshotView(afterScreenUpdates: false)
grant_full_disk_access { error in
if error != nil {
print("can't get disk access")
} else {
xpc_crasher(UnsafeMutablePointer<Int8>(mutating: "com.apple.frontboard.systemappservices"))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension CustomFontsScene {
@Published var importType: CustomFontType = .font

var selectedCustomFontType: CustomFontType {
return customFontPickerSelection == 0 ? .font : .emoji
customFontPickerSelection == 0 ? .font : .emoji
}

func batchOverwriteFonts() async {
Expand Down
1 change: 1 addition & 0 deletions WDBFontOverwrite/WDBFontOverwrite-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "vm_unaligned_copy_switch_race.h"
#import "_UIKeyboardCache.h"
#import "helpers.h"
#import "grant_full_disk_access.h"

0 comments on commit 6be5d0f

Please sign in to comment.