mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Avoid NPE mentioned in #571: LoadFont with "bold" weight will crash
This commit is contained in:
parent
916240f118
commit
34d2382d93
@ -58,7 +58,9 @@ class RenderUtils {
|
|||||||
let lowerWeight = weight?.lowercased()
|
let lowerWeight = weight?.lowercased()
|
||||||
if lowerWeight == "bold" || lowerWeight == "bolder" {
|
if lowerWeight == "bold" || lowerWeight == "bolder" {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
fontDesc = fontDesc.withSymbolicTraits(.traitBold)!
|
if let boldDesc = fontDesc.withSymbolicTraits(.traitBold) {
|
||||||
|
fontDesc = boldDesc
|
||||||
|
}
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
fontDesc = fontDesc.withSymbolicTraits(.bold)
|
fontDesc = fontDesc.withSymbolicTraits(.bold)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user