David PHAM-VAN

Fix empty lines text gap

1 # Changelog 1 # Changelog
2 2
  3 +## 3.10.7
  4 +
  5 +- Fix empty lines text gap
  6 +
3 ## 3.10.6 7 ## 3.10.6
4 8
5 - Update bidi dependency 9 - Update bidi dependency
@@ -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;
@@ -12,7 +12,7 @@ topics: @@ -12,7 +12,7 @@ topics:
12 - print 12 - print
13 - printing 13 - printing
14 - report 14 - report
15 -version: 3.10.6 15 +version: 3.10.7
16 16
17 environment: 17 environment:
18 sdk: ">=2.18.0 <4.0.0" 18 sdk: ">=2.18.0 <4.0.0"