This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View File

@@ -0,0 +1,326 @@
package PDF::API2::Resource::CIDFont::CJKFont;
use base 'PDF::API2::Resource::CIDFont';
use strict;
no warnings qw[ deprecated recursion uninitialized ];
our $VERSION = '2.033'; # VERSION
use PDF::API2::Util;
use PDF::API2::Basic::PDF::Utils;
our $fonts = {};
our $cmap = {};
our $alias;
our $subs;
=head1 NAME
PDF::API2::Resource::CIDFont::CJKFont - Base class for CJK fonts
=head1 METHODS
=over
=item $font = PDF::API2::Resource::CIDFont::CJKFont->new $pdf, $cjkname, %options
Returns a cjk-font object.
Traditional Chinese: Ming Ming-Bold Ming-Italic Ming-BoldItalic
Simplified Chinese: Song Song-Bold Song-Italic Song-BoldItalic
Korean: MyungJo MyungJo-Bold MyungJo-Italic MyungJo-BoldItalic
Japanese (Mincho): KozMin KozMin-Bold KozMin-Italic KozMin-BoldItalic
Japanese (Gothic): KozGo KozGo-Bold KozGo-Italic KozGo-BoldItalic
Defined Options:
-encode ... specify fonts encoding for non-utf8 text.
=cut
sub _look_for_font {
my $fname=lc(shift);
$fname=~s/[^a-z0-9]+//gi;
$fname=$alias->{$fname} if(defined $alias->{$fname});
return({%{$fonts->{$fname}}}) if(defined $fonts->{$fname});
if(defined $subs->{$fname}) {
my $data=_look_for_font($subs->{$fname}->{-alias});
foreach my $k (keys %{$subs->{$fname}}) {
next if($k=~/^\-/);
if(substr($k,0,1) eq '+')
{
$data->{substr($k,1)}.=$subs->{$fname}->{$k};
}
else
{
$data->{$k}=$subs->{$fname}->{$k};
}
}
$fonts->{$fname}=$data;
return({%{$data}})
}
eval "require 'PDF/API2/Resource/CIDFont/CJKFont/$fname.data'";
unless($@){
return({%{$fonts->{$fname}}});
} else {
die "requested font '$fname' not installed ";
}
}
sub _look_for_cmap {
my $fname=lc(shift);
$fname=~s/[^a-z0-9]+//gi;
return({%{$cmap->{$fname}}}) if(defined $cmap->{$fname});
eval "require \"PDF/API2/Resource/CIDFont/CMap/$fname.cmap\"";
unless($@){
return({%{$cmap->{$fname}}});
} else {
die "requested cmap '$fname' not installed ";
}
}
sub new {
my ($class,$pdf,$name,@opts) = @_;
my %opts=();
%opts=@opts if((scalar @opts)%2 == 0);
$opts{-encode}||='ident';
my $data = _look_for_font($name);
my $cmap = _look_for_cmap($data->{cmap});
$data->{u2g} = { %{$cmap->{u2g}} };
$data->{g2u} = [ @{$cmap->{g2u}} ];
$class = ref $class if ref $class;
my $self=$class->SUPER::new($pdf,$data->{apiname}.pdfkey());
$pdf->new_obj($self) if(defined($pdf) && !$self->is_obj($pdf));
$self->{' data'}=$data;
my $des=$self->descrByData;
my $de=$self->{' de'};
if(defined $opts{-encode} && $opts{-encode} ne 'ident') {
$self->data->{encode}=$opts{-encode};
}
my $emap={
'reg'=>'Adobe',
'ord'=>'Identity',
'sup'=> 0,
'map'=>'Identity',
'dir'=>'H',
'dec'=>'ident',
};
if(defined $cmap->{ccs}) {
$emap->{reg}=$cmap->{ccs}->[0];
$emap->{ord}=$cmap->{ccs}->[1];
$emap->{sup}=$cmap->{ccs}->[2];
}
#if(defined $cmap->{cmap} && defined $cmap->{cmap}->{$opts{-encode}} ) {
# $emap->{dec}=$cmap->{cmap}->{$opts{-encode}}->[0];
# $emap->{map}=$cmap->{cmap}->{$opts{-encode}}->[1];
#} elsif(defined $cmap->{cmap} && defined $cmap->{cmap}->{'utf8'} ) {
# $emap->{dec}=$cmap->{cmap}->{'utf8'}->[0];
# $emap->{map}=$cmap->{cmap}->{'utf8'}->[1];
#}
$self->data->{decode}=$emap->{dec};
$self->{'BaseFont'} = PDFName($self->fontname."-$emap->{map}-$emap->{dir}");
$self->{'Encoding'} = PDFName("$emap->{map}-$emap->{dir}");
$de->{'FontDescriptor'} = $des;
$de->{'Subtype'} = PDFName('CIDFontType0');
$de->{'BaseFont'} = PDFName($self->fontname);
$de->{'DW'} = PDFNum($self->missingwidth);
$de->{'CIDSystemInfo'}->{Registry} = PDFStr($emap->{reg});
$de->{'CIDSystemInfo'}->{Ordering} = PDFStr($emap->{ord});
$de->{'CIDSystemInfo'}->{Supplement} = PDFNum($emap->{sup});
## $de->{'CIDToGIDMap'} = PDFName($emap->{map}); # ttf only
return($self);
}
sub tounicodemap {
my $self=shift @_;
# noop since pdf knows its char-collection
return($self);
}
sub glyphByCId
{
my ($self,$cid)=@_;
my $uni = $self->uniByCId($cid);
return( nameByUni($uni) );
}
sub outobjdeep {
my ($self, $fh, $pdf, %opts) = @_;
my $notdefbefore=1;
my $wx=PDFArray();
$self->{' de'}->{'W'} = $wx;
my $ml;
foreach my $w (0..(scalar @{$self->data->{g2u}} - 1 )) {
if(ref($self->data->{wx}) eq 'ARRAY'
&& (defined $self->data->{wx}->[$w])
&& ($self->data->{wx}->[$w] != $self->missingwidth)
&& $notdefbefore==1)
{
$notdefbefore=0;
$ml=PDFArray();
$wx->add_elements(PDFNum($w),$ml);
$ml->add_elements(PDFNum($self->data->{wx}->[$w]));
}
elsif(ref($self->data->{wx}) eq 'HASH'
&& (defined $self->data->{wx}->{$w})
&& ($self->data->{wx}->{$w} != $self->missingwidth)
&& $notdefbefore==1)
{
$notdefbefore=0;
$ml=PDFArray();
$wx->add_elements(PDFNum($w),$ml);
$ml->add_elements(PDFNum($self->data->{wx}->{$w}));
}
elsif(ref($self->data->{wx}) eq 'ARRAY'
&& (defined $self->data->{wx}->[$w])
&& ($self->data->{wx}->[$w] != $self->missingwidth)
&& $notdefbefore==0)
{
$notdefbefore=0;
$ml->add_elements(PDFNum($self->data->{wx}->[$w]));
}
elsif(ref($self->data->{wx}) eq 'HASH'
&& (defined $self->data->{wx}->{$w})
&& ($self->data->{wx}->{$w} != $self->missingwidth)
&& $notdefbefore==0)
{
$notdefbefore=0;
$ml->add_elements(PDFNum($self->data->{wx}->{$w}));
}
else
{
$notdefbefore=1;
}
}
$self->SUPER::outobjdeep($fh, $pdf, %opts);
}
BEGIN {
$alias={
'traditional' => 'adobemingstdlightacro',
'traditionalbold' => 'mingbold',
'traditionalitalic' => 'mingitalic',
'traditionalbolditalic' => 'mingbolditalic',
'ming' => 'adobemingstdlightacro',
'simplified' => 'adobesongstdlightacro',
'simplifiedbold' => 'songbold',
'simplifieditalic' => 'songitalic',
'simplifiedbolditalic' => 'songbolditalic',
'song' => 'adobesongstdlightacro',
'korean' => 'adobemyungjostdmediumacro',
'koreanbold' => 'myungjobold',
'koreanitalic' => 'myungjoitalic',
'koreanbolditalic' => 'myungjobolditalic',
'myungjo' => 'adobemyungjostdmediumacro',
'japanese' => 'kozminproregularacro',
'japanesebold' => 'kozminbold',
'japaneseitalic' => 'kozminitalic',
'japanesebolditalic' => 'kozminbolditalic',
'kozmin' => 'kozminproregularacro',
'kozgo' => 'kozgopromediumacro',
};
$subs={
# Chinese Traditional (ie. Taiwan) Fonts
'mingitalic' => {
'-alias' => 'adobemingstdlightacro',
'+fontname' => ',Italic',
},
'mingbold' => {
'-alias' => 'adobemingstdlightacro',
'+fontname' => ',Bold',
},
'mingbolditalic' => {
'-alias' => 'adobemingstdlightacro',
'+fontname' => ',BoldItalic',
},
# Chinese Simplified (ie. Mainland China) Fonts
'songitalic' => {
'-alias' => 'adobesongstdlightacro',
'+fontname' => ',Italic',
},
'songbold' => {
'-alias' => 'adobesongstdlightacro',
'+fontname' => ',Bold',
},
'songbolditalic' => {
'-alias' => 'adobesongstdlightacro',
'+fontname' => ',BoldItalic',
},
# Japanese Gothic (ie. sans) Fonts
'kozgoitalic' => {
'-alias' => 'kozgopromediumacro',
'+fontname' => ',Italic',
},
'kozgobold' => {
'-alias' => 'kozgopromediumacro',
'+fontname' => ',Bold',
},
'kozgobolditalic' => {
'-alias' => 'kozgopromediumacro',
'+fontname' => ',BoldItalic',
},
# Japanese Mincho (ie. serif) Fonts
'kozminitalic' => {
'-alias' => 'kozminproregularacro',
'+fontname' => ',Italic',
},
'kozminbold' => {
'-alias' => 'kozminproregularacro',
'+fontname' => ',Bold',
},
'kozminbolditalic' => {
'-alias' => 'kozminproregularacro',
'+fontname' => ',BoldItalic',
},
# Korean Fonts
'myungjoitalic' => {
'-alias' => 'adobemyungjostdmediumacro',
'+fontname' => ',Italic',
},
'myungjobold' => {
'-alias' => 'adobemyungjostdmediumacro',
'+fontname' => ',Bold',
},
'myungjobolditalic' => {
'-alias' => 'adobemyungjostdmediumacro',
'+fontname' => ',BoldItalic',
},
};
}
=back
=cut
1;

View File

@@ -0,0 +1,659 @@
$fonts->{kozgopromediumacro} = {
'fontname' => 'KozGoPro-Medium-Acro', # Acrobat 6 Name
'fontfamily' => 'Kozuka Gothic Pro',
'fontstretch' => 'Normal',
'fontweight' => 500,
'subname' => 'Regular',
'cmap' => 'japanese',
'encode' => 'euc-jp',
'ascender' => 880,
'capheight' => 737,
'descender' => -271,
'italicangle' => 0,
'underlineposition' => -75,
'underlinethickness' => 50,
'xheight' => 553,
'flags' => 4,
'isfixedpitch' => 0,
'issymbol' => 0,
'missingwidth' => 1000,
'maxwidth' => 1288,
'fontbbox' => [ -149, -374, 1254, 1008 ],
'panose' => "\x08\x01\x02\x0b\x05\x00\x00\x00\x00\x00\x00\x00",
'glyphs' => 15444,
'wx' => [
1000, # U+0x3C53, G+0
224, # U+0x0000, G+1
266, # U+0x3C53, G+2
392, # U+0x0000, G+3
551, # U+0x0000, G+4
562, # U+0x0000, G+5
883, # U+0x0000, G+6
677, # U+0x0000, G+7
213, # U+0x0000, G+8
322, # U+0x0000, G+9
322, # U+0x0000, G+10
470, # U+0x0000, G+11
677, # U+0x0000, G+12
247, # U+0x0000, G+13
343, # U+0x0000, G+14
245, # U+0x0000, G+15
370, # U+0x0000, G+16
562, # U+0x0000, G+17
562, # U+0x0000, G+18
562, # U+0x0000, G+19
562, # U+0x0000, G+20
562, # U+0x0000, G+21
562, # U+0x0000, G+22
562, # U+0x0000, G+23
562, # U+0x0000, G+24
562, # U+0x0000, G+25
562, # U+0x0000, G+26
245, # U+0x0000, G+27
247, # U+0x0000, G+28
677, # U+0x0000, G+29
677, # U+0x0000, G+30
677, # U+0x0000, G+31
447, # U+0x0000, G+32
808, # U+0x0000, G+33
661, # U+0x0000, G+34
602, # U+0x0000, G+35
610, # U+0x0000, G+36
708, # U+0x0000, G+37
535, # U+0x0000, G+38
528, # U+0x0000, G+39
689, # U+0x0000, G+40
703, # U+0x0000, G+41
275, # U+0x0000, G+42
404, # U+0x0000, G+43
602, # U+0x0000, G+44
514, # U+0x0000, G+45
871, # U+0x0000, G+46
708, # U+0x0000, G+47
727, # U+0x0000, G+48
585, # U+0x0000, G+49
727, # U+0x0000, G+50
595, # U+0x0000, G+51
539, # U+0x0000, G+52
541, # U+0x0000, G+53
696, # U+0x0000, G+54
619, # U+0x0000, G+55
922, # U+0x0000, G+56
612, # U+0x0000, G+57
591, # U+0x0000, G+58
584, # U+0x0000, G+59
322, # U+0x0000, G+60
562, # U+0x0000, G+61
322, # U+0x0000, G+62
677, # U+0x0000, G+63
568, # U+0x0000, G+64
340, # U+0x0000, G+65
532, # U+0x0000, G+66
612, # U+0x0000, G+67
475, # U+0x0000, G+68
608, # U+0x0000, G+69
543, # U+0x0000, G+70
332, # U+0x0000, G+71
603, # U+0x0000, G+72
601, # U+0x0000, G+73
265, # U+0x0000, G+74
276, # U+0x0000, G+75
524, # U+0x0000, G+76
264, # U+0x0000, G+77
901, # U+0x0000, G+78
601, # U+0x0000, G+79
590, # U+0x0000, G+80
612, # U+0x0000, G+81
607, # U+0x0000, G+82
367, # U+0x0000, G+83
433, # U+0x0000, G+84
369, # U+0x0000, G+85
597, # U+0x0000, G+86
527, # U+0x0000, G+87
800, # U+0x0000, G+88
511, # U+0x0000, G+89
518, # U+0x0000, G+90
468, # U+0x0000, G+91
321, # U+0x0000, G+92
273, # U+0x0000, G+93
321, # U+0x0000, G+94
341, # U+0x0000, G+95
241, # U+0x0000, G+96
362, # U+0x0000, G+97
241, # U+0x0000, G+98
273, # U+0x0000, G+99
677, # U+0x0000, G+100
266, # U+0x0000, G+101
562, # U+0x0000, G+102
562, # U+0x0000, G+103
456, # U+0x0000, G+104
562, # U+0x0000, G+105
571, # U+0x0000, G+106
562, # U+0x0000, G+107
416, # U+0x0000, G+108
472, # U+0x0000, G+109
283, # U+0x0000, G+110
283, # U+0x0000, G+111
587, # U+0x0000, G+112
588, # U+0x0000, G+113
568, # U+0x0000, G+114
545, # U+0x0000, G+115
545, # U+0x0000, G+116
247, # U+0x0000, G+117
561, # U+0x0000, G+118
330, # U+0x0000, G+119
239, # U+0x0000, G+120
418, # U+0x0000, G+121
416, # U+0x0000, G+122
472, # U+0x0000, G+123
1136, # U+0x0000, G+124
1288, # U+0x0000, G+125
447, # U+0x0000, G+126
340, # U+0x0000, G+127
340, # U+0x0000, G+128
340, # U+0x0000, G+129
340, # U+0x0000, G+130
340, # U+0x0000, G+131
340, # U+0x0000, G+132
455, # U+0x0000, G+133
340, # U+0x0000, G+134
340, # U+0x0000, G+135
340, # U+0x0000, G+136
340, # U+0x0000, G+137
1136, # U+0x0000, G+138
857, # U+0x0000, G+139
384, # U+0x0000, G+140
519, # U+0x0000, G+141
727, # U+0x0000, G+142
952, # U+0x0000, G+143
398, # U+0x0000, G+144
834, # U+0x0000, G+145
264, # U+0x0000, G+146
275, # U+0x0000, G+147
590, # U+0x0000, G+148
918, # U+0x0000, G+149
605, # U+0x0000, G+150
677, # U+0x0000, G+151
769, # U+0x0000, G+152
677, # U+0x0000, G+153
473, # U+0x0000, G+154
361, # U+0x0000, G+155
677, # U+0x0000, G+156
347, # U+0x0000, G+157
340, # U+0x0000, G+158
599, # U+0x0000, G+159
284, # U+0x0000, G+160
845, # U+0x0000, G+161
845, # U+0x0000, G+162
845, # U+0x0000, G+163
661, # U+0x0000, G+164
661, # U+0x0000, G+165
661, # U+0x0000, G+166
661, # U+0x0000, G+167
661, # U+0x0000, G+168
661, # U+0x0000, G+169
610, # U+0x0000, G+170
535, # U+0x0000, G+171
535, # U+0x0000, G+172
535, # U+0x0000, G+173
535, # U+0x0000, G+174
275, # U+0x0000, G+175
275, # U+0x0000, G+176
275, # U+0x0000, G+177
275, # U+0x0000, G+178
715, # U+0x0000, G+179
708, # U+0x0000, G+180
727, # U+0x0000, G+181
727, # U+0x0000, G+182
727, # U+0x0000, G+183
727, # U+0x0000, G+184
727, # U+0x0000, G+185
677, # U+0x0000, G+186
696, # U+0x0000, G+187
696, # U+0x0000, G+188
696, # U+0x0000, G+189
696, # U+0x0000, G+190
591, # U+0x0000, G+191
584, # U+0x0000, G+192
532, # U+0x0000, G+193
532, # U+0x0000, G+194
532, # U+0x0000, G+195
532, # U+0x0000, G+196
532, # U+0x0000, G+197
532, # U+0x0000, G+198
475, # U+0x0000, G+199
543, # U+0x0000, G+200
543, # U+0x0000, G+201
543, # U+0x0000, G+202
543, # U+0x0000, G+203
264, # U+0x0000, G+204
264, # U+0x0000, G+205
264, # U+0x0000, G+206
264, # U+0x0000, G+207
584, # U+0x0000, G+208
601, # U+0x0000, G+209
590, # U+0x0000, G+210
590, # U+0x0000, G+211
590, # U+0x0000, G+212
590, # U+0x0000, G+213
590, # U+0x0000, G+214
677, # U+0x0000, G+215
597, # U+0x0000, G+216
597, # U+0x0000, G+217
597, # U+0x0000, G+218
597, # U+0x0000, G+219
518, # U+0x0000, G+220
612, # U+0x0000, G+221
518, # U+0x0000, G+222
539, # U+0x0000, G+223
591, # U+0x0000, G+224
584, # U+0x0000, G+225
446, # U+0x0000, G+226
433, # U+0x0000, G+227
683, # U+0x0000, G+228
468, # U+0x0000, G+229
562, # U+0x0000, G+230
500, # U+0x0000, G+231
500, # U+0x0000, G+232
500, # U+0x0000, G+233
500, # U+0x0000, G+234
500, # U+0x0000, G+235
500, # U+0x0000, G+236
500, # U+0x0000, G+237
500, # U+0x0000, G+238
500, # U+0x0000, G+239
500, # U+0x0000, G+240
500, # U+0x0000, G+241
500, # U+0x0000, G+242
500, # U+0x0000, G+243
500, # U+0x0000, G+244
500, # U+0x0000, G+245
500, # U+0x0000, G+246
500, # U+0x0000, G+247
500, # U+0x0000, G+248
500, # U+0x0000, G+249
500, # U+0x0000, G+250
500, # U+0x0000, G+251
500, # U+0x0000, G+252
500, # U+0x0000, G+253
500, # U+0x0000, G+254
500, # U+0x0000, G+255
500, # U+0x0000, G+256
500, # U+0x0000, G+257
500, # U+0x0000, G+258
500, # U+0x0000, G+259
500, # U+0x0000, G+260
500, # U+0x0000, G+261
500, # U+0x0000, G+262
500, # U+0x0000, G+263
500, # U+0x0000, G+264
500, # U+0x0000, G+265
500, # U+0x0000, G+266
500, # U+0x0000, G+267
500, # U+0x0000, G+268
500, # U+0x0000, G+269
500, # U+0x0000, G+270
500, # U+0x0000, G+271
500, # U+0x0000, G+272
500, # U+0x0000, G+273
500, # U+0x0000, G+274
500, # U+0x0000, G+275
500, # U+0x0000, G+276
500, # U+0x0000, G+277
500, # U+0x0000, G+278
500, # U+0x0000, G+279
500, # U+0x0000, G+280
500, # U+0x0000, G+281
500, # U+0x0000, G+282
500, # U+0x0000, G+283
500, # U+0x0000, G+284
500, # U+0x0000, G+285
500, # U+0x0000, G+286
500, # U+0x0000, G+287
500, # U+0x0000, G+288
500, # U+0x0000, G+289
500, # U+0x0000, G+290
500, # U+0x0000, G+291
500, # U+0x0000, G+292
500, # U+0x0000, G+293
500, # U+0x0000, G+294
500, # U+0x0000, G+295
500, # U+0x0000, G+296
500, # U+0x0000, G+297
500, # U+0x0000, G+298
500, # U+0x0000, G+299
500, # U+0x0000, G+300
500, # U+0x0000, G+301
500, # U+0x0000, G+302
500, # U+0x0000, G+303
500, # U+0x0000, G+304
500, # U+0x0000, G+305
500, # U+0x0000, G+306
500, # U+0x0000, G+307
500, # U+0x0000, G+308
500, # U+0x0000, G+309
500, # U+0x0000, G+310
500, # U+0x0000, G+311
500, # U+0x0000, G+312
500, # U+0x0000, G+313
500, # U+0x0000, G+314
500, # U+0x0000, G+315
500, # U+0x0000, G+316
500, # U+0x0000, G+317
500, # U+0x0000, G+318
500, # U+0x0000, G+319
500, # U+0x0000, G+320
500, # U+0x0000, G+321
500, # U+0x0000, G+322
500, # U+0x0000, G+323
500, # U+0x0000, G+324
500, # U+0x0000, G+325
500, # U+0x0000, G+326
500, # U+0x0000, G+327
500, # U+0x0000, G+328
500, # U+0x0000, G+329
500, # U+0x0000, G+330
500, # U+0x0000, G+331
500, # U+0x0000, G+332
500, # U+0x0000, G+333
500, # U+0x0000, G+334
500, # U+0x0000, G+335
500, # U+0x0000, G+336
500, # U+0x0000, G+337
500, # U+0x0000, G+338
500, # U+0x0000, G+339
500, # U+0x0000, G+340
500, # U+0x0000, G+341
500, # U+0x0000, G+342
500, # U+0x0000, G+343
500, # U+0x0000, G+344
500, # U+0x0000, G+345
500, # U+0x0000, G+346
500, # U+0x0000, G+347
500, # U+0x0000, G+348
500, # U+0x0000, G+349
500, # U+0x0000, G+350
500, # U+0x0000, G+351
500, # U+0x0000, G+352
500, # U+0x0000, G+353
500, # U+0x0000, G+354
500, # U+0x0000, G+355
500, # U+0x0000, G+356
500, # U+0x0000, G+357
500, # U+0x0000, G+358
500, # U+0x0000, G+359
500, # U+0x0000, G+360
500, # U+0x0000, G+361
500, # U+0x0000, G+362
500, # U+0x0000, G+363
500, # U+0x0000, G+364
500, # U+0x0000, G+365
500, # U+0x0000, G+366
500, # U+0x0000, G+367
500, # U+0x0000, G+368
500, # U+0x0000, G+369
500, # U+0x0000, G+370
500, # U+0x0000, G+371
500, # U+0x0000, G+372
500, # U+0x0000, G+373
500, # U+0x0000, G+374
500, # U+0x0000, G+375
500, # U+0x0000, G+376
500, # U+0x0000, G+377
500, # U+0x0000, G+378
500, # U+0x0000, G+379
500, # U+0x0000, G+380
500, # U+0x0000, G+381
500, # U+0x0000, G+382
500, # U+0x0000, G+383
500, # U+0x0000, G+384
500, # U+0x0000, G+385
500, # U+0x0000, G+386
500, # U+0x0000, G+387
500, # U+0x0000, G+388
500, # U+0x0000, G+389
500, # U+0x0000, G+390
500, # U+0x0000, G+391
500, # U+0x0000, G+392
500, # U+0x0000, G+393
500, # U+0x0000, G+394
500, # U+0x0000, G+395
500, # U+0x0000, G+396
500, # U+0x0000, G+397
500, # U+0x0000, G+398
500, # U+0x0000, G+399
500, # U+0x0000, G+400
500, # U+0x0000, G+401
500, # U+0x0000, G+402
500, # U+0x0000, G+403
500, # U+0x0000, G+404
500, # U+0x0000, G+405
500, # U+0x0000, G+406
500, # U+0x0000, G+407
500, # U+0x0000, G+408
500, # U+0x0000, G+409
500, # U+0x0000, G+410
500, # U+0x0000, G+411
500, # U+0x0000, G+412
500, # U+0x0000, G+413
500, # U+0x0000, G+414
500, # U+0x0000, G+415
500, # U+0x0000, G+416
500, # U+0x0000, G+417
500, # U+0x0000, G+418
500, # U+0x0000, G+419
500, # U+0x0000, G+420
500, # U+0x0000, G+421
500, # U+0x0000, G+422
500, # U+0x0000, G+423
500, # U+0x0000, G+424
500, # U+0x0000, G+425
500, # U+0x0000, G+426
500, # U+0x0000, G+427
500, # U+0x0000, G+428
500, # U+0x0000, G+429
500, # U+0x0000, G+430
500, # U+0x0000, G+431
500, # U+0x0000, G+432
500, # U+0x0000, G+433
500, # U+0x0000, G+434
500, # U+0x0000, G+435
500, # U+0x0000, G+436
500, # U+0x0000, G+437
500, # U+0x0000, G+438
500, # U+0x0000, G+439
500, # U+0x0000, G+440
500, # U+0x0000, G+441
500, # U+0x0000, G+442
500, # U+0x0000, G+443
500, # U+0x0000, G+444
500, # U+0x0000, G+445
500, # U+0x0000, G+446
500, # U+0x0000, G+447
500, # U+0x0000, G+448
500, # U+0x0000, G+449
500, # U+0x0000, G+450
500, # U+0x0000, G+451
500, # U+0x0000, G+452
500, # U+0x0000, G+453
500, # U+0x0000, G+454
500, # U+0x0000, G+455
500, # U+0x0000, G+456
500, # U+0x0000, G+457
500, # U+0x0000, G+458
500, # U+0x0000, G+459
500, # U+0x0000, G+460
500, # U+0x0000, G+461
500, # U+0x0000, G+462
500, # U+0x0000, G+463
500, # U+0x0000, G+464
500, # U+0x0000, G+465
500, # U+0x0000, G+466
500, # U+0x0000, G+467
500, # U+0x0000, G+468
500, # U+0x0000, G+469
500, # U+0x0000, G+470
500, # U+0x0000, G+471
500, # U+0x0000, G+472
500, # U+0x0000, G+473
500, # U+0x0000, G+474
500, # U+0x0000, G+475
500, # U+0x0000, G+476
500, # U+0x0000, G+477
500, # U+0x0000, G+478
500, # U+0x0000, G+479
500, # U+0x0000, G+480
500, # U+0x0000, G+481
500, # U+0x0000, G+482
500, # U+0x0000, G+483
500, # U+0x0000, G+484
500, # U+0x0000, G+485
500, # U+0x0000, G+486
500, # U+0x0000, G+487
500, # U+0x0000, G+488
500, # U+0x0000, G+489
500, # U+0x0000, G+490
500, # U+0x0000, G+491
500, # U+0x0000, G+492
500, # U+0x0000, G+493
500, # U+0x0000, G+494
500, # U+0x0000, G+495
500, # U+0x0000, G+496
500, # U+0x0000, G+497
500, # U+0x0000, G+498
500, # U+0x0000, G+499
500, # U+0x0000, G+500
500, # U+0x0000, G+501
500, # U+0x0000, G+502
500, # U+0x0000, G+503
500, # U+0x0000, G+504
500, # U+0x0000, G+505
500, # U+0x0000, G+506
500, # U+0x0000, G+507
500, # U+0x0000, G+508
500, # U+0x0000, G+509
500, # U+0x0000, G+510
500, # U+0x0000, G+511
500, # U+0x0000, G+512
500, # U+0x0000, G+513
500, # U+0x0000, G+514
500, # U+0x0000, G+515
500, # U+0x0000, G+516
500, # U+0x0000, G+517
500, # U+0x0000, G+518
500, # U+0x0000, G+519
500, # U+0x0000, G+520
500, # U+0x0000, G+521
500, # U+0x0000, G+522
500, # U+0x0000, G+523
500, # U+0x0000, G+524
500, # U+0x0000, G+525
500, # U+0x0000, G+526
500, # U+0x0000, G+527
500, # U+0x0000, G+528
500, # U+0x0000, G+529
500, # U+0x0000, G+530
500, # U+0x0000, G+531
500, # U+0x0000, G+532
500, # U+0x0000, G+533
500, # U+0x0000, G+534
500, # U+0x0000, G+535
500, # U+0x0000, G+536
500, # U+0x0000, G+537
500, # U+0x0000, G+538
500, # U+0x0000, G+539
500, # U+0x0000, G+540
500, # U+0x0000, G+541
500, # U+0x0000, G+542
500, # U+0x0000, G+543
500, # U+0x0000, G+544
500, # U+0x0000, G+545
500, # U+0x0000, G+546
500, # U+0x0000, G+547
500, # U+0x0000, G+548
500, # U+0x0000, G+549
500, # U+0x0000, G+550
500, # U+0x0000, G+551
500, # U+0x0000, G+552
500, # U+0x0000, G+553
500, # U+0x0000, G+554
500, # U+0x0000, G+555
500, # U+0x0000, G+556
500, # U+0x0000, G+557
500, # U+0x0000, G+558
500, # U+0x0000, G+559
500, # U+0x0000, G+560
500, # U+0x0000, G+561
500, # U+0x0000, G+562
500, # U+0x0000, G+563
500, # U+0x0000, G+564
500, # U+0x0000, G+565
500, # U+0x0000, G+566
500, # U+0x0000, G+567
500, # U+0x0000, G+568
500, # U+0x0000, G+569
500, # U+0x0000, G+570
500, # U+0x0000, G+571
500, # U+0x0000, G+572
500, # U+0x0000, G+573
500, # U+0x0000, G+574
500, # U+0x0000, G+575
500, # U+0x0000, G+576
500, # U+0x0000, G+577
500, # U+0x0000, G+578
500, # U+0x0000, G+579
500, # U+0x0000, G+580
500, # U+0x0000, G+581
500, # U+0x0000, G+582
500, # U+0x0000, G+583
500, # U+0x0000, G+584
500, # U+0x0000, G+585
500, # U+0x0000, G+586
500, # U+0x0000, G+587
500, # U+0x0000, G+588
500, # U+0x0000, G+589
500, # U+0x0000, G+590
500, # U+0x0000, G+591
500, # U+0x0000, G+592
500, # U+0x0000, G+593
500, # U+0x0000, G+594
500, # U+0x0000, G+595
500, # U+0x0000, G+596
500, # U+0x0000, G+597
500, # U+0x0000, G+598
500, # U+0x0000, G+599
500, # U+0x0000, G+600
500, # U+0x0000, G+601
500, # U+0x0000, G+602
500, # U+0x0000, G+603
500, # U+0x0000, G+604
500, # U+0x0000, G+605
500, # U+0x0000, G+606
500, # U+0x0000, G+607
500, # U+0x0000, G+608
500, # U+0x0000, G+609
500, # U+0x0000, G+610
500, # U+0x0000, G+611
500, # U+0x0000, G+612
500, # U+0x0000, G+613
500, # U+0x0000, G+614
500, # U+0x0000, G+615
500, # U+0x0000, G+616
500, # U+0x0000, G+617
500, # U+0x0000, G+618
500, # U+0x0000, G+619
500, # U+0x0000, G+620
500, # U+0x0000, G+621
500, # U+0x0000, G+622
500, # U+0x0000, G+623
500, # U+0x0000, G+624
500, # U+0x0000, G+625
500, # U+0x0000, G+626
500, # U+0x0000, G+627
500, # U+0x0000, G+628
500, # U+0x0000, G+629
500, # U+0x0000, G+630
500, # U+0x0000, G+631
500, # U+0x0000, G+632
],
};

View File

@@ -0,0 +1,660 @@
$fonts->{kozminproregularacro} = {
'fontname' => 'KozMinPro-Regular-Acro', # Acrobat 5/6 Name
'fontfamily' => 'Kozuka Mincho Pro',
'fontstretch' => 'Normal',
'fontweight' => '500',
'altname' => 'KozukaMinchoProAcroR',
'subname' => 'Regular',
'cmap' => 'japanese',
'encode' => 'euc-jp',
'ascender' => 880,
'capheight' => 742,
'descender' => -120,
'italicangle' => 0,
'underlineposition' => -75,
'underlinethickness' => 50,
'xheight' => 503,
'flags' => 6,
'isfixedpitch' => 1,
'issymbol' => 0,
'missingwidth' => 1000,
'maxwidth' => 1075,
'fontbbox' => [ -195, -272, 1110, 1075 ],
'panose' => "\x01\x05\x02\x02\x03\x00\x00\x00\x00\x00\x00\x00",
'glyphs' => 15444,
'wx' => [
1000, # U+0x0000, G+0
278, # U+0x0000, G+1
299, # U+0x3C53, G+2
353, # U+0x0000, G+3
614, # U+0x0000, G+4
614, # U+0x0000, G+5
721, # U+0x0000, G+6
735, # U+0x0000, G+7
216, # U+0x0000, G+8
323, # U+0x0000, G+9
323, # U+0x0000, G+10
449, # U+0x0000, G+11
529, # U+0x0000, G+12
219, # U+0x0000, G+13
306, # U+0x0000, G+14
219, # U+0x0000, G+15
453, # U+0x0000, G+16
614, # U+0x0000, G+17
614, # U+0x0000, G+18
614, # U+0x0000, G+19
614, # U+0x0000, G+20
614, # U+0x0000, G+21
614, # U+0x0000, G+22
614, # U+0x0000, G+23
614, # U+0x0000, G+24
614, # U+0x0000, G+25
614, # U+0x0000, G+26
219, # U+0x0000, G+27
219, # U+0x0000, G+28
529, # U+0x0000, G+29
529, # U+0x0000, G+30
529, # U+0x0000, G+31
486, # U+0x0000, G+32
744, # U+0x0000, G+33
646, # U+0x0000, G+34
604, # U+0x0000, G+35
617, # U+0x0000, G+36
681, # U+0x0000, G+37
567, # U+0x0000, G+38
537, # U+0x0000, G+39
647, # U+0x0000, G+40
738, # U+0x0000, G+41
320, # U+0x0000, G+42
433, # U+0x0000, G+43
637, # U+0x0000, G+44
566, # U+0x0000, G+45
904, # U+0x0000, G+46
710, # U+0x0000, G+47
716, # U+0x0000, G+48
605, # U+0x0000, G+49
716, # U+0x0000, G+50
623, # U+0x0000, G+51
517, # U+0x0000, G+52
601, # U+0x0000, G+53
690, # U+0x0000, G+54
668, # U+0x0000, G+55
990, # U+0x0000, G+56
681, # U+0x0000, G+57
634, # U+0x0000, G+58
578, # U+0x0000, G+59
316, # U+0x0000, G+60
614, # U+0x0000, G+61
316, # U+0x0000, G+62
529, # U+0x0000, G+63
500, # U+0x0000, G+64
387, # U+0x0000, G+65
509, # U+0x0000, G+66
566, # U+0x0000, G+67
478, # U+0x0000, G+68
565, # U+0x0000, G+69
503, # U+0x0000, G+70
337, # U+0x0000, G+71
549, # U+0x0000, G+72
580, # U+0x0000, G+73
275, # U+0x0000, G+74
266, # U+0x0000, G+75
544, # U+0x0000, G+76
276, # U+0x0000, G+77
854, # U+0x0000, G+78
579, # U+0x0000, G+79
550, # U+0x0000, G+80
578, # U+0x0000, G+81
566, # U+0x0000, G+82
410, # U+0x0000, G+83
444, # U+0x0000, G+84
340, # U+0x0000, G+85
575, # U+0x0000, G+86
512, # U+0x0000, G+87
760, # U+0x0000, G+88
503, # U+0x0000, G+89
529, # U+0x0000, G+90
453, # U+0x0000, G+91
326, # U+0x0000, G+92
380, # U+0x0000, G+93
326, # U+0x0000, G+94
387, # U+0x0000, G+95
216, # U+0x0000, G+96
453, # U+0x0000, G+97
216, # U+0x0000, G+98
380, # U+0x0000, G+99
529, # U+0x0000, G+100
299, # U+0x0000, G+101
614, # U+0x0000, G+102
614, # U+0x0000, G+103
265, # U+0x0000, G+104
614, # U+0x0000, G+105
475, # U+0x0000, G+106
614, # U+0x0000, G+107
353, # U+0x0000, G+108
451, # U+0x0000, G+109
291, # U+0x0000, G+110
291, # U+0x0000, G+111
588, # U+0x0000, G+112
589, # U+0x0000, G+113
500, # U+0x0000, G+114
476, # U+0x0000, G+115
476, # U+0x0000, G+116
219, # U+0x0000, G+117
494, # U+0x0000, G+118
452, # U+0x0000, G+119
216, # U+0x0000, G+120
353, # U+0x0000, G+121
353, # U+0x0000, G+122
451, # U+0x0000, G+123
1000, # U+0x0000, G+124
1075, # U+0x0000, G+125
486, # U+0x0000, G+126
387, # U+0x0000, G+127
387, # U+0x0000, G+128
387, # U+0x0000, G+129
387, # U+0x0000, G+130
387, # U+0x0000, G+131
387, # U+0x0000, G+132
387, # U+0x0000, G+133
387, # U+0x0000, G+134
387, # U+0x0000, G+135
387, # U+0x0000, G+136
387, # U+0x0000, G+137
1000, # U+0x0000, G+138
880, # U+0x0000, G+139
448, # U+0x0000, G+140
566, # U+0x0000, G+141
716, # U+0x0000, G+142
903, # U+0x0000, G+143
460, # U+0x0000, G+144
805, # U+0x0000, G+145
275, # U+0x0000, G+146
276, # U+0x0000, G+147
550, # U+0x0000, G+148
886, # U+0x0000, G+149
582, # U+0x0000, G+150
529, # U+0x0000, G+151
738, # U+0x0000, G+152
529, # U+0x0000, G+153
738, # U+0x0000, G+154
357, # U+0x0000, G+155
529, # U+0x0000, G+156
406, # U+0x0000, G+157
406, # U+0x0000, G+158
575, # U+0x0000, G+159
406, # U+0x0000, G+160
934, # U+0x0000, G+161
934, # U+0x0000, G+162
934, # U+0x0000, G+163
646, # U+0x0000, G+164
646, # U+0x0000, G+165
646, # U+0x0000, G+166
646, # U+0x0000, G+167
646, # U+0x0000, G+168
646, # U+0x0000, G+169
617, # U+0x0000, G+170
567, # U+0x0000, G+171
567, # U+0x0000, G+172
567, # U+0x0000, G+173
567, # U+0x0000, G+174
320, # U+0x0000, G+175
320, # U+0x0000, G+176
320, # U+0x0000, G+177
320, # U+0x0000, G+178
681, # U+0x0000, G+179
710, # U+0x0000, G+180
716, # U+0x0000, G+181
716, # U+0x0000, G+182
716, # U+0x0000, G+183
716, # U+0x0000, G+184
716, # U+0x0000, G+185
529, # U+0x0000, G+186
690, # U+0x0000, G+187
690, # U+0x0000, G+188
690, # U+0x0000, G+189
690, # U+0x0000, G+190
634, # U+0x0000, G+191
605, # U+0x0000, G+192
509, # U+0x0000, G+193
509, # U+0x0000, G+194
509, # U+0x0000, G+195
509, # U+0x0000, G+196
509, # U+0x0000, G+197
509, # U+0x0000, G+198
478, # U+0x0000, G+199
503, # U+0x0000, G+200
503, # U+0x0000, G+201
503, # U+0x0000, G+202
503, # U+0x0000, G+203
275, # U+0x0000, G+204
275, # U+0x0000, G+205
275, # U+0x0000, G+206
275, # U+0x0000, G+207
550, # U+0x0000, G+208
579, # U+0x0000, G+209
550, # U+0x0000, G+210
550, # U+0x0000, G+211
550, # U+0x0000, G+212
550, # U+0x0000, G+213
550, # U+0x0000, G+214
529, # U+0x0000, G+215
575, # U+0x0000, G+216
575, # U+0x0000, G+217
575, # U+0x0000, G+218
575, # U+0x0000, G+219
529, # U+0x0000, G+220
578, # U+0x0000, G+221
529, # U+0x0000, G+222
517, # U+0x0000, G+223
634, # U+0x0000, G+224
578, # U+0x0000, G+225
445, # U+0x0000, G+226
444, # U+0x0000, G+227
842, # U+0x0000, G+228
453, # U+0x0000, G+229
614, # U+0x0000, G+230
500, # U+0x0000, G+231
500, # U+0x0000, G+232
500, # U+0x0000, G+233
500, # U+0x0000, G+234
500, # U+0x0000, G+235
500, # U+0x0000, G+236
500, # U+0x0000, G+237
500, # U+0x0000, G+238
500, # U+0x0000, G+239
500, # U+0x0000, G+240
500, # U+0x0000, G+241
500, # U+0x0000, G+242
500, # U+0x0000, G+243
500, # U+0x0000, G+244
500, # U+0x0000, G+245
500, # U+0x0000, G+246
500, # U+0x0000, G+247
500, # U+0x0000, G+248
500, # U+0x0000, G+249
500, # U+0x0000, G+250
500, # U+0x0000, G+251
500, # U+0x0000, G+252
500, # U+0x0000, G+253
500, # U+0x0000, G+254
500, # U+0x0000, G+255
500, # U+0x0000, G+256
500, # U+0x0000, G+257
500, # U+0x0000, G+258
500, # U+0x0000, G+259
500, # U+0x0000, G+260
500, # U+0x0000, G+261
500, # U+0x0000, G+262
500, # U+0x0000, G+263
500, # U+0x0000, G+264
500, # U+0x0000, G+265
500, # U+0x0000, G+266
500, # U+0x0000, G+267
500, # U+0x0000, G+268
500, # U+0x0000, G+269
500, # U+0x0000, G+270
500, # U+0x0000, G+271
500, # U+0x0000, G+272
500, # U+0x0000, G+273
500, # U+0x0000, G+274
500, # U+0x0000, G+275
500, # U+0x0000, G+276
500, # U+0x0000, G+277
500, # U+0x0000, G+278
500, # U+0x0000, G+279
500, # U+0x0000, G+280
500, # U+0x0000, G+281
500, # U+0x0000, G+282
500, # U+0x0000, G+283
500, # U+0x0000, G+284
500, # U+0x0000, G+285
500, # U+0x0000, G+286
500, # U+0x0000, G+287
500, # U+0x0000, G+288
500, # U+0x0000, G+289
500, # U+0x0000, G+290
500, # U+0x0000, G+291
500, # U+0x0000, G+292
500, # U+0x0000, G+293
500, # U+0x0000, G+294
500, # U+0x0000, G+295
500, # U+0x0000, G+296
500, # U+0x0000, G+297
500, # U+0x0000, G+298
500, # U+0x0000, G+299
500, # U+0x0000, G+300
500, # U+0x0000, G+301
500, # U+0x0000, G+302
500, # U+0x0000, G+303
500, # U+0x0000, G+304
500, # U+0x0000, G+305
500, # U+0x0000, G+306
500, # U+0x0000, G+307
500, # U+0x0000, G+308
500, # U+0x0000, G+309
500, # U+0x0000, G+310
500, # U+0x0000, G+311
500, # U+0x0000, G+312
500, # U+0x0000, G+313
500, # U+0x0000, G+314
500, # U+0x0000, G+315
500, # U+0x0000, G+316
500, # U+0x0000, G+317
500, # U+0x0000, G+318
500, # U+0x0000, G+319
500, # U+0x0000, G+320
500, # U+0x0000, G+321
500, # U+0x0000, G+322
500, # U+0x0000, G+323
500, # U+0x0000, G+324
500, # U+0x0000, G+325
500, # U+0x0000, G+326
500, # U+0x0000, G+327
500, # U+0x0000, G+328
500, # U+0x0000, G+329
500, # U+0x0000, G+330
500, # U+0x0000, G+331
500, # U+0x0000, G+332
500, # U+0x0000, G+333
500, # U+0x0000, G+334
500, # U+0x0000, G+335
500, # U+0x0000, G+336
500, # U+0x0000, G+337
500, # U+0x0000, G+338
500, # U+0x0000, G+339
500, # U+0x0000, G+340
500, # U+0x0000, G+341
500, # U+0x0000, G+342
500, # U+0x0000, G+343
500, # U+0x0000, G+344
500, # U+0x0000, G+345
500, # U+0x0000, G+346
500, # U+0x0000, G+347
500, # U+0x0000, G+348
500, # U+0x0000, G+349
500, # U+0x0000, G+350
500, # U+0x0000, G+351
500, # U+0x0000, G+352
500, # U+0x0000, G+353
500, # U+0x0000, G+354
500, # U+0x0000, G+355
500, # U+0x0000, G+356
500, # U+0x0000, G+357
500, # U+0x0000, G+358
500, # U+0x0000, G+359
500, # U+0x0000, G+360
500, # U+0x0000, G+361
500, # U+0x0000, G+362
500, # U+0x0000, G+363
500, # U+0x0000, G+364
500, # U+0x0000, G+365
500, # U+0x0000, G+366
500, # U+0x0000, G+367
500, # U+0x0000, G+368
500, # U+0x0000, G+369
500, # U+0x0000, G+370
500, # U+0x0000, G+371
500, # U+0x0000, G+372
500, # U+0x0000, G+373
500, # U+0x0000, G+374
500, # U+0x0000, G+375
500, # U+0x0000, G+376
500, # U+0x0000, G+377
500, # U+0x0000, G+378
500, # U+0x0000, G+379
500, # U+0x0000, G+380
500, # U+0x0000, G+381
500, # U+0x0000, G+382
500, # U+0x0000, G+383
500, # U+0x0000, G+384
500, # U+0x0000, G+385
500, # U+0x0000, G+386
500, # U+0x0000, G+387
500, # U+0x0000, G+388
500, # U+0x0000, G+389
500, # U+0x0000, G+390
500, # U+0x0000, G+391
500, # U+0x0000, G+392
500, # U+0x0000, G+393
500, # U+0x0000, G+394
500, # U+0x0000, G+395
500, # U+0x0000, G+396
500, # U+0x0000, G+397
500, # U+0x0000, G+398
500, # U+0x0000, G+399
500, # U+0x0000, G+400
500, # U+0x0000, G+401
500, # U+0x0000, G+402
500, # U+0x0000, G+403
500, # U+0x0000, G+404
500, # U+0x0000, G+405
500, # U+0x0000, G+406
500, # U+0x0000, G+407
500, # U+0x0000, G+408
500, # U+0x0000, G+409
500, # U+0x0000, G+410
500, # U+0x0000, G+411
500, # U+0x0000, G+412
500, # U+0x0000, G+413
500, # U+0x0000, G+414
500, # U+0x0000, G+415
500, # U+0x0000, G+416
500, # U+0x0000, G+417
500, # U+0x0000, G+418
500, # U+0x0000, G+419
500, # U+0x0000, G+420
500, # U+0x0000, G+421
500, # U+0x0000, G+422
500, # U+0x0000, G+423
500, # U+0x0000, G+424
500, # U+0x0000, G+425
500, # U+0x0000, G+426
500, # U+0x0000, G+427
500, # U+0x0000, G+428
500, # U+0x0000, G+429
500, # U+0x0000, G+430
500, # U+0x0000, G+431
500, # U+0x0000, G+432
500, # U+0x0000, G+433
500, # U+0x0000, G+434
500, # U+0x0000, G+435
500, # U+0x0000, G+436
500, # U+0x0000, G+437
500, # U+0x0000, G+438
500, # U+0x0000, G+439
500, # U+0x0000, G+440
500, # U+0x0000, G+441
500, # U+0x0000, G+442
500, # U+0x0000, G+443
500, # U+0x0000, G+444
500, # U+0x0000, G+445
500, # U+0x0000, G+446
500, # U+0x0000, G+447
500, # U+0x0000, G+448
500, # U+0x0000, G+449
500, # U+0x0000, G+450
500, # U+0x0000, G+451
500, # U+0x0000, G+452
500, # U+0x0000, G+453
500, # U+0x0000, G+454
500, # U+0x0000, G+455
500, # U+0x0000, G+456
500, # U+0x0000, G+457
500, # U+0x0000, G+458
500, # U+0x0000, G+459
500, # U+0x0000, G+460
500, # U+0x0000, G+461
500, # U+0x0000, G+462
500, # U+0x0000, G+463
500, # U+0x0000, G+464
500, # U+0x0000, G+465
500, # U+0x0000, G+466
500, # U+0x0000, G+467
500, # U+0x0000, G+468
500, # U+0x0000, G+469
500, # U+0x0000, G+470
500, # U+0x0000, G+471
500, # U+0x0000, G+472
500, # U+0x0000, G+473
500, # U+0x0000, G+474
500, # U+0x0000, G+475
500, # U+0x0000, G+476
500, # U+0x0000, G+477
500, # U+0x0000, G+478
500, # U+0x0000, G+479
500, # U+0x0000, G+480
500, # U+0x0000, G+481
500, # U+0x0000, G+482
500, # U+0x0000, G+483
500, # U+0x0000, G+484
500, # U+0x0000, G+485
500, # U+0x0000, G+486
500, # U+0x0000, G+487
500, # U+0x0000, G+488
500, # U+0x0000, G+489
500, # U+0x0000, G+490
500, # U+0x0000, G+491
500, # U+0x0000, G+492
500, # U+0x0000, G+493
500, # U+0x0000, G+494
500, # U+0x0000, G+495
500, # U+0x0000, G+496
500, # U+0x0000, G+497
500, # U+0x0000, G+498
500, # U+0x0000, G+499
500, # U+0x0000, G+500
500, # U+0x0000, G+501
500, # U+0x0000, G+502
500, # U+0x0000, G+503
500, # U+0x0000, G+504
500, # U+0x0000, G+505
500, # U+0x0000, G+506
500, # U+0x0000, G+507
500, # U+0x0000, G+508
500, # U+0x0000, G+509
500, # U+0x0000, G+510
500, # U+0x0000, G+511
500, # U+0x0000, G+512
500, # U+0x0000, G+513
500, # U+0x0000, G+514
500, # U+0x0000, G+515
500, # U+0x0000, G+516
500, # U+0x0000, G+517
500, # U+0x0000, G+518
500, # U+0x0000, G+519
500, # U+0x0000, G+520
500, # U+0x0000, G+521
500, # U+0x0000, G+522
500, # U+0x0000, G+523
500, # U+0x0000, G+524
500, # U+0x0000, G+525
500, # U+0x0000, G+526
500, # U+0x0000, G+527
500, # U+0x0000, G+528
500, # U+0x0000, G+529
500, # U+0x0000, G+530
500, # U+0x0000, G+531
500, # U+0x0000, G+532
500, # U+0x0000, G+533
500, # U+0x0000, G+534
500, # U+0x0000, G+535
500, # U+0x0000, G+536
500, # U+0x0000, G+537
500, # U+0x0000, G+538
500, # U+0x0000, G+539
500, # U+0x0000, G+540
500, # U+0x0000, G+541
500, # U+0x0000, G+542
500, # U+0x0000, G+543
500, # U+0x0000, G+544
500, # U+0x0000, G+545
500, # U+0x0000, G+546
500, # U+0x0000, G+547
500, # U+0x0000, G+548
500, # U+0x0000, G+549
500, # U+0x0000, G+550
500, # U+0x0000, G+551
500, # U+0x0000, G+552
500, # U+0x0000, G+553
500, # U+0x0000, G+554
500, # U+0x0000, G+555
500, # U+0x0000, G+556
500, # U+0x0000, G+557
500, # U+0x0000, G+558
500, # U+0x0000, G+559
500, # U+0x0000, G+560
500, # U+0x0000, G+561
500, # U+0x0000, G+562
500, # U+0x0000, G+563
500, # U+0x0000, G+564
500, # U+0x0000, G+565
500, # U+0x0000, G+566
500, # U+0x0000, G+567
500, # U+0x0000, G+568
500, # U+0x0000, G+569
500, # U+0x0000, G+570
500, # U+0x0000, G+571
500, # U+0x0000, G+572
500, # U+0x0000, G+573
500, # U+0x0000, G+574
500, # U+0x0000, G+575
500, # U+0x0000, G+576
500, # U+0x0000, G+577
500, # U+0x0000, G+578
500, # U+0x0000, G+579
500, # U+0x0000, G+580
500, # U+0x0000, G+581
500, # U+0x0000, G+582
500, # U+0x0000, G+583
500, # U+0x0000, G+584
500, # U+0x0000, G+585
500, # U+0x0000, G+586
500, # U+0x0000, G+587
500, # U+0x0000, G+588
500, # U+0x0000, G+589
500, # U+0x0000, G+590
500, # U+0x0000, G+591
500, # U+0x0000, G+592
500, # U+0x0000, G+593
500, # U+0x0000, G+594
500, # U+0x0000, G+595
500, # U+0x0000, G+596
500, # U+0x0000, G+597
500, # U+0x0000, G+598
500, # U+0x0000, G+599
500, # U+0x0000, G+600
500, # U+0x0000, G+601
500, # U+0x0000, G+602
500, # U+0x0000, G+603
500, # U+0x0000, G+604
500, # U+0x0000, G+605
500, # U+0x0000, G+606
500, # U+0x0000, G+607
500, # U+0x0000, G+608
500, # U+0x0000, G+609
500, # U+0x0000, G+610
500, # U+0x0000, G+611
500, # U+0x0000, G+612
500, # U+0x0000, G+613
500, # U+0x0000, G+614
500, # U+0x0000, G+615
500, # U+0x0000, G+616
500, # U+0x0000, G+617
500, # U+0x0000, G+618
500, # U+0x0000, G+619
500, # U+0x0000, G+620
500, # U+0x0000, G+621
500, # U+0x0000, G+622
500, # U+0x0000, G+623
500, # U+0x0000, G+624
500, # U+0x0000, G+625
500, # U+0x0000, G+626
500, # U+0x0000, G+627
500, # U+0x0000, G+628
500, # U+0x0000, G+629
500, # U+0x0000, G+630
500, # U+0x0000, G+631
500, # U+0x0000, G+632
],
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,184 @@
package PDF::API2::Resource::CIDFont::TrueType;
use base 'PDF::API2::Resource::CIDFont';
use strict;
no warnings qw[ deprecated recursion uninitialized ];
our $VERSION = '2.033'; # VERSION
use PDF::API2::Basic::PDF::Utils;
use PDF::API2::Resource::CIDFont::TrueType::FontFile;
use PDF::API2::Util;
=head1 NAME
PDF::API2::Resource::CIDFont::TrueType - TrueType font support
=head1 METHODS
=over
=item $font = PDF::API2::Resource::CIDFont::TrueType->new $pdf, $file, %options
Returns a font object.
Defined Options:
-encode ... specify fonts encoding for non-utf8 text.
-nosubset ... disables subsetting.
=cut
sub new {
my ($class,$pdf,$file,@opts) = @_;
my %opts=();
%opts=@opts if((scalar @opts)%2 == 0);
$opts{-encode}||='latin1';
my ($ff,$data)=PDF::API2::Resource::CIDFont::TrueType::FontFile->new($pdf,$file,@opts);
$class = ref $class if ref $class;
my $self=$class->SUPER::new($pdf,$data->{apiname}.pdfkey().'~'.time());
$pdf->new_obj($self) if(defined($pdf) && !$self->is_obj($pdf));
$self->{' data'}=$data;
my $des=$self->descrByData;
$self->{'BaseFont'} = PDFName($self->fontname);
my $de=$self->{' de'};
$de->{'FontDescriptor'} = $des;
$de->{'Subtype'} = PDFName($self->iscff ? 'CIDFontType0' : 'CIDFontType2');
## $de->{'BaseFont'} = PDFName(pdfkey().'+'.($self->fontname).'~'.time());
$de->{'BaseFont'} = PDFName($self->fontname);
$de->{'DW'} = PDFNum($self->missingwidth);
if($opts{-noembed} != 1)
{
$des->{$self->data->{iscff} ? 'FontFile3' : 'FontFile2'}=$ff;
}
unless($self->issymbol) {
$self->encodeByName($opts{-encode});
$self->data->{encode}=$opts{-encode};
$self->data->{decode}='ident';
}
if($opts{-nosubset}) {
$self->data->{nosubset}=1;
}
$self->{' ff'} = $ff;
$pdf->new_obj($ff);
$self->{-dokern}=1 if($opts{-dokern});
return($self);
}
sub fontfile { return( $_[0]->{' ff'} ); }
sub fontobj { return( $_[0]->data->{obj} ); }
sub wxByCId
{
my $self=shift @_;
my $g=shift @_;
my $t = $self->fontobj->{'hmtx'}->read->{'advance'}[$g];
my $w;
if(defined $t)
{
$w = int($t*1000/$self->data->{upem});
}
else
{
$w = $self->missingwidth;
}
return($w);
}
sub haveKernPairs
{
my $self = shift @_;
return($self->fontfile->haveKernPairs(@_));
}
sub kernPairCid
{
my $self = shift @_;
return($self->fontfile->kernPairCid(@_));
}
sub subsetByCId
{
my $self = shift @_;
return if($self->iscff);
my $g = shift @_;
$self->fontfile->subsetByCId($g);
}
sub subvec
{
my $self = shift @_;
return(1) if($self->iscff);
my $g = shift @_;
$self->fontfile->subvec($g);
}
sub glyphNum { return ( $_[0]->fontfile->glyphNum ); }
sub outobjdeep
{
my ($self, $fh, $pdf, %opts) = @_;
my $notdefbefore=1;
my $wx=PDFArray();
$self->{' de'}->{'W'} = $wx;
my $ml;
foreach my $w (0..(scalar @{$self->data->{g2u}} - 1 ))
{
if($self->subvec($w) && $notdefbefore==1)
{
$notdefbefore=0;
$ml=PDFArray();
$wx->add_elements(PDFNum($w),$ml);
# $ml->add_elements(PDFNum($self->data->{wx}->[$w]));
$ml->add_elements(PDFNum($self->wxByCId($w)));
}
elsif($self->subvec($w) && $notdefbefore==0)
{
$notdefbefore=0;
# $ml->add_elements(PDFNum($self->data->{wx}->[$w]));
$ml->add_elements(PDFNum($self->wxByCId($w)));
}
else
{
$notdefbefore=1;
}
# optimization for cjk
#if($self->subvec($w) && $notdefbefore==1 && $self->data->{wx}->[$w]!=$self->missingwidth) {
# $notdefbefore=0;
# $ml=PDFArray();
# $wx->add_elements(PDFNum($w),$ml);
# $ml->add_elements(PDFNum($self->data->{wx}->[$w]));
#} elsif($self->subvec($w) && $notdefbefore==0 && $self->data->{wx}->[$w]!=$self->missingwidth) {
# $notdefbefore=0;
# $ml->add_elements(PDFNum($self->data->{wx}->[$w]));
#} else {
# $notdefbefore=1;
#}
}
$self->SUPER::outobjdeep($fh, $pdf, %opts);
}
=back
=cut
1;

View File

@@ -0,0 +1,680 @@
package PDF::API2::Resource::CIDFont::TrueType::FontFile;
use base 'PDF::API2::Basic::PDF::Dict';
use strict;
no warnings qw[ recursion uninitialized ];
our $VERSION = '2.033'; # VERSION
use Encode qw(:all);
use Font::TTF::Font;
use POSIX qw(ceil floor);
use PDF::API2::Util;
use PDF::API2::Basic::PDF::Utils;
our $cmap = {};
sub _look_for_cmap {
my $fname=lc(shift);
$fname=~s/[^a-z0-9]+//gi;
return({%{$cmap->{$fname}}}) if(defined $cmap->{$fname});
eval "require 'PDF/API2/Resource/CIDFont/CMap/$fname.cmap'";
unless($@){
return({%{$cmap->{$fname}}});
} else {
die "requested cmap '$fname' not installed ";
}
}
sub readcffindex
{
my ($fh,$off,$buf)=@_;
my @idx=();
my $index=[];
seek($fh,$off,0);
read($fh,$buf,3);
my ($count,$offsize)=unpack('nC',$buf);
foreach (0..$count)
{
read($fh,$buf,$offsize);
$buf=substr("\x00\x00\x00$buf",-4,4);
my $id=unpack('N',$buf);
push @idx,$id;
}
my $dataoff=tell($fh)-1;
foreach my $i (0..$count-1)
{
push @{$index},{ 'OFF' => $dataoff+$idx[$i], 'LEN' => $idx[$i+1]-$idx[$i] };
}
return($index);
}
sub readcffdict
{
my ($fh,$off,$len,$foff,$buf)=@_;
my @idx=();
my $dict={};
seek($fh,$off,0);
my @st=();
while(tell($fh)<($off+$len))
{
read($fh,$buf,1);
my $b0=unpack('C',$buf);
my $v='';
if($b0==12) # two byte commands
{
read($fh,$buf,1);
my $b1=unpack('C',$buf);
if($b1==0)
{
$dict->{Copyright}={ 'SID' => splice(@st,-1) };
}
elsif($b1==1)
{
$dict->{isFixedPitch}=splice(@st,-1);
}
elsif($b1==2)
{
$dict->{ItalicAngle}=splice(@st,-1);
}
elsif($b1==3)
{
$dict->{UnderlinePosition}=splice(@st,-1);
}
elsif($b1==4)
{
$dict->{UnderlineThickness}=splice(@st,-1);
}
elsif($b1==5)
{
$dict->{PaintType}=splice(@st,-1);
}
elsif($b1==6)
{
$dict->{CharstringType}=splice(@st,-1);
}
elsif($b1==7)
{
$dict->{FontMatrix}=[ splice(@st,-4) ];
}
elsif($b1==8)
{
$dict->{StrokeWidth}=splice(@st,-1);
}
elsif($b1==20)
{
$dict->{SyntheticBase}=splice(@st,-1);
}
elsif($b1==21)
{
$dict->{PostScript}={ 'SID' => splice(@st,-1) };
}
elsif($b1==22)
{
$dict->{BaseFontName}={ 'SID' => splice(@st,-1) };
}
elsif($b1==23)
{
$dict->{BaseFontBlend}=[ splice(@st,0) ];
}
elsif($b1==24)
{
$dict->{MultipleMaster}=[ splice(@st,0) ];
}
elsif($b1==25)
{
$dict->{BlendAxisTypes}=[ splice(@st,0) ];
}
elsif($b1==30)
{
$dict->{ROS}=[ splice(@st,-3) ];
}
elsif($b1==31)
{
$dict->{CIDFontVersion}=splice(@st,-1);
}
elsif($b1==32)
{
$dict->{CIDFontRevision}=splice(@st,-1);
}
elsif($b1==33)
{
$dict->{CIDFontType}=splice(@st,-1);
}
elsif($b1==34)
{
$dict->{CIDCount}=splice(@st,-1);
}
elsif($b1==35)
{
$dict->{UIDBase}=splice(@st,-1);
}
elsif($b1==36)
{
$dict->{FDArray}={ 'OFF' => $foff+splice(@st,-1) };
}
elsif($b1==37)
{
$dict->{FDSelect}={ 'OFF' => $foff+splice(@st,-1) };
}
elsif($b1==38)
{
$dict->{FontName}={ 'SID' => splice(@st,-1) };
}
elsif($b1==39)
{
$dict->{Chameleon}=splice(@st,-1);
}
next;
}
elsif($b0<28) # commands
{
if($b0==0)
{
$dict->{Version}={ 'SID' => splice(@st,-1) };
}
elsif($b0==1)
{
$dict->{Notice}={ 'SID' => splice(@st,-1) };
}
elsif($b0==2)
{
$dict->{FullName}={ 'SID' => splice(@st,-1) };
}
elsif($b0==3)
{
$dict->{FamilyName}={ 'SID' => splice(@st,-1) };
}
elsif($b0==4)
{
$dict->{Weight}={ 'SID' => splice(@st,-1) };
}
elsif($b0==5)
{
$dict->{FontBBX}=[ splice(@st,-4) ];
}
elsif($b0==13)
{
$dict->{UniqueID}=splice(@st,-1);
}
elsif($b0==14)
{
$dict->{XUID}=[splice(@st,0)];
}
elsif($b0==15)
{
$dict->{CharSet}={ 'OFF' => $foff+splice(@st,-1) };
}
elsif($b0==16)
{
$dict->{Encoding}={ 'OFF' => $foff+splice(@st,-1) };
}
elsif($b0==17)
{
$dict->{CharStrings}={ 'OFF' => $foff+splice(@st,-1) };
}
elsif($b0==18)
{
$dict->{Private}={ 'LEN' => splice(@st,-1), 'OFF' => $foff+splice(@st,-1) };
}
next;
}
elsif($b0==28) # int16
{
read($fh,$buf,2);
$v=unpack('n',$buf);
$v=-(0x10000-$v) if($v>0x7fff);
}
elsif($b0==29) # int32
{
read($fh,$buf,4);
$v=unpack('N',$buf);
$v=-$v+0xffffffff+1 if($v>0x7fffffff);
}
elsif($b0==30) # float
{
my $e=1;
while($e)
{
read($fh,$buf,1);
my $v0=unpack('C',$buf);
foreach my $m ($v0>>8,$v0&0xf)
{
if($m<10)
{
$v.=$m;
}
elsif($m==10)
{
$v.='.';
}
elsif($m==11)
{
$v.='E+';
}
elsif($m==12)
{
$v.='E-';
}
elsif($m==14)
{
$v.='-';
}
elsif($m==15)
{
$e=0;
last;
}
}
}
}
elsif($b0==31) # command
{
$v="c=$b0";
next;
}
elsif($b0<247) # 1 byte signed
{
$v=$b0-139;
}
elsif($b0<251) # 2 byte plus
{
read($fh,$buf,1);
$v=unpack('C',$buf);
$v=($b0-247)*256+($v+108);
}
elsif($b0<255) # 2 byte minus
{
read($fh,$buf,1);
$v=unpack('C',$buf);
$v=-($b0-251)*256-$v-108;
}
push @st,$v;
}
return($dict);
}
sub read_kern_table
{
my $font=shift @_;
my $upem=shift @_;
my $self=shift @_;
my $fh=$font->{' INFILE'};
my $data=undef;
return(undef) unless($font->{kern});
my $buf = undef;
seek($fh,$font->{kern}->{' OFFSET'}+2,0);
read($fh,$buf, 2);
my $num=unpack('n',$buf);
foreach my $n (1..$num)
{
read($fh, $buf, 6);
my ($ver, $len, $cov) = unpack('n3', $buf);
$len-=6;
my $fmt=$cov>>8;
if($fmt==0)
{
$data||={};
read($fh, $buf, 8);
my $nc = unpack('n', $buf);
foreach (1..$nc)
{
read($fh, $buf, 6);
my ($idx1,$idx2,$val)=unpack('nnn',$buf);
$val-=65536 if($val>32767);
$val= $val < 0 ? -floor($val*1000/$upem) : -ceil($val*1000/$upem);
if($val != 0)
{
$data->{"$idx1:$idx2"}=$val;
$data->{$self->data->{g2n}->[$idx1].':'.$self->data->{g2n}->[$idx2]}=$val;
}
}
}
elsif($fmt==2)
{
read($fh, $buf, $len);
}
else
{
read($fh, $buf, $len);
}
}
return($data);
}
sub readcffstructs
{
my $font=shift @_;
my $fh=$font->{' INFILE'};
my $data={};
# read CFF table
seek($fh,$font->{'CFF '}->{' OFFSET'},0);
my $buf;
read($fh,$buf, 4);
my ($cffmajor,$cffminor,$cffheadsize,$cffglobaloffsize)=unpack('C4',$buf);
$data->{name}=readcffindex($fh,$font->{'CFF '}->{' OFFSET'}+$cffheadsize);
foreach my $dict (@{$data->{name}})
{
seek($fh,$dict->{OFF},0);
read($fh,$dict->{VAL},$dict->{LEN});
}
$data->{topdict}=readcffindex($fh,$data->{name}->[-1]->{OFF}+$data->{name}->[-1]->{LEN});
foreach my $dict (@{$data->{topdict}})
{
$dict->{VAL}=readcffdict($fh,$dict->{OFF},$dict->{LEN},$font->{'CFF '}->{' OFFSET'});
}
$data->{string}=readcffindex($fh,$data->{topdict}->[-1]->{OFF}+$data->{topdict}->[-1]->{LEN});
foreach my $dict (@{$data->{string}})
{
seek($fh,$dict->{OFF},0);
read($fh,$dict->{VAL},$dict->{LEN});
}
push @{$data->{string}},{ 'VAL' => '001.000' };
push @{$data->{string}},{ 'VAL' => '001.001' };
push @{$data->{string}},{ 'VAL' => '001.002' };
push @{$data->{string}},{ 'VAL' => '001.003' };
push @{$data->{string}},{ 'VAL' => 'Black' };
push @{$data->{string}},{ 'VAL' => 'Bold' };
push @{$data->{string}},{ 'VAL' => 'Book' };
push @{$data->{string}},{ 'VAL' => 'Light' };
push @{$data->{string}},{ 'VAL' => 'Medium' };
push @{$data->{string}},{ 'VAL' => 'Regular' };
push @{$data->{string}},{ 'VAL' => 'Roman' };
push @{$data->{string}},{ 'VAL' => 'Semibold' };
foreach my $dict (@{$data->{topdict}})
{
foreach my $k (keys %{$dict->{VAL}})
{
my $dt=$dict->{VAL}->{$k};
if($k eq 'ROS')
{
$dict->{VAL}->{$k}->[0]=$data->{string}->[$dict->{VAL}->{$k}->[0]-391]->{VAL};
$dict->{VAL}->{$k}->[1]=$data->{string}->[$dict->{VAL}->{$k}->[1]-391]->{VAL};
next;
}
next unless(ref($dt) eq 'HASH' && defined $dt->{SID});
if($dt->{SID}>=379)
{
$dict->{VAL}->{$k}=$data->{string}->[$dt->{SID}-391]->{VAL};
}
}
}
my $dict={};
foreach my $k (qw[ CIDCount CIDFontVersion FamilyName FontBBX FullName ROS Weight XUID ])
{
$dict->{$k}=$data->{topdict}->[0]->{VAL}->{$k} if(defined $data->{topdict}->[0]->{VAL}->{$k});
}
return($dict);
}
sub new {
my ($class,$pdf,$file,%opts)=@_;
my $data={};
die "cannot find font '$file' ..." unless(-f $file);
my $font=Font::TTF::Font->open($file);
$data->{obj}=$font;
$class = ref $class if ref $class;
my $self=$class->SUPER::new();
$self->{Filter}=PDFArray(PDFName('FlateDecode'));
$self->{' font'}=$font;
$self->{' data'}=$data;
$data->{noembed} = $opts{-noembed}==1 ? 1 : 0;
$data->{iscff} = (defined $font->{'CFF '}) ? 1 : 0;
$self->{Subtype}=PDFName('CIDFontType0C') if($data->{iscff});
$data->{fontfamily}=$font->{'name'}->read->find_name(1);
$data->{fontname}=$font->{'name'}->read->find_name(4);
$font->{'OS/2'}->read;
my @stretch=qw[
Normal
UltraCondensed
ExtraCondensed
Condensed
SemiCondensed
Normal
SemiExpanded
Expanded
ExtraExpanded
UltraExpanded
];
$data->{fontstretch}=$stretch[$font->{'OS/2'}->{usWidthClass}] || 'Normal';
$data->{fontweight}=$font->{'OS/2'}->{usWeightClass};
$data->{panose}=pack('n',$font->{'OS/2'}->{sFamilyClass});
foreach my $p (qw[bFamilyType bSerifStyle bWeight bProportion bContrast bStrokeVariation bArmStyle bLetterform bMidline bXheight])
{
$data->{panose}.=pack('C',$font->{'OS/2'}->{$p});
}
$data->{apiname}=join('', map { ucfirst(lc(substr($_, 0, 2))) } split m/[^A-Za-z0-9\s]+/, $data->{fontname});
$data->{fontname}=~s/[\x00-\x1f\s]//og;
$data->{altname}=$font->{'name'}->find_name(1);
$data->{altname}=~s/[\x00-\x1f\s]//og;
$data->{subname}=$font->{'name'}->find_name(2);
$data->{subname}=~s/[\x00-\x1f\s]//og;
$font->{cmap}->read->find_ms($opts{-isocmap}||0);
if(defined $font->{cmap}->find_ms)
{
$data->{issymbol} = ($font->{cmap}->find_ms->{'Platform'} == 3 && $font->{cmap}->read->find_ms->{'Encoding'} == 0) || 0;
}
else
{
$data->{issymbol} = 0;
}
$data->{upem}=$font->{'head'}->read->{'unitsPerEm'};
$data->{fontbbox}=[
int($font->{'head'}->{'xMin'} * 1000 / $data->{upem}),
int($font->{'head'}->{'yMin'} * 1000 / $data->{upem}),
int($font->{'head'}->{'xMax'} * 1000 / $data->{upem}),
int($font->{'head'}->{'yMax'} * 1000 / $data->{upem})
];
$data->{stemv}=0;
$data->{stemh}=0;
$data->{missingwidth}=int($font->{'hhea'}->read->{'advanceWidthMax'} * 1000 / $data->{upem}) || 1000;
$data->{maxwidth}=int($font->{'hhea'}->{'advanceWidthMax'} * 1000 / $data->{upem});
$data->{ascender}=int($font->{'hhea'}->read->{'Ascender'} * 1000 / $data->{upem});
$data->{descender}=int($font->{'hhea'}{'Descender'} * 1000 / $data->{upem});
$data->{flags} = 0;
$data->{flags} |= 1 if ($font->{'OS/2'}->read->{'bProportion'} == 9);
$data->{flags} |= 2 unless ($font->{'OS/2'}{'bSerifStyle'} > 10 && $font->{'OS/2'}{'bSerifStyle'} < 14);
$data->{flags} |= 8 if ($font->{'OS/2'}{'bFamilyType'} == 2);
$data->{flags} |= 32; # if ($font->{'OS/2'}{'bFamilyType'} > 3);
$data->{flags} |= 64 if ($font->{'OS/2'}{'bLetterform'} > 8);;
$data->{capheight}=$font->{'OS/2'}->{CapHeight} || int($data->{fontbbox}->[3]*0.8);
$data->{xheight}=$font->{'OS/2'}->{xHeight} || int($data->{fontbbox}->[3]*0.4);
if($data->{issymbol})
{
$data->{e2u}=[0xf000 .. 0xf0ff];
}
else
{
$data->{e2u}=[ unpack('U*',decode('cp1252', pack('C*',0..255))) ];
}
if(($font->{'post'}->read->{FormatType} == 3) && defined($font->{cmap}->read->find_ms))
{
$data->{g2n} = [];
foreach my $u (sort {$a<=>$b} keys %{$font->{cmap}->read->find_ms->{val}})
{
my $n=nameByUni($u);
$data->{g2n}->[$font->{cmap}->read->find_ms->{val}->{$u}]=$n;
}
}
else
{
$data->{g2n} = [ map { $_ || '.notdef' } @{$font->{'post'}->read->{'VAL'}} ];
}
$data->{italicangle}=$font->{'post'}->{italicAngle};
$data->{isfixedpitch}=$font->{'post'}->{isFixedPitch};
$data->{underlineposition}=$font->{'post'}->{underlinePosition};
$data->{underlinethickness}=$font->{'post'}->{underlineThickness};
if($self->iscff)
{
$data->{cff}=readcffstructs($font);
}
if(defined $data->{cff}->{ROS})
{
my %cffcmap=(
'Adobe:Japan1'=>'japanese',
'Adobe:Korea1'=>'korean',
'Adobe:CNS1'=>'traditional',
'Adobe:GB1'=>'simplified',
);
my $ccmap=_look_for_cmap($cffcmap{"$data->{cff}->{ROS}->[0]:$data->{cff}->{ROS}->[1]"});
$data->{u2g}=$ccmap->{u2g};
$data->{g2u}=$ccmap->{g2u};
}
else
{
$data->{u2g} = {};
my $gmap=$font->{cmap}->read->find_ms->{val};
foreach my $u (sort {$a<=>$b} keys %{$gmap})
{
my $uni=$u||0;
$data->{u2g}->{$uni}=$gmap->{$uni};
}
$data->{g2u}=[ map { $_ || 0 } $font->{'cmap'}->read->reverse ];
}
if($data->{issymbol})
{
map { $data->{u2g}->{$_} ||= $font->{'cmap'}->read->ms_lookup($_) } (0xf000 .. 0xf0ff);
map { $data->{u2g}->{$_ & 0xff} ||= $font->{'cmap'}->read->ms_lookup($_) } (0xf000 .. 0xf0ff);
}
$data->{e2n}=[ map { $data->{g2n}->[$data->{u2g}->{$_} || 0] || '.notdef' } @{$data->{e2u}} ];
$data->{e2g}=[ map { $data->{u2g}->{$_ || 0} || 0 } @{$data->{e2u}} ];
$data->{u2e}={};
foreach my $n (reverse 0..255)
{
$data->{u2e}->{$data->{e2u}->[$n]}=$n unless(defined $data->{u2e}->{$data->{e2u}->[$n]});
}
$data->{u2n}={ map { $data->{g2u}->[$_] => $data->{g2n}->[$_] } (0 .. (scalar @{$data->{g2u}} -1)) };
$data->{wx}=[];
foreach my $w (0..(scalar @{$data->{g2u}}-1))
{
$data->{wx}->[$w]=int($font->{'hmtx'}->read->{'advance'}[$w]*1000/$data->{upem})
|| $data->{missingwidth};
}
$data->{kern}=read_kern_table($font,$data->{upem},$self);
delete $data->{kern} unless(defined $data->{kern});
$data->{fontname}=~s/\s+//og;
$data->{fontfamily}=~s/\s+//og;
$data->{apiname}=~s/\s+//og;
$data->{altname}=~s/\s+//og;
$data->{subname}=~s/\s+//og;
$self->subsetByCId(0);
return($self,$data);
}
sub font { return( $_[0]->{' font'} ); }
sub data { return( $_[0]->{' data'} ); }
sub iscff { return( $_[0]->data->{iscff} ); }
sub haveKernPairs { return( $_[0]->data->{kern} ? 1 : 0 ); }
sub kernPairCid
{
my ($self, $i1, $i2) = @_;
return(0) if($i1==0 || $i2==0);
return($self->data->{kern}->{"$i1:$i2"} || 0);
}
sub subsetByCId
{
my $self = shift @_;
my $g = shift @_;
$self->data->{subset}=1;
vec($self->data->{subvec},$g,1)=1;
return if($self->iscff);
if(defined $self->font->{loca}->read->{glyphs}->[$g]) {
$self->font->{loca}->read->{glyphs}->[$g]->read;
map { vec($self->data->{subvec},$_,1)=1; } $self->font->{loca}->{glyphs}->[$g]->get_refs;
}
}
sub subvec {
my $self = shift @_;
return(1) if($self->iscff);
my $g = shift @_;
return(vec($self->data->{subvec},$g,1));
}
sub glyphNum { return ( $_[0]->font->{'maxp'}->read->{'numGlyphs'} ); }
sub outobjdeep {
my ($self, $fh, $pdf, %opts) = @_;
my $f = $self->font;
if($self->iscff) {
$f->{'CFF '}->read_dat;
$self->{' stream'} = $f->{'CFF '}->{' dat'};
} else {
if ($self->data->{subset} && !$self->data->{nosubset}) {
$f->{'glyf'}->read;
for (my $i = 0; $i < $self->glyphNum; $i++) {
next if($self->subvec($i));
$f->{'loca'}{'glyphs'}->[$i] = undef;
# print STDERR "$i,";
}
}
if($self->data->{noembed} != 1)
{
$self->{' stream'} = "";
my $ffh;
CORE::open($ffh, '+>', \$self->{' stream'});
binmode($ffh,':raw');
$f->out($ffh, 'cmap', 'cvt ', 'fpgm', 'glyf', 'head', 'hhea', 'hmtx', 'loca', 'maxp', 'prep');
$self->{'Length1'}=PDFNum(length($self->{' stream'}));
CORE::close($ffh);
}
}
$self->SUPER::outobjdeep($fh, $pdf, %opts);
}
1;