Skip to content

Commit

Permalink
fix font height() and advance-width() scaled metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Dec 16, 2023
1 parent 2782838 commit 181d2cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{$NEXT}}
- Fix face height and advance-width. Thanks Tom Browder
- Add face bbox() alias for bounding-box() #23.

0.5.3 2023-08-10T06:26:27+12:00
- Implement face .attach-file method and face creation option
Expand Down
4 changes: 2 additions & 2 deletions lib/Font/FreeType/SizeMetrics.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ method descender {
}

method height {
$!raw.height * $.y-scale;
$!raw.height / Dot6;
}

method underline-position {
Expand All @@ -54,7 +54,7 @@ method underline-thickness {
}

method max-advance-width is also<max-advance> {
$!raw.max-advance * $.x-scale;
$!raw.max-advance / Dot6;
}

method max-advance-height {
Expand Down
4 changes: 2 additions & 2 deletions t/10metrics_verasans.t
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ sub scaled-metrics-tests($scaled-metrics) {
is $scaled-metrics.y-ppem, 12, '.y-ppem';
is-approx $scaled-metrics.ascender, 11.138672, '.ascender';
is-approx $scaled-metrics.descender, -2.830078, '.descender';
is $scaled-metrics.height, 5.25, '.height';
is $scaled-metrics.max-advance, 6.0, '.max-advance';
is $scaled-metrics.height, 14, '.height';
is $scaled-metrics.max-advance, 16, '.max-advance';
is-approx $scaled-metrics.underline-position, -1.664063, '.underline-position';
is-approx $scaled-metrics.underline-thickness, 0.837891, '.underline-thickness';
my @bbox := $scaled-metrics.bounding-box;
Expand Down

0 comments on commit 181d2cf

Please sign in to comment.