From 4db6b29c6105b1db1b04d9177eab261d2d2e57f4 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 21 Apr 2017 22:03:50 +0200 Subject: [PATCH] charset: encode wingdings font Custom Encode module to map Windows font to equivalent Unicode. Reference: --- Encode/Wingdings.pm | 31 +++++++++++++++++++++++++++++++ charset.plp | 7 ++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Encode/Wingdings.pm diff --git a/Encode/Wingdings.pm b/Encode/Wingdings.pm new file mode 100644 index 0000000..df06b86 --- /dev/null +++ b/Encode/Wingdings.pm @@ -0,0 +1,31 @@ +package Encode::Wingdings; + +use 5.014; +use warnings; +use utf8; + +our $VERSION = '1.00'; + +use parent 'Encode::Encoding'; +__PACKAGE__->Define('wingdings'); + +our @MAP = (qw[ + 🖉 ✂ ✁ 👓 🕭 🕮 🕯 🕿 ✆ 🖂 🖃 📪 📫 📬 📭 📁 📂 📄 🗏 🗐 🗄 ⌛ 🖮 🖰 🖲 🖳 🖴 🖫 🖬 ✇ ✍ + 🖎 ✌ 👌 👍 👎 ☜ ☞ ☝ ☟ 🖐 ☺ 😐 ☹ 💣 ☠ 🏳 🏱 ✈ ☼ 💧 ❄ 🕆 ✞ 🕈 ✠ ✡ ☪ ☯ ॐ ☸ ♈ ♉ + ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓ 🙰 🙵 ● 🔾 ■ □ 🞐 ❑ ❒ ⬧ ⧫ ◆ ❖ ⬥ ⌧ ⮹ ⌘ 🏵 🏶 🙶 🙷  + ⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⓿ ❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾ ❿ 🙢 🙠 🙡 🙣 🙞 🙜 🙝 🙟 · • + ▪ ⚪ 🞆 🞈 ◉ ◎ 🔿 ▪ ◻ 🟂 ✦ ★ ✶ ✴ ✹ ✵ ⯐ ⌖ ⟡ ⌑ ⯑ ✪ ✰ 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 + 🕙 🕚 🕛 ⮰ ⮱ ⮲ ⮳ ⮴ ⮵ ⮶ ⮷ 🙪 🙫 🙕 🙔 🙗 🙖 🙐 🙑 🙒 🙓 ⌫ ⌦ ⮘ ⮚ ⮙ ⮛ ⮈ ⮊ ⮉ ⮋ 🡨 + 🡪 🡩 🡫 🡬 🡭 🡯 🡮 🡸 🡺 🡹 🡻 🡼 🡽 🡿 🡾 ⇦ ⇨ ⇧ ⇩ ⬄ ⇳ ⬀ ⬁ ⬃ ⬂ 🢬 🢭 🗶 ✔ 🗷 🗹  +]); + +sub decode ($$;$) { + my ($self, $input, $check) = @_; + my $output = ''; + for (unpack 'C*', $input) { + $output .= $_ < 33 ? chr : $MAP[$_ - 33]; + } + return $output; +} + +1; diff --git a/charset.plp b/charset.plp index d25f23c..25bc44b 100644 --- a/charset.plp +++ b/charset.plp @@ -105,7 +105,7 @@ sub tabinput { hebrew => [qw( iso-8859-8 cp1255 MacHebrew cp862 U59-5F )], thai => [qw( iso-8859-11 cp874 MacThai )], vietnamese => [qw( viscii cp1258 MacVietnamese )], - symbols => [qw( symbol dingbats MacDingbats )], + symbols => [qw( symbol dingbats MacDingbats wingdings )], # iso-code shorthand 1 => 'westeur', @@ -138,6 +138,7 @@ sub tabinput { 'AdobeZdingbat'=> ['MacDingbats' => '128-159'], # should be identical but maps to private use 'symbol' => ['' => '32-127+160'], 'AdobeSymbol' => ['symbol' => '32-127+160', '' => '32-127+160'], # minor differences, irrelevant except for different '€' + 'wingdings' => ['' => '32'], 'iso-8859-2' => ['iso-8859-1' => '160'], 'iso-8859-3' => ['iso-8859-1' => '160'], #TODO: also apply to iso-8859-9 @@ -252,6 +253,10 @@ sub tabinput { } } + if (lc $input eq 'wingdings') { + require Encode::Wingdings; + } + if ($input =~ m{ \A u ([0-9a-f]+) (?:-([0-9a-f]+))? \z }ix) { my $start = hex($1) << ($2 ? 4 : 8); my $end = $2 ? (hex($2) << 4) + $row{cols} - 1 : $start + 255; -- 2.30.0