fix(fonts): properly apply fallback fonts
bump version to 0.3.1
This commit is contained in:
parent
bfb0aa6c75
commit
b0b4838c6f
3 changed files with 9 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
globalThis.__PYON_LOADER__ = {
|
||||
loaderName: "BunnyTweak",
|
||||
loaderVersion: "0.3.0",
|
||||
loaderVersion: "0.3.1",
|
||||
hasThemeSupport: true,
|
||||
storedTheme: null,
|
||||
fontPatch: 2
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@ var fontMap: [String: String] = [:]
|
|||
class FontsHook: ClassHook<UIFont> {
|
||||
class func fontWithName(_ name: String, size: CGFloat) -> UIFont {
|
||||
if let replacementName = fontMap[name] {
|
||||
return UIFont(name: replacementName, size: size)!
|
||||
let replacementDescriptor = UIFontDescriptor(name: replacementName, size: size)
|
||||
let fallbackDescriptor = replacementDescriptor.addingAttributes([.name: [name]])
|
||||
let finalDescriptor = replacementDescriptor.addingAttributes([.cascadeList: [fallbackDescriptor]])
|
||||
|
||||
return orig.fontWithDescriptor(finalDescriptor, size: size)
|
||||
}
|
||||
|
||||
return orig.fontWithName(name, size: size)
|
||||
|
|
@ -24,9 +28,9 @@ class FontsHook: ClassHook<UIFont> {
|
|||
class func fontWithDescriptor(_ descriptor: UIFontDescriptor, size: CGFloat) -> UIFont {
|
||||
if let replacementName = fontMap[descriptor.postscriptName] {
|
||||
let replacementDescriptor = UIFontDescriptor(name: replacementName, size: size)
|
||||
.addingAttributes(descriptor.fontAttributes)
|
||||
let finalDescriptor = replacementDescriptor.addingAttributes([.cascadeList: [descriptor]])
|
||||
|
||||
return orig.fontWithDescriptor(replacementDescriptor, size: size)
|
||||
return orig.fontWithDescriptor(finalDescriptor, size: size)
|
||||
}
|
||||
|
||||
return orig.fontWithDescriptor(descriptor, size: size)
|
||||
|
|
|
|||
2
control
2
control
|
|
@ -1,6 +1,6 @@
|
|||
Package: io.github.pyoncord.app
|
||||
Name: Bunny
|
||||
Version: 0.3.0
|
||||
Version: 0.3.1
|
||||
Architecture: iphoneos-arm
|
||||
Description: A mod for Discord's mobile apps.
|
||||
Maintainer: Pylix
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue