|
@@ -702,12 +702,12 @@ class KMEditPDFTextPropertyViewController: NSViewController {
|
|
|
// fontName = KMEditPDFTextManager.manager.transformAreaTextFontName(fontName: fontName, fontNames: self.fontNameVC?.items ?? [])
|
|
|
|
|
|
self.fontNameVC?.stringValue = fontName
|
|
|
- if let data = self.listView?.isBoldCurrentSelection(byRangeEdit: area), data {
|
|
|
- fontName += "-Bold"
|
|
|
- }
|
|
|
- if let data = self.listView?.isItalicCurrentSelection(byRangeEdit: area), data {
|
|
|
- fontName += "-Italic"
|
|
|
- }
|
|
|
+// if let data = self.listView?.isBoldCurrentSelection(byRangeEdit: area), data {
|
|
|
+// fontName += "-Bold"
|
|
|
+// }
|
|
|
+// if let data = self.listView?.isItalicCurrentSelection(byRangeEdit: area), data {
|
|
|
+// fontName += "-Italic"
|
|
|
+// }
|
|
|
//获取默认数据
|
|
|
if needDefaultData {
|
|
|
let model = KMEditPDFTextManager.manager.fetchUserDefaultData(type: .commonly)
|
|
@@ -1284,12 +1284,14 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
func updateFontNameAndStyle(name: String, style: String, needChangeListView: Bool = true, needSave: Bool = true) {
|
|
|
// if fontName != name || fontStyle != style {
|
|
|
// let styleArray = defaultFontStyles //KMEditPDFTextManager.manager.fetchFontStyleWithFontName(fontName: name)
|
|
|
- var styleString = KMEditPDFTextManager.manager.checkFontStyle(style: style)
|
|
|
+// var styleString = KMEditPDFTextManager.manager.checkFontStyle(style: style)
|
|
|
+ var styleString = style
|
|
|
let fontStyleNames = CPDFFont.fontNames(forFamilyName: name)
|
|
|
if !fontStyleNames.contains(style) {
|
|
|
self.fontStyleVC?.addItems(withObjectValues: fontStyleNames)
|
|
|
self.fontStyleVC?.selectItem(at: 0)
|
|
|
- styleString = KMEditPDFTextManager.manager.checkFontStyle(style: self.fontStyleVC!.stringValue)
|
|
|
+// styleString = KMEditPDFTextManager.manager.checkFontStyle(style: self.fontStyleVC!.stringValue)
|
|
|
+ styleString = fontStyleNames.first ?? ""
|
|
|
} else {
|
|
|
self.fontStyleVC?.addItems(withObjectValues: fontStyleNames)
|
|
|
self.fontStyleVC?.selectItem(at: fontStyleNames.firstIndex(of: style) ?? 0)
|
|
@@ -1306,19 +1308,19 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
let areas = self.handdler?.editingTextAreas ?? []
|
|
|
for area in areas {
|
|
|
// self.listView.setEditingSelectionFontName(name, with: area)
|
|
|
- let font = CPDFFont(familyName: name, fontStyle: styleString)
|
|
|
+ let font = CPDFFont(familyName: name, fontStyle: style)
|
|
|
self.listView.setEditSelectionCFont(font, with: area)
|
|
|
- if styleString.contains("Bold") {
|
|
|
- self.listView.setCurrentSelectionIsBold(true, with: area)
|
|
|
- } else {
|
|
|
- self.listView.setCurrentSelectionIsBold(false, with: area)
|
|
|
- }
|
|
|
-
|
|
|
- if styleString.contains("Oblique") || styleString.contains("Italic") {
|
|
|
- self.listView.setCurrentSelectionIsItalic(true, with: area)
|
|
|
- } else {
|
|
|
- self.listView.setCurrentSelectionIsItalic(false, with: area)
|
|
|
- }
|
|
|
+// if styleString.contains("Bold") {
|
|
|
+// self.listView.setCurrentSelectionIsBold(true, with: area)
|
|
|
+// } else {
|
|
|
+// self.listView.setCurrentSelectionIsBold(false, with: area)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if styleString.contains("Oblique") || styleString.contains("Italic") {
|
|
|
+// self.listView.setCurrentSelectionIsItalic(true, with: area)
|
|
|
+// } else {
|
|
|
+// self.listView.setCurrentSelectionIsItalic(false, with: area)
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
} else {
|