|
@@ -472,6 +472,11 @@ import Cocoa
|
|
|
} else {
|
|
|
self.applyPDFSettings(savedNormalSetup)
|
|
|
}
|
|
|
+
|
|
|
+ //文字
|
|
|
+ let fontManager = NSFontManager.shared
|
|
|
+ fontManager.target = self
|
|
|
+ fontManager.action = #selector(changeFont(_:))
|
|
|
}
|
|
|
|
|
|
//MARK: - PDFListView
|
|
@@ -2348,3 +2353,20 @@ extension KMMainViewController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+extension KMMainViewController {
|
|
|
+ func changeFont(_ sender: NSFontManager) {
|
|
|
+ KMPrint("changeFont ...")
|
|
|
+ if ((self.listView.activeAnnotation?.isKind(of: CPDFFreeTextAnnotation.self)) != nil) {
|
|
|
+ let annotation: CPDFFreeTextAnnotation = self.listView.activeAnnotation as! CPDFFreeTextAnnotation
|
|
|
+ var font = NSFont(name: annotation.fontName() ?? "Helvetica", size: (annotation.fontSize()) )
|
|
|
+ font = sender.convert(font!)
|
|
|
+
|
|
|
+ annotation.setFontSize(font!.pointSize)
|
|
|
+
|
|
|
+ self.listView.commitEditAnnotationFreeText(annotation)
|
|
|
+ self.listView.setNeedsDisplay(annotation)
|
|
|
+// self.listView.setNeedsDisplayAnnotationViewFor(annotation.page)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|