mirror of
https://github.com/readest/readest.git
synced 2026-04-29 12:00:49 +00:00
This commit is contained in:
parent
6b290f09f5
commit
4f6f45fe8a
10 changed files with 47 additions and 14 deletions
|
|
@ -299,22 +299,24 @@ class NativeBridgePlugin: Plugin {
|
|||
}
|
||||
|
||||
@objc public func get_sys_fonts_list(_ invoke: Invoke) throws {
|
||||
var fontList: [String] = []
|
||||
var fontDict: [String: String] = [:]
|
||||
|
||||
for family in UIFont.familyNames.sorted() {
|
||||
if let localized = getLocalizedDisplayName(familyName: family) {
|
||||
fontList.append(localized)
|
||||
fontDict[family] = localized
|
||||
} else {
|
||||
let fontNames = UIFont.fontNames(forFamilyName: family)
|
||||
if fontNames.isEmpty {
|
||||
fontList.append(family)
|
||||
fontDict[family] = family
|
||||
} else {
|
||||
fontList.append(contentsOf: fontNames)
|
||||
for fontName in fontNames {
|
||||
fontDict[fontName] = family
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
invoke.resolve(["fonts": fontList])
|
||||
invoke.resolve(["fonts": fontDict])
|
||||
}
|
||||
|
||||
@objc public func intercept_keys(_ invoke: Invoke) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue