Skip to content

Instantly share code, notes, and snippets.

@ShikiSuen
Created September 20, 2022 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShikiSuen/36c16120ea38ebcc15b2675b2daabaed to your computer and use it in GitHub Desktop.
Save ShikiSuen/36c16120ea38ebcc15b2675b2daabaed to your computer and use it in GitHub Desktop.
FB10978412 Demo App (SwiftUI)
/// FB10978412: Since macOS 11 Big Sur, CTFontCreateUIFontForLanguage cannot
/// distinguish zh-Hans and zh-Hant with correct adoptation of proper PingFang SC/TC variants.
import SwiftUI
@main
struct FB10978412App: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
var body: some View {
VStack {
List {
Group {
Text("骨 zh-Hans").font(.init(CTFontCreateUIFontForLanguage(.system, 18, "zh-Hans" as CFString)!))
Text("骨 zh-Hant").font(.init(CTFontCreateUIFontForLanguage(.system, 18, "zh-Hant" as CFString)!))
Text("骨 ja").font(.init(CTFontCreateUIFontForLanguage(.system, 18, "ja" as CFString)!))
}
}
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment