|
@@ -916,11 +916,12 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
var fontName = self.listView.editingSelectionCFont(byRangeEdit: areas as? CPDFEditTextArea)?.familyName ?? "Helvetica"
|
|
|
// fontName = KMEditPDFTextManager.manager.transformAreaTextFontName(fontName: fontName, fontNames: self.fontNameVC?.items ?? [])
|
|
|
|
|
|
- if self.listView.isBoldCurrentSelection(with: areas as? CPDFEditTextArea) {
|
|
|
+
|
|
|
+ if let data = self.listView?.isBoldCurrentSelection(byRangeEdit: areas as? CPDFEditTextArea), data {
|
|
|
fontName += "-Bold"
|
|
|
}
|
|
|
|
|
|
- if self.listView.isItalicCurrentSelection(with: areas as? CPDFEditTextArea) {
|
|
|
+ if let data = self.listView?.isItalicCurrentSelection(byRangeEdit: areas as? CPDFEditTextArea), data {
|
|
|
fontName += "-Italic"
|
|
|
}
|
|
|
|
|
@@ -1045,6 +1046,20 @@ extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
|
|
|
}
|
|
|
|
|
|
let type = KMEditPDFTextFontType.typeOfRawValue(value: value)
|
|
|
+ var fontSize: CGFloat = 0
|
|
|
+ if type == .h1 {
|
|
|
+ fontSize = 20
|
|
|
+ } else if type == .h2 {
|
|
|
+ fontSize = 18
|
|
|
+ } else if type == .h3 {
|
|
|
+ fontSize = 16
|
|
|
+ } else if type == .b1 {
|
|
|
+ fontSize = 14
|
|
|
+ } else if type == .b2 {
|
|
|
+ fontSize = 12
|
|
|
+ } else if type == .b3 {
|
|
|
+ fontSize = 10
|
|
|
+ }
|
|
|
let model = KMEditPDFTextManager.manager.fetchUserDefaultData(type: type)
|
|
|
let fontName: String = model.fontName
|
|
|
// let size: CGFloat = model.fontSize
|
|
@@ -1053,7 +1068,9 @@ extension KMEditPDFTextPropertyViewController: KMSelectPopButtonDelegate {
|
|
|
|
|
|
let attri = NSMutableAttributedString(attributedString: label.attributedStringValue)
|
|
|
if bold {
|
|
|
- attri.addAttribute(.font, value: NSFont.boldSystemFont(ofSize: 14), range: NSMakeRange(0, attri.string.count))
|
|
|
+ attri.addAttribute(.font, value: NSFont.boldSystemFont(ofSize: fontSize), range: NSMakeRange(0, attri.string.count))
|
|
|
+ } else {
|
|
|
+ attri.addAttribute(.font, value: NSFont.systemFont(ofSize: fontSize), range: NSMakeRange(0, attri.string.count))
|
|
|
}
|
|
|
if italic {
|
|
|
attri.addAttribute(.obliqueness, value: 0.3, range: NSMakeRange(0, attri.string.count))
|
|
@@ -1146,9 +1163,9 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
}
|
|
|
|
|
|
//数据保存返回
|
|
|
- let areas = self.handdler?.editingTextAreas ?? []
|
|
|
- if areas.count > 0 {
|
|
|
+ if self.selectAreas.count > 0 {
|
|
|
if needChangeListView {
|
|
|
+ let areas = self.handdler?.editingTextAreas ?? []
|
|
|
for area in areas {
|
|
|
self.listView.setEditingSelectionFontName(name, with: area)
|
|
|
if styleString.contains("Bold") {
|