Skip to content

Commit

Permalink
small refactor of comb() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Jan 30, 2024
1 parent b4dd70e commit 07ae1e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/PDF/Font/Loader/Enc/CMap.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -127,7 +127,7 @@ method load-cmap(Str:D $_) {
if /:s \d+ begincodespacerange/ ff /endcodespacerange/ {
if /:s [ '<' $<r>=[<xdigit>+] '>' ] ** 2 / {
# <xxxx> <xxxx>
my ($from, $to) = @<r>.map: { [.Str.comb(/../).map({ :16($_)})] };
my ($from, $to) = @<r>.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;
Expand Down

0 comments on commit 07ae1e2

Please sign in to comment.