font: run splitting needs to detect italics

This commit is contained in:
Mitchell Hashimoto
2023-06-23 13:56:07 -07:00
parent 6e79e84acf
commit 30fdbaebf4

View File

@ -70,10 +70,17 @@ pub const RunIterator = struct {
// If we're a spacer, then we ignore it // If we're a spacer, then we ignore it
if (cell.attrs.wide_spacer_tail) continue; if (cell.attrs.wide_spacer_tail) continue;
const style: font.Style = if (cell.attrs.bold) // Text runs break when font styles change so we need to get
.bold // the proper style.
else const style: font.Style = style: {
.regular; if (cell.attrs.bold) {
if (cell.attrs.italic) break :style .bold_italic;
break :style .bold;
}
if (cell.attrs.italic) break :style .italic;
break :style .regular;
};
// Determine the presentation format for this glyph. // Determine the presentation format for this glyph.
const presentation: ?font.Presentation = if (cell.attrs.grapheme) p: { const presentation: ?font.Presentation = if (cell.attrs.grapheme) p: {