If you install your fonts into FontBook.app and view the Font Info (⌘I
), you will see each font has several names:
It looks like .custom(_:size:)
will recognize the PostScript name and the Full name, with the additional wrinkle of not caring whether or not you include " Regular" if it's part of the name. e.g., Cinzel Decorative Regular
and Cinzel Decorative
will both result in using CinzelDecorative-Regular
.
To illustrate:
List {
Text("CinzelDecorative-Regular\n(PostScript name)")
.font(.custom("CinzelDecorative-Regular", size: 14))
Text("Cinzel Decorative Regular\n(Full name)")
.font(.custom("Cinzel Decorative Regular", size: 14))
Text("Cinzel Decorative\n(Full name without Regular)")
.font(.custom("Cinzel Decorative", size: 14))
}
For IndieFlower-Regular
, the PostScript name is IndieFlower
and the Full name is Indie Flower
, so either of those will work. But IndieFlower Regular
and Indie Flower Regular
will not work.
List {
Text("IndieFlower\n(PostScript name)")
.font(.custom("IndieFlower", size: 14))
Text("Indie Flower\n(Full name)")
.font(.custom("Indie Flower", size: 14))
Text("IndieFlower Regular")
.font(.custom("IndieFlower Regular", size: 14))
Text("Indie Flower Regular")
.font(.custom("Indie Flower Regular", size: 14))
}
Apple says to use the PostScript name when applyng a custom font, so that's probably a good idea, even if .custom(_:size:)
does recognize the Full name.