|
@@ -681,12 +681,13 @@ extension KMEditPDFTextPropertyViewController {
|
|
|
|
|
|
let size = string.size(withAttributes:attributes as [NSAttributedString.Key : Any])
|
|
|
let image = NSImage(size: NSSize(width: self.preImageView.frame.size.width, height: size.height))
|
|
|
- image.lockFocus()
|
|
|
- NSGraphicsContext.current?.imageInterpolation = .high
|
|
|
- NSString(string: string).draw(in: NSRect(x: 0, y: 0, width: self.preImageView.frame.size.width, height: image.size.height), withAttributes: attributes as [NSAttributedString.Key : Any])
|
|
|
- NSGraphicsContext.current?.imageInterpolation = .default
|
|
|
- image.unlockFocus()
|
|
|
-
|
|
|
+ if image.size.width != 0 && image.size.height != 0 {
|
|
|
+ image.lockFocus()
|
|
|
+ NSGraphicsContext.current?.imageInterpolation = .high
|
|
|
+ NSString(string: string).draw(in: NSRect(x: 0, y: 0, width: self.preImageView.frame.size.width, height: image.size.height), withAttributes: attributes as [NSAttributedString.Key : Any])
|
|
|
+ NSGraphicsContext.current?.imageInterpolation = .default
|
|
|
+ image.unlockFocus()
|
|
|
+ }
|
|
|
self.preImageView.image = image
|
|
|
}
|
|
|
|