Skip to content

Commit

Permalink
add tests on shape :kern option
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Feb 26, 2024
1 parent e05646b commit 0646e21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion t/load-font.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 26;
plan 28;
use PDF::Grammar::Test :is-json-equiv;
use PDF::Font::Loader :Weight, :Stretch, :Slant;
use PDF::Content::FontObj;
Expand All @@ -24,12 +24,15 @@ my $times = PDF::Font::Loader.load-font: :file<t/fonts/TimesNewRomPS.pfa>;
# - Ring (˚) is not in WinsAnsii encoding
is-deeply $times.encode("A♥♣✔˚B", :str), "A\x[1]B", '.encode(...) sanity';
is-json-equiv $times.shape("flAVX" ), (["\x[2]A", <128+0i>, "VX"], 2594.0), '.shape(...)';
is-json-equiv $times.shape("flAVX", :!kern ), (["\x[2]AVX"], 2722.0), '.shape(:!kern)';

is $vera.stringwidth("RVX", :!kern), 2064, 'stringwidth :!kern';
is $vera.stringwidth("RVX", :kern), 2064 - 55, 'stringwidth :kern';
is-deeply $vera.kern("RVX" ), (['R', -55, 'VX'], 2064 - 55), '.kern(...)';
is-deeply $vera.kern('ABCD' ), (['AB', -18, 'CD'], 2820), '.kern(...)';
is-json-equiv $vera.shape("RVX" ), (["\0\c[53]", 56+0i, "\0\c[57]"~"\0\c[59]"], 2064 - 56), '.shape(...)';
todo "kerning not disabled?";
is-json-equiv $vera.shape("RVX", :!kern ), (["\0\c[53]" ~ "\0\c[57]"~"\0\c[59]"], 2064), '.shape(:!kern)';

is $vera.glyph-width('V'), 684;
$vera.glyph-width('V') -= 20;
Expand Down

0 comments on commit 0646e21

Please sign in to comment.