Convert from SwiftUI.Font to UIFont

A bit of a hack but works (doing the other direction is left as an exercise to the reader). extension UIFont { class func preferredFont(from font: Font) -> UIFont { let uiFont: UIFont switch font { case .largeTitle: uiFont = UIFont.preferredFont(forTextStyle: .largeTitle) case .title: uiFont = UIFont.preferredFont(forTextStyle: .title1) case .title2: uiFont = UIFont.preferredFont(forTextStyle: .title2) case … Read more

Set the Navigation Bar Title Font with SwiftUI

In SwiftUI, at this point we can not change the navigationBarTitle font directly, but you can change navigationBar appearance like this, struct YourView: View { init() { //Use this if NavigationBarTitle is with Large Font UINavigationBar.appearance().largeTitleTextAttributes = [.font : UIFont(name: “Georgia-Bold”, size: 20)!] //Use this if NavigationBarTitle is with displayMode = .inline //UINavigationBar.appearance().titleTextAttributes = [.font … Read more

Convert or extract TTC font to TTF – how to? [closed]

Assuming that Windows doesn’t really know how to deal with TTC files (which I honestly find strange), you can “split” the combined fonts in an easy way if you use fontforge. The steps are: Download the file. Unzip it (e.g., unzip “STHeiti Medium.ttc.zip”). Load Fontforge. Open it with Fontforge (e.g., File > Open). Fontforge will … Read more

Google Web Fonts on HTTPS pages on Chrome

Create a schema agnostic url Change http://fonts.google… to //fonts.google… Drop the http: or https: from the front, the browser will use whichever schema you’re currently using on the site. You may request resources using https from http, but not the other way round. An alternative to the above solution (and probably best practice) is to … Read more