From 07ae1e23e53bae06c54d09005b38093796ec3407 Mon Sep 17 00:00:00 2001 From: David Warring Date: Wed, 31 Jan 2024 06:30:03 +1300 Subject: [PATCH] small refactor of comb() usage --- lib/PDF/Font/Loader/Enc/CMap.rakumod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PDF/Font/Loader/Enc/CMap.rakumod b/lib/PDF/Font/Loader/Enc/CMap.rakumod index 69d54d9..f9c5f4a 100644 --- a/lib/PDF/Font/Loader/Enc/CMap.rakumod +++ b/lib/PDF/Font/Loader/Enc/CMap.rakumod @@ -115,7 +115,7 @@ sub hex-to-codepoints(Str() $x) { else { my \pad = $x.chars %% 4 ?? '' !! '0' x (4 - $x.chars % 4); # utf16 encoding semantics - my int16 @words = (pad ~ $x).comb(/..../).map: { :16($_) }; + my int16 @words = (pad ~ $x).comb(4).map: { :16($_) }; my utf16 $buf .= new(@words); $buf.decode.ords; } @@ -127,7 +127,7 @@ method load-cmap(Str:D $_) { if /:s \d+ begincodespacerange/ ff /endcodespacerange/ { if /:s [ '<' $=[+] '>' ] ** 2 / { # - my ($from, $to) = @.map: { [.Str.comb(/../).map({ :16($_)})] }; + my ($from, $to) = @.map: { [.Str.comb(2).map({ :16($_)})] }; my CodeSpace $codespace .= new: :from(@$from), :to(@$to); my $bytes := $codespace.bytes; $!max-width = $bytes if $bytes > $!max-width;