Skip to content

Commit f583d4e

Browse files
committed
[fix] default tab interval
1 parent 90c17c0 commit f583d4e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/ZMarkupParser/HTML/Processor/HTMLElementMarkupComponentMarkupStyleVisitor.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,13 @@ struct HTMLElementMarkupComponentMarkupStyleVisitor: MarkupVisitor {
123123
if inheritStyle.font.size != nil {
124124
itemWidth = inheritStyle.font.sizeOf(string: item)?.width ?? 4
125125
} else {
126-
itemWidth = MarkupStyle.default.font.sizeOf(string: item)?.width ?? 4
126+
itemWidth = ceil(MarkupStyle.default.font.sizeOf(string: item)?.width ?? 4)
127127
}
128128

129129
var tabStops: [NSTextTab] = [.init(textAlignment: .left, location: headIndent)]
130130
tabStops.append(.init(textAlignment: .left, location: headIndent + itemWidth + indent))
131131

132+
defaultStyle.paragraphStyle.defaultTabInterval = defaultStyle.paragraphStyle.defaultTabInterval ?? 28
132133
defaultStyle.paragraphStyle.tabStops = defaultStyle.paragraphStyle.tabStops ?? tabStops
133134
defaultStyle.paragraphStyle.headIndent = defaultStyle.paragraphStyle.headIndent ?? defaultStyle.paragraphStyle.tabStops?.last?.location
134135

0 commit comments

Comments
 (0)