Skip Menu |

This queue is for tickets about the PDF-API2 CPAN distribution.

Report information
The Basics
Id: 128674
Status: open
Priority: 0/
Queue: PDF-API2

People
Owner: Nobody in particular
Requestors: perlbug [...] jgreely.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: error "requested cmap '' not installed" with many CJK fonts
Date: Thu, 28 Feb 2019 17:32:07 -0800
To: bug-PDF-API2 [...] rt.cpan.org
From: perlbug [...] jgreely.com
PDF::API2 version 2.033 Font::TTF version 1.06 Perl version 5.20.2 Sample code: #!/usr/bin/env perl use PDF::API2; $pdf = PDF::API2->new(); $pdf->page(); $pdf->ttfont("NotoSansJP-Medium.otf"); # downloaded from here: # https://github.com/googlei18n/noto-cjk/blob/master/NotoSansJP-Medium.otf dies with: requested cmap '' not installed at /Users/Shared/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/PDF/API2/Resource/CIDFont/TrueType/FontFile.pm line 27. About a third of the CJK fonts I have don't work with PDF::API2. I used Noto Sans JP in the above example because it's freely available, but it's not the only one, and at least one other PostScript-flavored OTF font that I own does work (DFKyoKaShoStd-W4.otf). Is there a workaround or a fix? -j
Subject: Aw: [rt.cpan.org #128674] error "requested cmap '' not installed" with many CJK fonts
Date: Sun, 3 Mar 2019 14:23:23 +0100
To: bug-PDF-API2 [...] rt.cpan.org
From: "Alfred Reibenschuh" <alfredreibenschuh [...] gmx.net>
replace the section
 
#/lib/PDF/API2/Resource/CIDFont/TrueType/FontFile.pm #in sub new #-------------------------------------------
if(defined $data->{cff}->{ROS}) {     my %cffcmap=(         'Adobe:Japan1'=>'japanese',         'Adobe:Korea1'=>'korean',         'Adobe:CNS1'=>'traditional',         'Adobe:GB1'=>'simplified',         'Adobe:Identity'=>'identity', # NEW CMAP     );     my $ccmap=_look_for_cmap($cffcmap{"$data->{cff}->{ROS}->[0]:$data->{cff}->{ROS}->[1]"});     $data->{u2g}=$ccmap->{u2g};     $data->{g2u}=$ccmap->{g2u}; } else
#-------------------------------------------
 
 
and create a new cmap file:
 
#/lib/PDF/API2/Resource/CIDFont/CMap/identity.cmap #------------------------------------------- $cmap->{identity}={     'ccs' => [         'Adobe',    # registry         'Identity',   # ordering         0,          # supplement     ],     'cmap' => { # perl unicode maps to adobe cmap (TBD)         'ident'         =>  [   'ident',        'Identity'      ],     },     'g2u' => [         0x0000 .. 0xffff     ],     'u2g' => {         map { $_ => $_ } (0x0000 .. 0xffff)     } };
#-------------------------------------------  
 
it could be that the g2u/u2g data does not work and you have to include the raw array and map instead.
 
---
Alfred Reibenschuh
 
 
Gesendet: Freitag, 01. März 2019 um 03:03 Uhr Von: "perlbug@jgreely.com via RT" <bug-PDF-API2@rt.cpan.org> An: undisclosed-recipients:; Betreff: [rt.cpan.org #128674] error "requested cmap '' not installed" with many CJK fonts
Thu Feb 28 21:03:23 2019: Request 128674 was acted upon. Transaction: Ticket created by perlbug@jgreely.com Queue: PDF-API2 Subject: error "requested cmap '' not installed" with many CJK fonts Broken in: (no value) Severity: (no value) Owner: Nobody Requestors: perlbug@jgreely.com Status: new Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128674 > PDF::API2 version 2.033 Font::TTF version 1.06 Perl version 5.20.2 Sample code: #!/usr/bin/env perl use PDF::API2; $pdf = PDF::API2->new(); $pdf->page(); $pdf->ttfont("NotoSansJP-Medium.otf"); # downloaded from here: # https://github.com/googlei18n/noto-cjk/blob/master/NotoSansJP-Medium.otf dies with: requested cmap '' not installed at /Users/Shared/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/PDF/API2/Resource/CIDFont/TrueType/FontFile.pm line 27. About a third of the CJK fonts I have don't work with PDF::API2. I used Noto Sans JP in the above example because it's freely available, but it's not the only one, and at least one other PostScript-flavored OTF font that I own does work (DFKyoKaShoStd-W4.otf). Is there a workaround or a fix? -j  
RT-Send-CC: alfredreibenschuh [...] gmx.net
Hi Alfred, Good to see you're still active in this area! Unless "Identity" is a very different beast than the other CMaps, I suspect that this won't work. For example, u2g[x20] = space = GId[1], and the map is not monotonically increasing. Can someone show that it does work? Per https://github.com/PhilterPaper/Perl-PDF-Builder/issues/98, I have found some CMap sources and tools from Adobe, but they don't seem to have the u2g/g2u information needed for the .cmap files used here. Do you have an idea of how to generate .cmap files? I'm thinking in terms of a tool that would take an Adobe CMap file that someone wants to use and generating a .cmap file from it. In any case, it would probably still be a good idea to add Adobe:Identity to the list. regards, Phil Perry
For PDF::Builder, I have updated FontFile.pm to look in .cmap files (if -usecmf=>1), then in the list of Platform/Encodings given by -cmaps (or its default list), then using find_ms(), and finally back to .cmap files (regardless of -usecmf setting). One of those should hopefully find a workable CMap! There is also a -debug flag to show diagnostic information in the hunt for a CMap. I am leaving the PDF::Builder ticket open for now as a reminder that the four .cmap files are still in need of updating, and I have not yet found a suitable data source (Unicode/glyphID mapping) to generate new .cmap files. Many thanks to Alfred Reibenschuh (original PDF::API2 author) and Bob Hallissy (Font::TTF author) for their assistance.