     
     /// return attributes for header/footer string
     private func headerFooterAttributes(for alignment: AlignmentType) -> [NSAttributedString.Key: Any] {
+        
+        let font = NSFont.userFont(ofSize: self.headerFooterFontSize)
     
         let paragraphStyle = NSParagraphStyle.default.mutable
-        
-        // alignment for two lines
+        paragraphStyle.lineBreakMode = .byTruncatingMiddle
         paragraphStyle.alignment = alignment.textAlignment
         
-        // tab stops for double-sided alignment (imitation of [super pageHeader])
+        // tab stops for double-sided alignment (imitation of super.pageHeader)
         if let printInfo = NSPrintOperation.current?.printInfo {
-            let rightTabLocation = printInfo.paperSize.width - printInfo.topMargin / 2
-            paragraphStyle.tabStops = [NSTextTab(type: .centerTabStopType, location: rightTabLocation / 2),
-                                       NSTextTab(type: .rightTabStopType, location: rightTabLocation)]
-        }
-        
-        // line break mode to truncate middle
-        paragraphStyle.lineBreakMode = .byTruncatingMiddle
-        
-        // font
-        guard let font = NSFont.userFont(ofSize: self.headerFooterFontSize) else {
-            return [.paragraphStyle: paragraphStyle]
-        }
-        
-        return [.paragraphStyle: paragraphStyle,
-                .font: font]
+            let xMax = printInfo.paperSize.width - printInfo.topMargin / 2
+            paragraphStyle.tabStops = [NSTextTab(type: .centerTabStopType, location: xMax / 2),
+                                       NSTextTab(type: .rightTabStopType, location: xMax)]
+        }
+        
+        return [.font: font,
+                .paragraphStyle: paragraphStyle]
+            .compactMapValues { $0 }
     }
     
     

    
    // MARK: Private Properties
    
    private var lineHeight: CGFloat
    private var printsLineNumber = false
    private var xOffset: CGFloat = 0
    private let dateFormatter: DateFormatter

        willSet {
            // set tab width
            let paragraphStyle = NSParagraphStyle.default.mutable
            
            paragraphStyle.tabStops = []
            paragraphStyle.defaultTabInterval = CGFloat(self.tabWidth) * (newValue?.spaceWidth ?? 0)
            paragraphStyle.lineHeightMultiple = self.lineHeight
            self.defaultParagraphStyle = paragraphStyle
            
