Skip to content

Commit ee679df

Browse files
authored
fix(ios): custom attribute for attribute string without fontSize
so that it can auto size in canvas
1 parent 7bdb16a commit ee679df

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/text/platforms/ios/src/NSTextUtils.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,13 @@ class NSTextUtils: NSObject {
235235
}
236236
let attributes:NSMutableDictionary! = NSMutableDictionary()
237237
let iosFont:UIFont! = spanDetails.object(forKey: "iosFont") as? UIFont
238+
let fontSize:NSNumber! = spanDetails.object(forKey: "fontSize") as? NSNumber
238239
if (iosFont != nil) {
239240
attributes.setObject(iosFont!, forKey:NSAttributedString.Key.font as NSCopying)
241+
if (fontSize == nil) {
242+
// we add a custom attribute so that canvas can see it and apply the paint font size
243+
attributes.setObject(true, forKey:"fontSizeNotSet" as NSCopying)
244+
}
240245
}
241246
let autoFontSizeEnabled:NSNumber! = spanDetails.object(forKey: "autoFontSizeEnabled") as? NSNumber
242247
if autoFontSizeEnabled.boolValue {

0 commit comments

Comments
 (0)