|
@@ -2338,7 +2338,8 @@ let KMColorPickerViewHeight: CGFloat = 64
|
|
}
|
|
}
|
|
|
|
|
|
func annotationFontReload() {
|
|
func annotationFontReload() {
|
|
- DispatchQueue.global(qos: .default).async { [self] in
|
|
|
|
|
|
+ DispatchQueue.global(qos: .default).async { [weak self] in
|
|
|
|
+ guard let self = self else { return }
|
|
let fonts = NSFontManager.shared.availableFontFamilies
|
|
let fonts = NSFontManager.shared.availableFontFamilies
|
|
let menu = NSMenu()
|
|
let menu = NSMenu()
|
|
var selectedIndex = 0
|
|
var selectedIndex = 0
|
|
@@ -2350,26 +2351,27 @@ let KMColorPickerViewHeight: CGFloat = 64
|
|
item.attributedTitle = attributedString
|
|
item.attributedTitle = attributedString
|
|
menu.addItem(item)
|
|
menu.addItem(item)
|
|
|
|
|
|
- if annotationType == .freeText || annotationType == .signText || annotationType == .signDate {
|
|
|
|
- if annotationModel?.fontName() == font.fontName {
|
|
|
|
|
|
+ if self.annotationType == .freeText || self.annotationType == .signText || self.annotationType == .signDate {
|
|
|
|
+ if self.annotationModel?.fontName() == font.fontName {
|
|
selectedIndex = index
|
|
selectedIndex = index
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if annotationType == .freeText || annotationType == .signText || annotationType == .signDate {
|
|
|
|
- if let data = annotationModel?.fontName() {
|
|
|
|
|
|
+ if self.annotationType == .freeText || self.annotationType == .signText || self.annotationType == .signDate {
|
|
|
|
+ if let data = self.annotationModel?.fontName() {
|
|
let freetextFont = NSFont(name: data, size: 16) ?? NSFont.systemFont(ofSize: 16)
|
|
let freetextFont = NSFont(name: data, size: 16) ?? NSFont.systemFont(ofSize: 16)
|
|
if let family = freetextFont.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String,
|
|
if let family = freetextFont.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String,
|
|
let style = freetextFont.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String {
|
|
let style = freetextFont.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String {
|
|
|
|
|
|
- DispatchQueue.main.async { [self] in
|
|
|
|
- fontPopUpButton.menu = menu
|
|
|
|
- fontPopUpButton.selectItem(at: selectedIndex)
|
|
|
|
|
|
+ DispatchQueue.main.async { [weak self] in
|
|
|
|
+ guard let self = self else { return }
|
|
|
|
+ self.fontPopUpButton.menu = menu
|
|
|
|
+ self.fontPopUpButton.selectItem(at: selectedIndex)
|
|
|
|
|
|
- let selectedStyleIndex = setFontStyle(fontName: family, currentStyle: style)
|
|
|
|
- fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
|
|
|
|
|
|
+ let selectedStyleIndex = self.setFontStyle(fontName: family, currentStyle: style)
|
|
|
|
+ self.fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|