Showing
3 changed files
with
8 additions
and
5 deletions
| @@ -18,6 +18,7 @@ import 'dart:math' as math; | @@ -18,6 +18,7 @@ import 'dart:math' as math; | ||
| 18 | 18 | ||
| 19 | import 'package:meta/meta.dart'; | 19 | import 'package:meta/meta.dart'; |
| 20 | 20 | ||
| 21 | +import '../point.dart'; | ||
| 21 | import '../rect.dart'; | 22 | import '../rect.dart'; |
| 22 | 23 | ||
| 23 | /// Describe dimensions for glyphs in a font | 24 | /// Describe dimensions for glyphs in a font |
| @@ -130,6 +131,9 @@ class PdfFontMetrics { | @@ -130,6 +131,9 @@ class PdfFontMetrics { | ||
| 130 | /// Ending point | 131 | /// Ending point |
| 131 | double get rightBearing => advanceWidth - right; | 132 | double get rightBearing => advanceWidth - right; |
| 132 | 133 | ||
| 134 | + /// Get the unit size of this string | ||
| 135 | + PdfPoint get size => PdfPoint(width, height); | ||
| 136 | + | ||
| 133 | @override | 137 | @override |
| 134 | String toString() => | 138 | String toString() => |
| 135 | 'PdfFontMetrics(left:$left, top:$top, right:$right, bottom:$bottom, ascent:$ascent, descent:$descent, advanceWidth:$advanceWidth, leftBearing:$leftBearing, rightBearing:$rightBearing)'; | 139 | 'PdfFontMetrics(left:$left, top:$top, right:$right, bottom:$bottom, ascent:$ascent, descent:$descent, advanceWidth:$advanceWidth, leftBearing:$leftBearing, rightBearing:$rightBearing)'; |
| @@ -181,11 +181,9 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | @@ -181,11 +181,9 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | ||
| 181 | } | 181 | } |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | - /// Calculage the unit size of this string | ||
| 185 | - PdfPoint stringSize(String s) { | ||
| 186 | - final metrics = stringMetrics(s); | ||
| 187 | - return PdfPoint(metrics.width, metrics.height); | ||
| 188 | - } | 184 | + /// Calculate the unit size of this string |
| 185 | + @Deprecated('Use stringMetrics(s).size instead.') | ||
| 186 | + PdfPoint stringSize(String s) => stringMetrics(s).size; | ||
| 189 | 187 | ||
| 190 | @override | 188 | @override |
| 191 | String toString() => 'Font($fontName)'; | 189 | String toString() => 'Font($fontName)'; |
-
Please register or login to post a comment