mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 21:36:17 +00:00
got loading some custom fonts, only ones with one "name" inside the family
This commit is contained in:
@@ -7,12 +7,16 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum FontFamilies: String, CaseIterable/*, CustomStringConvertible*/ {
|
enum Fonts: String, CaseIterable/*, CustomStringConvertible*/ {
|
||||||
case mesloLGSNF = "MesloLGS NF"
|
case mesloLGSNF = "MesloLGS-NF-Regular"
|
||||||
case sfMono = "SF Mono"
|
case sfMono = "SFMono-Regular"
|
||||||
case cascadiaMono
|
case cascadiaMono = "CascadiaMono-Regular"
|
||||||
case geistMonoNF
|
case geistMonoNF = "GeistMonoNFM-Regular"
|
||||||
case jetbrainsMonoNF
|
case jetbrainsMonoNF = "JetBrainsMonoNFM-Regular"
|
||||||
case comicSans
|
case comicSans = "ComicSansMS"
|
||||||
case comicMono
|
case comicMono = "ComicMono"
|
||||||
|
|
||||||
|
static var fontNames: [String] {
|
||||||
|
return Fonts.allCases.map { $0.rawValue }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,12 @@ class HostsManager: ObservableObject, @unchecked Sendable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadFonts() {
|
func loadFonts() {
|
||||||
|
var customFonts: [UIFont] = []
|
||||||
for family in UIFont.familyNames.sorted() {
|
for family in UIFont.familyNames.sorted() {
|
||||||
let names = UIFont.fontNames(forFamilyName: family)
|
let names = UIFont.fontNames(forFamilyName: family)
|
||||||
print("family: \(family), name: \(names)")
|
if Fonts.fontNames.contains(names) {
|
||||||
|
print(family)
|
||||||
|
}
|
||||||
guard let customFont = UIFont(name: names[0], size: UIFont.systemFontSize) else {
|
guard let customFont = UIFont(name: names[0], size: UIFont.systemFontSize) else {
|
||||||
fatalError()
|
fatalError()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user