You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2010/02/07 19:09:21 UTC
svn commit: r907461 [3/3] - in /pdfbox/fontbox/trunk/src:
main/java/org/apache/fontbox/cff/ main/java/org/apache/fontbox/cff/charset/
main/java/org/apache/fontbox/cff/encoding/ test/java/org/apache/fontbox/cff/
Added: pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/charset/package.html
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/charset/package.html?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/charset/package.html (added)
+++ pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/charset/package.html Sun Feb 7 18:09:19 2010
@@ -0,0 +1,25 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one or more
+ ! contributor license agreements. See the NOTICE file distributed with
+ ! this work for additional information regarding copyright ownership.
+ ! The ASF licenses this file to You under the Apache License, Version 2.0
+ ! (the "License"); you may not use this file except in compliance with
+ ! the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+
+</head>
+<body>
+This package holds classes used to handle the charsets of CFF/Type2-Fonts (aka Type1C-Fonts).
+</body>
+</html>
Added: pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFEncoding.java?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFEncoding.java (added)
+++ pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFEncoding.java Sun Feb 7 18:09:19 2010
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff.encoding;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * This is the superclass for all CFFFont encodings.
+ *
+ * @author Villu Russmann
+ * @version $Revision$
+ */
+public abstract class CFFEncoding
+{
+
+ private static HashMap<Integer,Integer> code2sid = new HashMap<Integer,Integer>();
+ private static HashMap<Integer,Integer> sid2code = new HashMap<Integer,Integer>();
+
+ /**
+ * Determines if the encoding is font specific or not.
+ * @return if the encoding is font specific
+ */
+ public boolean isFontSpecific()
+ {
+ return false;
+ }
+
+ /**
+ * Returns the code corresponding to the given SID.
+ * @param sid the given SID
+ * @return the corresponding code
+ */
+ public int getCode(int sid)
+ {
+ if (sid2code.containsKey(sid))
+ {
+ return sid2code.get(sid);
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the SID corresponding to the given code.
+ * @param code the given code
+ * @return the corresponding SID
+ */
+ public int getSID(int code)
+ {
+ if (code2sid.containsKey(code))
+ {
+ return code2sid.get(code);
+ }
+ return -1;
+ }
+
+ /**
+ * Adds a new code/SID combination to the encoding.
+ * @param code the given code
+ * @param sid the given SID
+ */
+ public void register(int code, int sid)
+ {
+ // TODO check if mapping already exists
+ sid2code.put(sid,code);
+ code2sid.put(code,sid);
+ }
+
+ /**
+ * Returns an iterator for all codes of this encoding.
+ *
+ * @return the iterator for all codes of this encoding
+ */
+ public Iterator<Integer> getCodes()
+ {
+ return code2sid.keySet().iterator();
+ }
+}
\ No newline at end of file
Added: pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFExpertEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFExpertEncoding.java?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFExpertEncoding.java (added)
+++ pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFExpertEncoding.java Sun Feb 7 18:09:19 2010
@@ -0,0 +1,302 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff.encoding;
+
+/**
+ * This is specialized CFFEncoding. It's used if the EncodingId of a font is set to 1.
+ *
+ * @author Villu Russmann
+ * @version $Revision$
+ */
+public class CFFExpertEncoding extends CFFEncoding
+{
+
+ private CFFExpertEncoding()
+ {
+ }
+
+ /**
+ * Returns an instance of the CFFExportEncoding class.
+ * @return an instance of CFFExportEncoding
+ */
+ public static CFFExpertEncoding getInstance()
+ {
+ return CFFExpertEncoding.INSTANCE;
+ }
+
+ private static final CFFExpertEncoding INSTANCE = new CFFExpertEncoding();
+
+ static
+ {
+ INSTANCE.register(0, 0);
+ INSTANCE.register(1, 0);
+ INSTANCE.register(2, 0);
+ INSTANCE.register(3, 0);
+ INSTANCE.register(4, 0);
+ INSTANCE.register(5, 0);
+ INSTANCE.register(6, 0);
+ INSTANCE.register(7, 0);
+ INSTANCE.register(8, 0);
+ INSTANCE.register(9, 0);
+ INSTANCE.register(10, 0);
+ INSTANCE.register(11, 0);
+ INSTANCE.register(12, 0);
+ INSTANCE.register(13, 0);
+ INSTANCE.register(14, 0);
+ INSTANCE.register(15, 0);
+ INSTANCE.register(16, 0);
+ INSTANCE.register(17, 0);
+ INSTANCE.register(18, 0);
+ INSTANCE.register(19, 0);
+ INSTANCE.register(20, 0);
+ INSTANCE.register(21, 0);
+ INSTANCE.register(22, 0);
+ INSTANCE.register(23, 0);
+ INSTANCE.register(24, 0);
+ INSTANCE.register(25, 0);
+ INSTANCE.register(26, 0);
+ INSTANCE.register(27, 0);
+ INSTANCE.register(28, 0);
+ INSTANCE.register(29, 0);
+ INSTANCE.register(30, 0);
+ INSTANCE.register(31, 0);
+ INSTANCE.register(32, 1);
+ INSTANCE.register(33, 229);
+ INSTANCE.register(34, 230);
+ INSTANCE.register(35, 0);
+ INSTANCE.register(36, 231);
+ INSTANCE.register(37, 232);
+ INSTANCE.register(38, 233);
+ INSTANCE.register(39, 234);
+ INSTANCE.register(40, 235);
+ INSTANCE.register(41, 236);
+ INSTANCE.register(42, 237);
+ INSTANCE.register(43, 238);
+ INSTANCE.register(44, 13);
+ INSTANCE.register(45, 14);
+ INSTANCE.register(46, 15);
+ INSTANCE.register(47, 99);
+ INSTANCE.register(48, 239);
+ INSTANCE.register(49, 240);
+ INSTANCE.register(50, 241);
+ INSTANCE.register(51, 242);
+ INSTANCE.register(52, 243);
+ INSTANCE.register(53, 244);
+ INSTANCE.register(54, 245);
+ INSTANCE.register(55, 246);
+ INSTANCE.register(56, 247);
+ INSTANCE.register(57, 248);
+ INSTANCE.register(58, 27);
+ INSTANCE.register(59, 28);
+ INSTANCE.register(60, 249);
+ INSTANCE.register(61, 250);
+ INSTANCE.register(62, 251);
+ INSTANCE.register(63, 252);
+ INSTANCE.register(64, 0);
+ INSTANCE.register(65, 253);
+ INSTANCE.register(66, 254);
+ INSTANCE.register(67, 255);
+ INSTANCE.register(68, 256);
+ INSTANCE.register(69, 257);
+ INSTANCE.register(70, 0);
+ INSTANCE.register(71, 0);
+ INSTANCE.register(72, 0);
+ INSTANCE.register(73, 258);
+ INSTANCE.register(74, 0);
+ INSTANCE.register(75, 0);
+ INSTANCE.register(76, 259);
+ INSTANCE.register(77, 260);
+ INSTANCE.register(78, 261);
+ INSTANCE.register(79, 262);
+ INSTANCE.register(80, 0);
+ INSTANCE.register(81, 0);
+ INSTANCE.register(82, 263);
+ INSTANCE.register(83, 264);
+ INSTANCE.register(84, 265);
+ INSTANCE.register(85, 0);
+ INSTANCE.register(86, 266);
+ INSTANCE.register(87, 109);
+ INSTANCE.register(88, 110);
+ INSTANCE.register(89, 267);
+ INSTANCE.register(90, 268);
+ INSTANCE.register(91, 269);
+ INSTANCE.register(92, 0);
+ INSTANCE.register(93, 270);
+ INSTANCE.register(94, 271);
+ INSTANCE.register(95, 272);
+ INSTANCE.register(96, 273);
+ INSTANCE.register(97, 274);
+ INSTANCE.register(98, 275);
+ INSTANCE.register(99, 276);
+ INSTANCE.register(100, 277);
+ INSTANCE.register(101, 278);
+ INSTANCE.register(102, 279);
+ INSTANCE.register(103, 280);
+ INSTANCE.register(104, 281);
+ INSTANCE.register(105, 282);
+ INSTANCE.register(106, 283);
+ INSTANCE.register(107, 284);
+ INSTANCE.register(108, 285);
+ INSTANCE.register(109, 286);
+ INSTANCE.register(110, 287);
+ INSTANCE.register(111, 288);
+ INSTANCE.register(112, 289);
+ INSTANCE.register(113, 290);
+ INSTANCE.register(114, 291);
+ INSTANCE.register(115, 292);
+ INSTANCE.register(116, 293);
+ INSTANCE.register(117, 294);
+ INSTANCE.register(118, 295);
+ INSTANCE.register(119, 296);
+ INSTANCE.register(120, 297);
+ INSTANCE.register(121, 298);
+ INSTANCE.register(122, 299);
+ INSTANCE.register(123, 300);
+ INSTANCE.register(124, 301);
+ INSTANCE.register(125, 302);
+ INSTANCE.register(126, 303);
+ INSTANCE.register(127, 0);
+ INSTANCE.register(128, 0);
+ INSTANCE.register(129, 0);
+ INSTANCE.register(130, 0);
+ INSTANCE.register(131, 0);
+ INSTANCE.register(132, 0);
+ INSTANCE.register(133, 0);
+ INSTANCE.register(134, 0);
+ INSTANCE.register(135, 0);
+ INSTANCE.register(136, 0);
+ INSTANCE.register(137, 0);
+ INSTANCE.register(138, 0);
+ INSTANCE.register(139, 0);
+ INSTANCE.register(140, 0);
+ INSTANCE.register(141, 0);
+ INSTANCE.register(142, 0);
+ INSTANCE.register(143, 0);
+ INSTANCE.register(144, 0);
+ INSTANCE.register(145, 0);
+ INSTANCE.register(146, 0);
+ INSTANCE.register(147, 0);
+ INSTANCE.register(148, 0);
+ INSTANCE.register(149, 0);
+ INSTANCE.register(150, 0);
+ INSTANCE.register(151, 0);
+ INSTANCE.register(152, 0);
+ INSTANCE.register(153, 0);
+ INSTANCE.register(154, 0);
+ INSTANCE.register(155, 0);
+ INSTANCE.register(156, 0);
+ INSTANCE.register(157, 0);
+ INSTANCE.register(158, 0);
+ INSTANCE.register(159, 0);
+ INSTANCE.register(160, 0);
+ INSTANCE.register(161, 304);
+ INSTANCE.register(162, 305);
+ INSTANCE.register(163, 306);
+ INSTANCE.register(164, 0);
+ INSTANCE.register(165, 0);
+ INSTANCE.register(166, 307);
+ INSTANCE.register(167, 308);
+ INSTANCE.register(168, 309);
+ INSTANCE.register(169, 310);
+ INSTANCE.register(170, 311);
+ INSTANCE.register(171, 0);
+ INSTANCE.register(172, 312);
+ INSTANCE.register(173, 0);
+ INSTANCE.register(174, 0);
+ INSTANCE.register(175, 313);
+ INSTANCE.register(176, 0);
+ INSTANCE.register(177, 0);
+ INSTANCE.register(178, 314);
+ INSTANCE.register(179, 315);
+ INSTANCE.register(180, 0);
+ INSTANCE.register(181, 0);
+ INSTANCE.register(182, 316);
+ INSTANCE.register(183, 317);
+ INSTANCE.register(184, 318);
+ INSTANCE.register(185, 0);
+ INSTANCE.register(186, 0);
+ INSTANCE.register(187, 0);
+ INSTANCE.register(188, 158);
+ INSTANCE.register(189, 155);
+ INSTANCE.register(190, 163);
+ INSTANCE.register(191, 319);
+ INSTANCE.register(192, 320);
+ INSTANCE.register(193, 321);
+ INSTANCE.register(194, 322);
+ INSTANCE.register(195, 323);
+ INSTANCE.register(196, 324);
+ INSTANCE.register(197, 325);
+ INSTANCE.register(198, 0);
+ INSTANCE.register(199, 0);
+ INSTANCE.register(200, 326);
+ INSTANCE.register(201, 150);
+ INSTANCE.register(202, 164);
+ INSTANCE.register(203, 169);
+ INSTANCE.register(204, 327);
+ INSTANCE.register(205, 328);
+ INSTANCE.register(206, 329);
+ INSTANCE.register(207, 330);
+ INSTANCE.register(208, 331);
+ INSTANCE.register(209, 332);
+ INSTANCE.register(210, 333);
+ INSTANCE.register(211, 334);
+ INSTANCE.register(212, 335);
+ INSTANCE.register(213, 336);
+ INSTANCE.register(214, 337);
+ INSTANCE.register(215, 338);
+ INSTANCE.register(216, 339);
+ INSTANCE.register(217, 340);
+ INSTANCE.register(218, 341);
+ INSTANCE.register(219, 342);
+ INSTANCE.register(220, 343);
+ INSTANCE.register(221, 344);
+ INSTANCE.register(222, 345);
+ INSTANCE.register(223, 346);
+ INSTANCE.register(224, 347);
+ INSTANCE.register(225, 348);
+ INSTANCE.register(226, 349);
+ INSTANCE.register(227, 350);
+ INSTANCE.register(228, 351);
+ INSTANCE.register(229, 352);
+ INSTANCE.register(230, 353);
+ INSTANCE.register(231, 354);
+ INSTANCE.register(232, 355);
+ INSTANCE.register(233, 356);
+ INSTANCE.register(234, 357);
+ INSTANCE.register(235, 358);
+ INSTANCE.register(236, 359);
+ INSTANCE.register(237, 360);
+ INSTANCE.register(238, 361);
+ INSTANCE.register(239, 362);
+ INSTANCE.register(240, 363);
+ INSTANCE.register(241, 364);
+ INSTANCE.register(242, 365);
+ INSTANCE.register(243, 366);
+ INSTANCE.register(244, 367);
+ INSTANCE.register(245, 368);
+ INSTANCE.register(246, 369);
+ INSTANCE.register(247, 370);
+ INSTANCE.register(248, 371);
+ INSTANCE.register(249, 372);
+ INSTANCE.register(250, 373);
+ INSTANCE.register(251, 374);
+ INSTANCE.register(252, 375);
+ INSTANCE.register(253, 376);
+ INSTANCE.register(254, 377);
+ INSTANCE.register(255, 378);
+ }
+}
\ No newline at end of file
Added: pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFStandardEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFStandardEncoding.java?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFStandardEncoding.java (added)
+++ pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/CFFStandardEncoding.java Sun Feb 7 18:09:19 2010
@@ -0,0 +1,302 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff.encoding;
+
+/**
+ * This is specialized CFFEncoding. It's used if the EncodingId of a font is set to 0.
+ *
+ * @author Villu Russmann
+ * @version $Revision$
+ */
+public class CFFStandardEncoding extends CFFEncoding
+{
+
+ private CFFStandardEncoding()
+ {
+ }
+
+ /**
+ * Returns an instance of the CFFStandardEncoding class.
+ * @return an instance of CFFStandardEncoding
+ */
+ public static CFFStandardEncoding getInstance()
+ {
+ return CFFStandardEncoding.INSTANCE;
+ }
+
+ private static final CFFStandardEncoding INSTANCE = new CFFStandardEncoding();
+
+ static
+ {
+ INSTANCE.register(0, 0);
+ INSTANCE.register(1, 0);
+ INSTANCE.register(2, 0);
+ INSTANCE.register(3, 0);
+ INSTANCE.register(4, 0);
+ INSTANCE.register(5, 0);
+ INSTANCE.register(6, 0);
+ INSTANCE.register(7, 0);
+ INSTANCE.register(8, 0);
+ INSTANCE.register(9, 0);
+ INSTANCE.register(10, 0);
+ INSTANCE.register(11, 0);
+ INSTANCE.register(12, 0);
+ INSTANCE.register(13, 0);
+ INSTANCE.register(14, 0);
+ INSTANCE.register(15, 0);
+ INSTANCE.register(16, 0);
+ INSTANCE.register(17, 0);
+ INSTANCE.register(18, 0);
+ INSTANCE.register(19, 0);
+ INSTANCE.register(20, 0);
+ INSTANCE.register(21, 0);
+ INSTANCE.register(22, 0);
+ INSTANCE.register(23, 0);
+ INSTANCE.register(24, 0);
+ INSTANCE.register(25, 0);
+ INSTANCE.register(26, 0);
+ INSTANCE.register(27, 0);
+ INSTANCE.register(28, 0);
+ INSTANCE.register(29, 0);
+ INSTANCE.register(30, 0);
+ INSTANCE.register(31, 0);
+ INSTANCE.register(32, 1);
+ INSTANCE.register(33, 2);
+ INSTANCE.register(34, 3);
+ INSTANCE.register(35, 4);
+ INSTANCE.register(36, 5);
+ INSTANCE.register(37, 6);
+ INSTANCE.register(38, 7);
+ INSTANCE.register(39, 8);
+ INSTANCE.register(40, 9);
+ INSTANCE.register(41, 10);
+ INSTANCE.register(42, 11);
+ INSTANCE.register(43, 12);
+ INSTANCE.register(44, 13);
+ INSTANCE.register(45, 14);
+ INSTANCE.register(46, 15);
+ INSTANCE.register(47, 16);
+ INSTANCE.register(48, 17);
+ INSTANCE.register(49, 18);
+ INSTANCE.register(50, 19);
+ INSTANCE.register(51, 20);
+ INSTANCE.register(52, 21);
+ INSTANCE.register(53, 22);
+ INSTANCE.register(54, 23);
+ INSTANCE.register(55, 24);
+ INSTANCE.register(56, 25);
+ INSTANCE.register(57, 26);
+ INSTANCE.register(58, 27);
+ INSTANCE.register(59, 28);
+ INSTANCE.register(60, 29);
+ INSTANCE.register(61, 30);
+ INSTANCE.register(62, 31);
+ INSTANCE.register(63, 32);
+ INSTANCE.register(64, 33);
+ INSTANCE.register(65, 34);
+ INSTANCE.register(66, 35);
+ INSTANCE.register(67, 36);
+ INSTANCE.register(68, 37);
+ INSTANCE.register(69, 38);
+ INSTANCE.register(70, 39);
+ INSTANCE.register(71, 40);
+ INSTANCE.register(72, 41);
+ INSTANCE.register(73, 42);
+ INSTANCE.register(74, 43);
+ INSTANCE.register(75, 44);
+ INSTANCE.register(76, 45);
+ INSTANCE.register(77, 46);
+ INSTANCE.register(78, 47);
+ INSTANCE.register(79, 48);
+ INSTANCE.register(80, 49);
+ INSTANCE.register(81, 50);
+ INSTANCE.register(82, 51);
+ INSTANCE.register(83, 52);
+ INSTANCE.register(84, 53);
+ INSTANCE.register(85, 54);
+ INSTANCE.register(86, 55);
+ INSTANCE.register(87, 56);
+ INSTANCE.register(88, 57);
+ INSTANCE.register(89, 58);
+ INSTANCE.register(90, 59);
+ INSTANCE.register(91, 60);
+ INSTANCE.register(92, 61);
+ INSTANCE.register(93, 62);
+ INSTANCE.register(94, 63);
+ INSTANCE.register(95, 64);
+ INSTANCE.register(96, 65);
+ INSTANCE.register(97, 66);
+ INSTANCE.register(98, 67);
+ INSTANCE.register(99, 68);
+ INSTANCE.register(100, 69);
+ INSTANCE.register(101, 70);
+ INSTANCE.register(102, 71);
+ INSTANCE.register(103, 72);
+ INSTANCE.register(104, 73);
+ INSTANCE.register(105, 74);
+ INSTANCE.register(106, 75);
+ INSTANCE.register(107, 76);
+ INSTANCE.register(108, 77);
+ INSTANCE.register(109, 78);
+ INSTANCE.register(110, 79);
+ INSTANCE.register(111, 80);
+ INSTANCE.register(112, 81);
+ INSTANCE.register(113, 82);
+ INSTANCE.register(114, 83);
+ INSTANCE.register(115, 84);
+ INSTANCE.register(116, 85);
+ INSTANCE.register(117, 86);
+ INSTANCE.register(118, 87);
+ INSTANCE.register(119, 88);
+ INSTANCE.register(120, 89);
+ INSTANCE.register(121, 90);
+ INSTANCE.register(122, 91);
+ INSTANCE.register(123, 92);
+ INSTANCE.register(124, 93);
+ INSTANCE.register(125, 94);
+ INSTANCE.register(126, 95);
+ INSTANCE.register(127, 0);
+ INSTANCE.register(128, 0);
+ INSTANCE.register(129, 0);
+ INSTANCE.register(130, 0);
+ INSTANCE.register(131, 0);
+ INSTANCE.register(132, 0);
+ INSTANCE.register(133, 0);
+ INSTANCE.register(134, 0);
+ INSTANCE.register(135, 0);
+ INSTANCE.register(136, 0);
+ INSTANCE.register(137, 0);
+ INSTANCE.register(138, 0);
+ INSTANCE.register(139, 0);
+ INSTANCE.register(140, 0);
+ INSTANCE.register(141, 0);
+ INSTANCE.register(142, 0);
+ INSTANCE.register(143, 0);
+ INSTANCE.register(144, 0);
+ INSTANCE.register(145, 0);
+ INSTANCE.register(146, 0);
+ INSTANCE.register(147, 0);
+ INSTANCE.register(148, 0);
+ INSTANCE.register(149, 0);
+ INSTANCE.register(150, 0);
+ INSTANCE.register(151, 0);
+ INSTANCE.register(152, 0);
+ INSTANCE.register(153, 0);
+ INSTANCE.register(154, 0);
+ INSTANCE.register(155, 0);
+ INSTANCE.register(156, 0);
+ INSTANCE.register(157, 0);
+ INSTANCE.register(158, 0);
+ INSTANCE.register(159, 0);
+ INSTANCE.register(160, 0);
+ INSTANCE.register(161, 96);
+ INSTANCE.register(162, 97);
+ INSTANCE.register(163, 98);
+ INSTANCE.register(164, 99);
+ INSTANCE.register(165, 100);
+ INSTANCE.register(166, 101);
+ INSTANCE.register(167, 102);
+ INSTANCE.register(168, 103);
+ INSTANCE.register(169, 104);
+ INSTANCE.register(170, 105);
+ INSTANCE.register(171, 106);
+ INSTANCE.register(172, 107);
+ INSTANCE.register(173, 108);
+ INSTANCE.register(174, 109);
+ INSTANCE.register(175, 110);
+ INSTANCE.register(176, 0);
+ INSTANCE.register(177, 111);
+ INSTANCE.register(178, 112);
+ INSTANCE.register(179, 113);
+ INSTANCE.register(180, 114);
+ INSTANCE.register(181, 0);
+ INSTANCE.register(182, 115);
+ INSTANCE.register(183, 116);
+ INSTANCE.register(184, 117);
+ INSTANCE.register(185, 118);
+ INSTANCE.register(186, 119);
+ INSTANCE.register(187, 120);
+ INSTANCE.register(188, 121);
+ INSTANCE.register(189, 122);
+ INSTANCE.register(190, 0);
+ INSTANCE.register(191, 123);
+ INSTANCE.register(192, 0);
+ INSTANCE.register(193, 124);
+ INSTANCE.register(194, 125);
+ INSTANCE.register(195, 126);
+ INSTANCE.register(196, 127);
+ INSTANCE.register(197, 128);
+ INSTANCE.register(198, 129);
+ INSTANCE.register(199, 130);
+ INSTANCE.register(200, 131);
+ INSTANCE.register(201, 0);
+ INSTANCE.register(202, 132);
+ INSTANCE.register(203, 133);
+ INSTANCE.register(204, 0);
+ INSTANCE.register(205, 134);
+ INSTANCE.register(206, 135);
+ INSTANCE.register(207, 136);
+ INSTANCE.register(208, 137);
+ INSTANCE.register(209, 0);
+ INSTANCE.register(210, 0);
+ INSTANCE.register(211, 0);
+ INSTANCE.register(212, 0);
+ INSTANCE.register(213, 0);
+ INSTANCE.register(214, 0);
+ INSTANCE.register(215, 0);
+ INSTANCE.register(216, 0);
+ INSTANCE.register(217, 0);
+ INSTANCE.register(218, 0);
+ INSTANCE.register(219, 0);
+ INSTANCE.register(220, 0);
+ INSTANCE.register(221, 0);
+ INSTANCE.register(222, 0);
+ INSTANCE.register(223, 0);
+ INSTANCE.register(224, 0);
+ INSTANCE.register(225, 138);
+ INSTANCE.register(226, 0);
+ INSTANCE.register(227, 139);
+ INSTANCE.register(228, 0);
+ INSTANCE.register(229, 0);
+ INSTANCE.register(230, 0);
+ INSTANCE.register(231, 0);
+ INSTANCE.register(232, 140);
+ INSTANCE.register(233, 141);
+ INSTANCE.register(234, 142);
+ INSTANCE.register(235, 143);
+ INSTANCE.register(236, 0);
+ INSTANCE.register(237, 0);
+ INSTANCE.register(238, 0);
+ INSTANCE.register(239, 0);
+ INSTANCE.register(240, 0);
+ INSTANCE.register(241, 144);
+ INSTANCE.register(242, 0);
+ INSTANCE.register(243, 0);
+ INSTANCE.register(244, 0);
+ INSTANCE.register(245, 145);
+ INSTANCE.register(246, 0);
+ INSTANCE.register(247, 0);
+ INSTANCE.register(248, 146);
+ INSTANCE.register(249, 147);
+ INSTANCE.register(250, 148);
+ INSTANCE.register(251, 149);
+ INSTANCE.register(252, 0);
+ INSTANCE.register(253, 0);
+ INSTANCE.register(254, 0);
+ INSTANCE.register(255, 0);
+ }
+}
\ No newline at end of file
Added: pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/package.html
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/package.html?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/package.html (added)
+++ pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/encoding/package.html Sun Feb 7 18:09:19 2010
@@ -0,0 +1,25 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one or more
+ ! contributor license agreements. See the NOTICE file distributed with
+ ! this work for additional information regarding copyright ownership.
+ ! The ASF licenses this file to You under the Apache License, Version 2.0
+ ! (the "License"); you may not use this file except in compliance with
+ ! the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+
+</head>
+<body>
+This package holds classes used to handle the encoding of CFF/Type2-Fonts (aka Type1C-Fonts).
+</body>
+</html>
Added: pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/package.html
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/package.html?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/package.html (added)
+++ pdfbox/fontbox/trunk/src/main/java/org/apache/fontbox/cff/package.html Sun Feb 7 18:09:19 2010
@@ -0,0 +1,25 @@
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one or more
+ ! contributor license agreements. See the NOTICE file distributed with
+ ! this work for additional information regarding copyright ownership.
+ ! The ASF licenses this file to You under the Apache License, Version 2.0
+ ! (the "License"); you may not use this file except in compliance with
+ ! the License. You may obtain a copy of the License at
+ !
+ ! http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+
+</head>
+<body>
+This package holds classes used to parse CFF/Type2-Fonts (aka Type1C-Fonts).
+</body>
+</html>
Added: pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1CharStringTest.java
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1CharStringTest.java?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1CharStringTest.java (added)
+++ pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1CharStringTest.java Sun Feb 7 18:09:19 2010
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import org.junit.Test;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * This class includes some test cases for the Type1CharStringFormatter and the Type1CharStringParser.
+ *
+ * @author Villu Russmann
+ * @version $Revision$
+ */
+public class Type1CharStringTest
+{
+
+ /**
+ * Tests the encoding and decoding of a command sequence.
+ * @throws IOException if an error occurs during reading
+ */
+ @Test
+ public void commandEncoding() throws IOException
+ {
+ List<Object> commands = createCommandSequence(new int[] { 0 },
+ new int[] { 12, 0 }, new int[] { 31 });
+
+ byte[] encodedCommands = new Type1CharStringFormatter().format(commands);
+ List<Object> decodedCommands = new Type1CharStringParser().parse(encodedCommands);
+
+ assertEquals(1 + 2 + 1, encodedCommands.length);
+
+ assertEquals(commands, decodedCommands);
+ }
+
+ /**
+ * Tests the encoding and decoding of a number sequence.
+ * @throws IOException if an error occurs during reading
+ */
+ @Test
+ public void numberEncoding() throws IOException
+ {
+ List<Object> numbers = createNumberSequence(-10000, -1131, -108, -107,
+ 0, 107, 108, 1131, 10000);
+
+ byte[] encodedNumbers = new Type1CharStringFormatter().format(numbers);
+ List<Object> decodedNumbers = new Type1CharStringParser()
+ .parse(encodedNumbers);
+
+ assertEquals(5 + 2 * 2 + 3 * 1 + 2 * 2 + 5, encodedNumbers.length);
+
+ assertEquals(numbers, decodedNumbers);
+ }
+
+ private static List<Object> createCommandSequence(int[]... values)
+ {
+ List<Object> sequence = new ArrayList<Object>();
+
+ for (int[] value : values)
+ {
+ sequence.add(value.length > 1 ? new CharStringCommand(value[0],
+ value[1]) : new CharStringCommand(value[0]));
+ }
+ return sequence;
+ }
+
+ private static List<Object> createNumberSequence(int... values)
+ {
+ List<Object> sequence = new ArrayList<Object>();
+
+ for (int value : values)
+ {
+ sequence.add(Integer.valueOf(value));
+ }
+
+ return sequence;
+ }
+}
\ No newline at end of file
Added: pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1FontUtilTest.java
URL: http://svn.apache.org/viewvc/pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1FontUtilTest.java?rev=907461&view=auto
==============================================================================
--- pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1FontUtilTest.java (added)
+++ pdfbox/fontbox/trunk/src/test/java/org/apache/fontbox/cff/Type1FontUtilTest.java Sun Feb 7 18:09:19 2010
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.cff;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import java.util.Random;
+import org.junit.Test;
+
+/**
+ * This class includes some tests for the Type1FontUtil class.
+ *
+ * @author Villu Russmann
+ * @version $Revision$
+ */
+public class Type1FontUtilTest
+{
+
+ /**
+ * Tests the hex encoding/decoding.
+ */
+ @Test
+ public void hexEncoding()
+ {
+ byte[] bytes = randomBytes(128);
+
+ String encodedBytes = Type1FontUtil.hexEncode(bytes);
+ byte[] decodedBytes = Type1FontUtil.hexDecode(encodedBytes);
+
+ assertArrayEquals(bytes, decodedBytes);
+ }
+
+ /**
+ * Tests the eexec encryption/decryption.
+ */
+ @Test
+ public void eexecEncryption()
+ {
+ byte[] bytes = randomBytes(128);
+
+ byte[] encryptedBytes = Type1FontUtil.eexecEncrypt(bytes);
+ byte[] decryptedBytes = Type1FontUtil.eexecDecrypt(encryptedBytes);
+
+ assertArrayEquals(bytes, decryptedBytes);
+ }
+
+ /**
+ * Tests the charstring encryption/decryption.
+ */
+ @Test
+ public void charstringEncryption()
+ {
+ byte[] bytes = randomBytes(128);
+
+ byte[] encryptedBytes = Type1FontUtil.charstringEncrypt(bytes, 4);
+ byte[] decryptedBytes = Type1FontUtil.charstringDecrypt(encryptedBytes,
+ 4);
+
+ assertArrayEquals(bytes, decryptedBytes);
+ }
+
+ private static byte[] randomBytes(int length)
+ {
+ byte[] bytes = new byte[length];
+
+ for (int i = 0; i < length; i++)
+ {
+ bytes[i] = (byte) RANDOM.nextInt(256);
+ }
+
+ return bytes;
+ }
+
+ private static final Random RANDOM = new Random();
+}
\ No newline at end of file