This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -518,8 +518,8 @@ bool ParagraphTxt::IsStrutValid() const {
518518}
519519
520520void ParagraphTxt::ComputeStrut (StrutMetrics* strut, SkFont& font) {
521- strut->ascent = std::numeric_limits<SkScalar>:: lowest () ;
522- strut->descent = std::numeric_limits<SkScalar>:: lowest () ;
521+ strut->ascent = 0 ;
522+ strut->descent = 0 ;
523523 strut->leading = 0 ;
524524 strut->half_leading = 0 ;
525525 strut->line_height = 0 ;
@@ -1123,8 +1123,10 @@ void ParagraphTxt::Layout(double width) {
11231123
11241124 // Calculate the amount to advance in the y direction. This is done by
11251125 // computing the maximum ascent and descent with respect to the strut.
1126- double max_ascent = strut_.ascent + strut_.half_leading ;
1127- double max_descent = strut_.descent + strut_.half_leading ;
1126+ double max_ascent = IsStrutValid () ? strut_.ascent + strut_.half_leading
1127+ : std::numeric_limits<double >::lowest ();
1128+ double max_descent = IsStrutValid () ? strut_.descent + strut_.half_leading
1129+ : std::numeric_limits<double >::lowest ();
11281130 double max_unscaled_ascent = 0 ;
11291131 for (const PaintRecord& paint_record : paint_records) {
11301132 UpdateLineMetrics (paint_record.metrics (), paint_record.style (),
You can’t perform that action at this time.
0 commit comments