|
@@ -382,7 +382,7 @@ private enum KMPDFAnnotationFontWeightType: Int {
|
|
|
let fontWindowController = KMAnnotationFontWindowController.initWindowController(fontModel)
|
|
|
let window = fontWindowController.window
|
|
|
fontWindowController.callback = { [weak self] model in
|
|
|
- self!.colorPickerView.color = model.fontColor
|
|
|
+ self?.colorPickerView.color = model.fontColor
|
|
|
|
|
|
DispatchQueue.global(qos: .default).async { [self]
|
|
|
let fonts = NSFontManager.shared.availableFontFamilies
|
|
@@ -411,18 +411,18 @@ private enum KMPDFAnnotationFontWeightType: Int {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- let selectedStyleIndex = self!.setFontStyleWithFontName(model.fontName, currentStyle: model.fontWeight)
|
|
|
- self!.fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
|
|
|
- self!.fontSizeComboBox.stringValue = String(format: "%.f pt", model.fontSize)
|
|
|
+ let selectedStyleIndex = self?.setFontStyleWithFontName(model.fontName, currentStyle: model.fontWeight) ?? 0
|
|
|
+ self?.fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
|
|
|
+ self?.fontSizeComboBox.stringValue = String(format: "%.f pt", model.fontSize)
|
|
|
|
|
|
- if self!.annotationModel.annotations != nil {
|
|
|
+ if self?.annotationModel.annotations != nil {
|
|
|
let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [.family: model.fontName, .face: model.fontWeight])
|
|
|
let annotationFont = NSFont(descriptor: attributeFontDescriptor, size: model.fontSize)
|
|
|
|
|
|
for tAnnotation in self!.annotations {
|
|
|
if tAnnotation is CPDFAnnotation {
|
|
|
- (tAnnotation as! CPDFButtonWidgetAnnotation).font = annotationFont
|
|
|
- (tAnnotation as! CPDFButtonWidgetAnnotation).fontColor = model.fontColor
|
|
|
+ (tAnnotation as? CPDFWidgetAnnotation)?.font = annotationFont
|
|
|
+ (tAnnotation as? CPDFWidgetAnnotation)?.fontColor = model.fontColor
|
|
|
// if model.fontAlignment == .left {
|
|
|
// (tAnnotation as! CPDFButtonWidgetAnnotation).alignment = .left
|
|
|
// } else if model.fontAlignment == .center {
|
|
@@ -434,15 +434,15 @@ private enum KMPDFAnnotationFontWeightType: Int {
|
|
|
}
|
|
|
self!.updateAnnotation()
|
|
|
} else {
|
|
|
- self!.annotationModel.setFontName(model.fontName)
|
|
|
- self!.annotationModel.setFontSize(model.fontSize)
|
|
|
- self!.annotationModel.setFontColor(model.fontColor)
|
|
|
+ self?.annotationModel.setFontName(model.fontName)
|
|
|
+ self?.annotationModel.setFontSize(model.fontSize)
|
|
|
+ self?.annotationModel.setFontColor(model.fontColor)
|
|
|
if model.fontAlignment == .left {
|
|
|
- self!.annotationModel.setAlignment(.left)
|
|
|
+ self?.annotationModel.setAlignment(.left)
|
|
|
} else if model.fontAlignment == .center {
|
|
|
- self!.annotationModel.setAlignment(.center)
|
|
|
+ self?.annotationModel.setAlignment(.center)
|
|
|
} else if model.fontAlignment == .right {
|
|
|
- self!.annotationModel.setAlignment(.right)
|
|
|
+ self?.annotationModel.setAlignment(.right)
|
|
|
}
|
|
|
}
|
|
|
}
|