Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions third_party/txt/src/txt/paragraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,8 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
}

paint.setStrokeWidth(
(SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kUnderlineThicknessIsValid_Flag))
(metrics.fFlags &
SkPaint::FontMetrics::FontMetricsFlags::kUnderlineThicknessIsValid_Flag)
? metrics.fUnderlineThickness *
record.style().decoration_thickness_multiplier
// Backup value if the fUnderlineThickness metric is not available:
Expand Down Expand Up @@ -833,11 +833,10 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
double y_offset_original = y_offset;
// Underline
if (record.style().decoration & 0x1) {
y_offset +=
(SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kUnderlinePositionIsValid_Flag))
? metrics.fUnderlinePosition
: metrics.fUnderlineThickness;
y_offset += (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kUnderlinePositionIsValid_Flag)
? metrics.fUnderlinePosition
: metrics.fUnderlineThickness;
if (record.style().decoration_style != TextDecorationStyle::kWavy) {
canvas->drawLine(x, y + y_offset, x + width, y + y_offset, paint);
} else {
Expand All @@ -863,20 +862,19 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
}
// Strikethrough
if (record.style().decoration & 0x4) {
if (SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag))
if (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag)
paint.setStrokeWidth(metrics.fStrikeoutThickness *
record.style().decoration_thickness_multiplier);
// Make sure the double line is "centered" vertically.
y_offset += (decoration_count - 1.0) * metrics.fUnderlineThickness *
kDoubleDecorationSpacing / -2.0;
y_offset +=
(SkToBool(metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag))
? metrics.fStrikeoutPosition
// Backup value if the strikeoutposition metric is not
// available:
: metrics.fXHeight / -2.0;
y_offset += (metrics.fFlags & SkPaint::FontMetrics::FontMetricsFlags::
kStrikeoutThicknessIsValid_Flag)
? metrics.fStrikeoutPosition
// Backup value if the strikeoutposition metric is not
// available:
: metrics.fXHeight / -2.0;
if (record.style().decoration_style != TextDecorationStyle::kWavy) {
canvas->drawLine(x, y + y_offset, x + width, y + y_offset, paint);
} else {
Expand Down