Skip to content

Commit

Permalink
Add complete support for CMap files
Browse files Browse the repository at this point in the history
Before this change only the special ToUnicode CMap files were supported.

* Implement support for the missing 'usecmap', 'begincodespacerange',
  'begincidchar' and 'begincidrange' operators in the CMap parser.
* Implement the needed methods for dealing with the CIDs in the main
  CMap class.
* Add the predefined CMap files that are used by PDF and add support for
  parsing them by using their name.
  • Loading branch information
gettalong committed Feb 18, 2017
1 parent 38b1010 commit efb51ac
Show file tree
Hide file tree
Showing 72 changed files with 194,037 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Added

* Complete support for CMaps for use with composite fonts; the interface for
[HexaPDF::Font::CMap] changed to accomodate this
* Support for marked-content points and sequences in [HexaPDF::Content::Canvas]
* Support for property lists in a page's resource dictionary

Expand Down
314 changes: 314 additions & 0 deletions data/hexapdf/cmap/83pv-RKSJ-H
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
%!PS-Adobe-3.0 Resource-CMap
%%DocumentNeededResources: ProcSet (CIDInit)
%%IncludeResource: ProcSet (CIDInit)
%%BeginResource: CMap (83pv-RKSJ-H)
%%Title: (83pv-RKSJ-H Adobe Japan1 1)
%%Version: 10.005
%%Copyright: -----------------------------------------------------------
%%Copyright: Copyright 1990-2015 Adobe Systems Incorporated.
%%Copyright: All rights reserved.
%%Copyright:
%%Copyright: Redistribution and use in source and binary forms, with or
%%Copyright: without modification, are permitted provided that the
%%Copyright: following conditions are met:
%%Copyright:
%%Copyright: Redistributions of source code must retain the above
%%Copyright: copyright notice, this list of conditions and the following
%%Copyright: disclaimer.
%%Copyright:
%%Copyright: Redistributions in binary form must reproduce the above
%%Copyright: copyright notice, this list of conditions and the following
%%Copyright: disclaimer in the documentation and/or other materials
%%Copyright: provided with the distribution.
%%Copyright:
%%Copyright: Neither the name of Adobe Systems Incorporated nor the names
%%Copyright: of its contributors may be used to endorse or promote
%%Copyright: products derived from this software without specific prior
%%Copyright: written permission.
%%Copyright:
%%Copyright: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
%%Copyright: CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
%%Copyright: INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
%%Copyright: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
%%Copyright: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
%%Copyright: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
%%Copyright: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
%%Copyright: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
%%Copyright: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
%%Copyright: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
%%Copyright: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
%%Copyright: OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
%%Copyright: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%%Copyright: -----------------------------------------------------------
%%EndComments

/CIDInit /ProcSet findresource begin

12 dict begin

begincmap

/CIDSystemInfo 3 dict dup begin
/Registry (Adobe) def
/Ordering (Japan1) def
/Supplement 1 def
end def

/CMapName /83pv-RKSJ-H def
/CMapVersion 10.005 def
/CMapType 1 def

/UIDOffset 0 def
/XUID [1 10 25324] def

/WMode 0 def

5 begincodespacerange
<00> <80>
<8140> <9FFC>
<A0> <DF>
<E040> <FCFC>
<FD> <FF>
endcodespacerange

1 beginnotdefrange
<00> <1f> 1
endnotdefrange

100 begincidrange
<20> <7e> 1
<80> <80> 97
<8140> <817e> 633
<8180> <81ac> 696
<81b8> <81bf> 741
<81c8> <81ce> 749
<81da> <81e8> 756
<81f0> <81f7> 771
<81fc> <81fc> 779
<824f> <8258> 780
<8260> <8279> 790
<8281> <829a> 816
<829f> <82f1> 842
<8340> <837e> 925
<8380> <8396> 988
<839f> <83b6> 1011
<83bf> <83d6> 1035
<8440> <8460> 1059
<8470> <847e> 1092
<8480> <8491> 1107
<849f> <849f> 7479
<84a0> <84a0> 7481
<84a1> <84a1> 7491
<84a2> <84a2> 7495
<84a3> <84a3> 7503
<84a4> <84a4> 7499
<84a5> <84a5> 7507
<84a6> <84a6> 7523
<84a7> <84a7> 7515
<84a8> <84a8> 7531
<84a9> <84a9> 7539
<84aa> <84aa> 7480
<84ab> <84ab> 7482
<84ac> <84ac> 7494
<84ad> <84ad> 7498
<84ae> <84ae> 7506
<84af> <84af> 7502
<84b0> <84b0> 7514
<84b1> <84b1> 7530
<84b2> <84b2> 7522
<84b3> <84b3> 7538
<84b4> <84b4> 7554
<84b5> <84b5> 7511
<84b6> <84b6> 7526
<84b7> <84b7> 7519
<84b8> <84b8> 7534
<84b9> <84b9> 7542
<84ba> <84ba> 7508
<84bb> <84bb> 7527
<84bc> <84bc> 7516
<84bd> <84bd> 7535
<84be> <84be> 7545
<8540> <857e> 232
<8580> <8580> 390
<8581> <859e> 296
<859f> <85dd> 327
<85de> <85fc> 391
<8640> <867e> 422
<8680> <8691> 485
<8692> <8692> 295
<8693> <869e> 503
<86a2> <86ed> 7479
<8740> <875d> 7555
<875f> <8775> 7585
<8780> <878f> 7608
<8790> <8790> 762
<8791> <8791> 761
<8792> <8792> 769
<8793> <8799> 7624
<879a> <879a> 768
<879b> <879c> 7631
<889f> <88fc> 1125
<8940> <897e> 1219
<8980> <89fc> 1282
<8a40> <8a7e> 1407
<8a80> <8afc> 1470
<8b40> <8b7e> 1595
<8b80> <8bfc> 1658
<8c40> <8c7e> 1783
<8c80> <8cfc> 1846
<8d40> <8d7e> 1971
<8d80> <8dfc> 2034
<8e40> <8e7e> 2159
<8e80> <8efc> 2222
<8f40> <8f7e> 2347
<8f80> <8ffc> 2410
<9040> <907e> 2535
<9080> <90fc> 2598
<9140> <917e> 2723
<9180> <91fc> 2786
<9240> <927e> 2911
<9280> <92fc> 2974
<9340> <937e> 3099
<9380> <93fc> 3162
<9440> <947e> 3287
<9480> <94fc> 3350
<9540> <957e> 3475
<9580> <95fc> 3538
<9640> <967e> 3663
<9680> <96fc> 3726
endcidrange

100 begincidrange
<9740> <977e> 3851
<9780> <97fc> 3914
<9840> <9872> 4039
<989f> <98fc> 4090
<9940> <997e> 4184
<9980> <99fc> 4247
<9a40> <9a7e> 4372
<9a80> <9afc> 4435
<9b40> <9b7e> 4560
<9b80> <9bfc> 4623
<9c40> <9c7e> 4748
<9c80> <9cfc> 4811
<9d40> <9d7e> 4936
<9d80> <9dfc> 4999
<9e40> <9e7e> 5124
<9e80> <9efc> 5187
<9f40> <9f7e> 5312
<9f80> <9ffc> 5375
<a0> <df> 326
<e040> <e07e> 5500
<e080> <e0fc> 5563
<e140> <e17e> 5688
<e180> <e1fc> 5751
<e240> <e27e> 5876
<e280> <e2fc> 5939
<e340> <e37e> 6064
<e380> <e3fc> 6127
<e440> <e47e> 6252
<e480> <e4fc> 6315
<e540> <e57e> 6440
<e580> <e5fc> 6503
<e640> <e67e> 6628
<e680> <e6fc> 6691
<e740> <e77e> 6816
<e780> <e7fc> 6879
<e840> <e87e> 7004
<e880> <e8fc> 7067
<e940> <e97e> 7192
<e980> <e9fc> 7255
<ea40> <ea7e> 7380
<ea80> <eaa2> 7443
<eaa3> <eaa4> 8284
<eb40> <eb40> 633
<eb41> <eb42> 7887
<eb43> <eb4f> 636
<eb50> <eb51> 7889
<eb52> <eb5a> 651
<eb5b> <eb5d> 7891
<eb5e> <eb5f> 663
<eb60> <eb64> 7894
<eb65> <eb68> 670
<eb69> <eb7a> 7899
<eb7b> <eb7e> 692
<eb80> <eb80> 696
<eb81> <eb81> 7917
<eb82> <ebac> 698
<ebb8> <ebbf> 741
<ebc8> <ebce> 749
<ebda> <ebe8> 756
<ebf0> <ebf7> 771
<ebfc> <ebfc> 779
<ec4f> <ec58> 780
<ec60> <ec79> 790
<ec81> <ec9a> 816
<ec9f> <ec9f> 7918
<eca0> <eca0> 843
<eca1> <eca1> 7919
<eca2> <eca2> 845
<eca3> <eca3> 7920
<eca4> <eca4> 847
<eca5> <eca5> 7921
<eca6> <eca6> 849
<eca7> <eca7> 7922
<eca8> <ecc0> 851
<ecc1> <ecc1> 7923
<ecc2> <ece0> 877
<ece1> <ece1> 7924
<ece2> <ece2> 909
<ece3> <ece3> 7925
<ece4> <ece4> 911
<ece5> <ece5> 7926
<ece6> <eceb> 913
<ecec> <ecec> 7927
<eced> <ecf1> 920
<ed40> <ed40> 7928
<ed41> <ed41> 926
<ed42> <ed42> 7929
<ed43> <ed43> 928
<ed44> <ed44> 7930
<ed45> <ed45> 930
<ed46> <ed46> 7931
<ed47> <ed47> 932
<ed48> <ed48> 7932
<ed49> <ed61> 934
<ed62> <ed62> 7933
<ed63> <ed7e> 960
<ed80> <ed82> 988
<ed83> <ed83> 7934
<ed84> <ed84> 992
<ed85> <ed85> 7935
endcidrange

22 begincidrange
<ed86> <ed86> 994
<ed87> <ed87> 7936
<ed88> <ed8d> 996
<ed8e> <ed8e> 7937
<ed8f> <ed94> 1003
<ed95> <ed96> 7938
<ed9f> <edb6> 1011
<edbf> <edd6> 1035
<ee40> <ee5d> 7555
<ee5f> <ee6e> 7940
<ee6f> <ee75> 7601
<ee80> <ee81> 7956
<ee82> <ee8f> 7610
<ee90> <ee90> 762
<ee91> <ee91> 761
<ee92> <ee92> 769
<ee93> <ee99> 7624
<ee9a> <ee9a> 768
<ee9b> <ee9c> 7631
<fd> <fd> 152
<fe> <fe> 228
<ff> <ff> 124
endcidrange
endcmap
CMapName currentdict /CMap defineresource pop
end
end

%%EndResource
%%EOF
Loading

0 comments on commit efb51ac

Please sign in to comment.