|
@@ -374,18 +374,23 @@ typedef NS_ENUM(NSUInteger, KMFreeTextMenuActionType) {
|
|
|
|
|
|
- (IBAction)styleAddButtonAction:(NSButton *)sender {
|
|
|
PDFAnnotationFreeText *annotation = (PDFAnnotationFreeText *)self.annotations.firstObject;
|
|
|
- NSString *fontName = [annotation.font.fontDescriptor objectForKey:NSFontFamilyAttribute] ? : @"PingFang HK";
|
|
|
- NSString *fontSize = [NSString stringWithFormat:@"%f", annotation.font.pointSize] ? : @"20";
|
|
|
- NSString *fontWeight = [annotation.font.fontDescriptor objectForKey:NSFontFaceAttribute] ? : @"Regular";
|
|
|
- NSColor *fontColor = annotation.fontColor ? : [NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0];
|
|
|
+
|
|
|
+ NSFont *annotationModelFont = [NSFont fontWithName:_annotationModel.fontName size:12];
|
|
|
+
|
|
|
+ NSString *fontName = annotation?[annotation.font.fontDescriptor objectForKey:NSFontFamilyAttribute] ? : @"PingFang HK" : annotationModelFont.fontName;
|
|
|
+ NSString *fontSize = [NSString stringWithFormat:@"%f", annotation? annotation.font.pointSize : _annotationModel.fontSize] ? : @"20";
|
|
|
+ NSString *fontWeight = annotation?[annotation.font.fontDescriptor objectForKey:NSFontFaceAttribute] ? : @"Regular" : [annotationModelFont.fontDescriptor objectForKey:NSFontFaceAttribute];
|
|
|
+ NSColor *fontColor = annotation? annotation.fontColor ? : [NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0] : _annotationModel.fontColor;
|
|
|
+ NSColor *backgroundColor = annotation? annotation.color ? : [NSColor colorWithRed:36/255.0 green:42/255.0 blue:51/255.0 alpha:1.0] : _annotationModel.color;
|
|
|
NSString *alignmentType = @"NSTextAlignmentLeft";
|
|
|
- if (annotation.alignment == NSTextAlignmentLeft) {
|
|
|
+ NSTextAlignment *alignment = annotation? annotation.alignment : _annotationModel.alignment;
|
|
|
+ if (alignment == NSTextAlignmentLeft) {
|
|
|
alignmentType = @"NSTextAlignmentLeft";
|
|
|
- } else if (annotation.alignment == NSTextAlignmentCenter) {
|
|
|
+ } else if (alignment == NSTextAlignmentCenter) {
|
|
|
alignmentType = @"NSTextAlignmentCenter";
|
|
|
- } else if (annotation.alignment == NSTextAlignmentRight) {
|
|
|
+ } else if (alignment == NSTextAlignmentRight) {
|
|
|
alignmentType = @"NSTextAlignmentRight";
|
|
|
- } else if (annotation.alignment == NSTextAlignmentJustified) {
|
|
|
+ } else if (alignment == NSTextAlignmentJustified) {
|
|
|
alignmentType = @"NSTextAlignmentJustified";
|
|
|
}
|
|
|
NSString *fontAlignment = alignmentType ? : @"NSTextAlignmentLeft";
|