Showing
5 changed files
with
13 additions
and
3 deletions
| @@ -19,9 +19,10 @@ | @@ -19,9 +19,10 @@ | ||
| 19 | import 'dart:convert'; | 19 | import 'dart:convert'; |
| 20 | import 'dart:math' as math; | 20 | import 'dart:math' as math; |
| 21 | import 'dart:typed_data'; | 21 | import 'dart:typed_data'; |
| 22 | + | ||
| 22 | import 'package:meta/meta.dart'; | 23 | import 'package:meta/meta.dart'; |
| 23 | -import 'bidi_utils.dart' as bidi; | ||
| 24 | 24 | ||
| 25 | +import 'bidi_utils.dart' as bidi; | ||
| 25 | import 'font_metrics.dart'; | 26 | import 'font_metrics.dart'; |
| 26 | 27 | ||
| 27 | enum TtfParserName { | 28 | enum TtfParserName { |
| @@ -192,6 +193,8 @@ class TtfParser { | @@ -192,6 +193,8 @@ class TtfParser { | ||
| 192 | 193 | ||
| 193 | int get descent => bytes.getInt16(tableOffsets[hhea_table]! + 6); | 194 | int get descent => bytes.getInt16(tableOffsets[hhea_table]! + 6); |
| 194 | 195 | ||
| 196 | + int get lineGap => bytes.getInt16(tableOffsets[hhea_table]! + 8); | ||
| 197 | + | ||
| 195 | int get numOfLongHorMetrics => | 198 | int get numOfLongHorMetrics => |
| 196 | bytes.getUint16(tableOffsets[hhea_table]! + 34); | 199 | bytes.getUint16(tableOffsets[hhea_table]! + 34); |
| 197 | 200 |
| @@ -282,6 +282,9 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | @@ -282,6 +282,9 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | ||
| 282 | /// Spans the distance between the baseline and the lowest descending glyph | 282 | /// Spans the distance between the baseline and the lowest descending glyph |
| 283 | double get descent; | 283 | double get descent; |
| 284 | 284 | ||
| 285 | + /// Height of an empty line | ||
| 286 | + double get lineGap => ascent + descent; | ||
| 287 | + | ||
| 285 | /// Internal units per | 288 | /// Internal units per |
| 286 | int get unitsPerEm; | 289 | int get unitsPerEm; |
| 287 | 290 |
| @@ -1041,7 +1041,7 @@ class RichText extends Widget with SpanningWidget { | @@ -1041,7 +1041,7 @@ class RichText extends Widget with SpanningWidget { | ||
| 1041 | if (spanCount > 0) { | 1041 | if (spanCount > 0) { |
| 1042 | offsetY += bottom - top; | 1042 | offsetY += bottom - top; |
| 1043 | } else { | 1043 | } else { |
| 1044 | - offsetY += space.ascent + space.descent; | 1044 | + offsetY += font.lineGap * style.fontSize! * textScaleFactor; |
| 1045 | } | 1045 | } |
| 1046 | top = 0; | 1046 | top = 0; |
| 1047 | bottom = 0; | 1047 | bottom = 0; |
-
Please register or login to post a comment