use Data::Dump 'pp';
use PLP::Functions 'EscapeHTML';
-our $VERSION = '1.09';
+our $VERSION = '1.10';
our $uc = do 'data/unicode-char.inc.pl';
bless { anno => ['di', 0], style => 'di' }, $class;
}
-sub glyph_info {
+sub glyph_mkinfo {
my ($self, $codepoint) = @_;
- return $uc->{chr $codepoint} || eval {
+ # attempt to get unicode character information
+ my $info = eval {
require Unicode::UCD;
- if (my $fullinfo = Unicode::UCD::charinfo($codepoint)) {
- return [@$fullinfo{qw/category name - string/}];
- }
- } || [];
+ Unicode::UCD::charinfo($codepoint)
+ || { category => 'Xn', name => '' };
+ } or return;
+ my $string;
+ if ($info->{combining}) {
+ # overlay combining diacritics
+ $string = chr(9676) . chr($codepoint);
+ }
+ return [@$info{qw( category name )}, undef, $string];
+}
+
+sub glyph_info {
+ my ($self, $codepoint) = @_;
+ return $uc->{chr $codepoint} || $self->glyph_mkinfo($codepoint) || [];
}
sub glyph_html {