You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. Index: fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
  2. ===================================================================
  3. --- fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java (revision 1546564)
  4. +++ fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java (working copy)
  5. @@ -36,7 +36,7 @@
  6. import org.apache.fontbox.cff.encoding.CFFStandardEncoding;
  7. /**
  8. - * This class represents a parser for a CFF font.
  9. + * This class represents a parser for a CFF font.
  10. * @author Villu Ruusmann
  11. * @version $Revision: 1.0 $
  12. */
  13. @@ -107,7 +107,11 @@
  14. {
  15. input.setPosition(0);
  16. }
  17. + return parse(input);
  18. + }
  19. + public List<CFFFont> parse(CFFDataInput input) throws IOException {
  20. + this.input = input;
  21. header = readHeader(input);
  22. nameIndex = readIndexData(input);
  23. topDictIndex = readIndexData(input);
  24. @@ -119,6 +123,7 @@
  25. {
  26. CFFFont font = parseFont(i);
  27. font.setGlobalSubrIndex(globalSubrIndex);
  28. + font.constructMappings();
  29. fonts.add(font);
  30. }
  31. return fonts;
  32. @@ -145,7 +150,7 @@
  33. return cffHeader;
  34. }
  35. - private static IndexData readIndexData(CFFDataInput input) throws IOException
  36. + public static IndexData readIndexData(CFFDataInput input) throws IOException
  37. {
  38. int count = input.readCard16();
  39. IndexData index = new IndexData(count);
  40. @@ -179,7 +184,8 @@
  41. return dict;
  42. }
  43. - private static DictData.Entry readEntry(CFFDataInput input) throws IOException
  44. + private static DictData.Entry readEntry(CFFDataInput input)
  45. + throws IOException
  46. {
  47. DictData.Entry entry = new DictData.Entry();
  48. while (true)
  49. @@ -211,13 +217,15 @@
  50. return entry;
  51. }
  52. - private static CFFOperator readOperator(CFFDataInput input, int b0) throws IOException
  53. + private static CFFOperator readOperator(CFFDataInput input, int b0)
  54. + throws IOException
  55. {
  56. CFFOperator.Key key = readOperatorKey(input, b0);
  57. return CFFOperator.getOperator(key);
  58. }
  59. - private static CFFOperator.Key readOperatorKey(CFFDataInput input, int b0) throws IOException
  60. + private static CFFOperator.Key readOperatorKey(CFFDataInput input, int b0)
  61. + throws IOException
  62. {
  63. if (b0 == 12)
  64. {
  65. @@ -227,7 +235,8 @@
  66. return new CFFOperator.Key(b0);
  67. }
  68. - private static Integer readIntegerNumber(CFFDataInput input, int b0) throws IOException
  69. + private static Integer readIntegerNumber(CFFDataInput input, int b0)
  70. + throws IOException
  71. {
  72. if (b0 == 28)
  73. {
  74. @@ -263,7 +272,8 @@
  75. }
  76. }
  77. - private static Double readRealNumber(CFFDataInput input, int b0) throws IOException
  78. + private static Double readRealNumber(CFFDataInput input, int b0)
  79. + throws IOException
  80. {
  81. StringBuffer sb = new StringBuffer();
  82. boolean done = false;
  83. @@ -446,9 +456,9 @@
  84. throw new IOException("FDArray is missing for a CIDKeyed Font.");
  85. }
  86. - int fontDictOffset = fdArrayEntry.getNumber(0).intValue();
  87. - input.setPosition(fontDictOffset);
  88. - IndexData fdIndex = readIndexData(input);
  89. + int fontDictOffset = fdArrayEntry.getNumber(0).intValue();
  90. + input.setPosition(fontDictOffset);
  91. + IndexData fdIndex = readIndexData(input);
  92. List<Map<String, Object>> privateDictionaries = new LinkedList<Map<String, Object>>();
  93. List<Map<String, Object>> fontDictionaries = new LinkedList<Map<String, Object>>();
  94. @@ -577,8 +587,8 @@
  95. {
  96. return CFFStandardString.getName(index);
  97. }
  98. - if (index - 391 <= stringIndex.getCount())
  99. - {
  100. + if (index - 391 < stringIndex.getCount())
  101. + {
  102. DataInput dataInput = new DataInput(stringIndex.getBytes(index - 391));
  103. return dataInput.getString();
  104. }
  105. @@ -620,7 +630,8 @@
  106. return entry != null ? entry.getArray() : defaultValue;
  107. }
  108. - private CFFEncoding readEncoding(CFFDataInput dataInput, int[] gids) throws IOException
  109. + private CFFEncoding readEncoding(CFFDataInput dataInput, int[] gids)
  110. + throws IOException
  111. {
  112. int format = dataInput.readCard8();
  113. int baseFormat = format & 0x7f;
  114. @@ -639,7 +650,8 @@
  115. }
  116. }
  117. - private Format0Encoding readFormat0Encoding(CFFDataInput dataInput, int format, int[] gids) throws IOException
  118. + private Format0Encoding readFormat0Encoding(CFFDataInput dataInput, int format,
  119. + int[] gids) throws IOException
  120. {
  121. Format0Encoding encoding = new Format0Encoding();
  122. encoding.format = format;
  123. @@ -657,7 +669,8 @@
  124. return encoding;
  125. }
  126. - private Format1Encoding readFormat1Encoding(CFFDataInput dataInput, int format, int[] gids) throws IOException
  127. + private Format1Encoding readFormat1Encoding(CFFDataInput dataInput, int format,
  128. + int[] gids) throws IOException
  129. {
  130. Format1Encoding encoding = new Format1Encoding();
  131. encoding.format = format;
  132. @@ -683,7 +696,8 @@
  133. return encoding;
  134. }
  135. - private void readSupplement(CFFDataInput dataInput, EmbeddedEncoding encoding) throws IOException
  136. + private void readSupplement(CFFDataInput dataInput, EmbeddedEncoding encoding)
  137. + throws IOException
  138. {
  139. encoding.nSups = dataInput.readCard8();
  140. encoding.supplement = new EmbeddedEncoding.Supplement[encoding.nSups];
  141. @@ -738,15 +752,14 @@
  142. fdselect.fds = new int[nGlyphs];
  143. for (int i = 0; i < fdselect.fds.length; i++)
  144. {
  145. - fdselect.fds[i] = dataInput.readCard8();
  146. -
  147. + fdselect.fds[i] = dataInput.readCard8();
  148. }
  149. return fdselect;
  150. }
  151. /**
  152. * Read the Format 3 of the FDSelect data structure.
  153. - *
  154. + *
  155. * @param dataInput
  156. * @param format
  157. * @param nGlyphs
  158. @@ -768,7 +781,6 @@
  159. r3.first = dataInput.readCard16();
  160. r3.fd = dataInput.readCard8();
  161. fdselect.range3[i] = r3;
  162. -
  163. }
  164. fdselect.sentinel = dataInput.readCard16();
  165. @@ -902,7 +914,8 @@
  166. }
  167. }
  168. - private CFFCharset readCharset(CFFDataInput dataInput, int nGlyphs) throws IOException
  169. + private CFFCharset readCharset(CFFDataInput dataInput, int nGlyphs)
  170. + throws IOException
  171. {
  172. int format = dataInput.readCard8();
  173. if (format == 0)
  174. @@ -923,7 +936,8 @@
  175. }
  176. }
  177. - private Format0Charset readFormat0Charset(CFFDataInput dataInput, int format, int nGlyphs) throws IOException
  178. + private Format0Charset readFormat0Charset(CFFDataInput dataInput, int format,
  179. + int nGlyphs) throws IOException
  180. {
  181. Format0Charset charset = new Format0Charset();
  182. charset.format = format;
  183. @@ -936,7 +950,8 @@
  184. return charset;
  185. }
  186. - private Format1Charset readFormat1Charset(CFFDataInput dataInput, int format, int nGlyphs) throws IOException
  187. + private Format1Charset readFormat1Charset(CFFDataInput dataInput, int format,
  188. + int nGlyphs) throws IOException
  189. {
  190. Format1Charset charset = new Format1Charset();
  191. charset.format = format;
  192. @@ -957,7 +972,8 @@
  193. return charset;
  194. }
  195. - private Format2Charset readFormat2Charset(CFFDataInput dataInput, int format, int nGlyphs) throws IOException
  196. + private Format2Charset readFormat2Charset(CFFDataInput dataInput, int format,
  197. + int nGlyphs) throws IOException
  198. {
  199. Format2Charset charset = new Format2Charset();
  200. charset.format = format;
  201. @@ -981,7 +997,7 @@
  202. }
  203. /**
  204. - * Inner class holding the header of a CFF font.
  205. + * Inner class holding the header of a CFF font.
  206. */
  207. private static class Header
  208. {
  209. @@ -999,7 +1015,7 @@
  210. }
  211. /**
  212. - * Inner class holding the DictData of a CFF font.
  213. + * Inner class holding the DictData of a CFF font.
  214. */
  215. private static class DictData
  216. {
  217. @@ -1030,7 +1046,7 @@
  218. }
  219. /**
  220. - * {@inheritDoc}
  221. + * {@inheritDoc}
  222. */
  223. public String toString()
  224. {
  225. @@ -1038,7 +1054,7 @@
  226. }
  227. /**
  228. - * Inner class holding an operand of a CFF font.
  229. + * Inner class holding an operand of a CFF font.
  230. */
  231. private static class Entry
  232. {
  233. @@ -1100,7 +1116,7 @@
  234. }
  235. /**
  236. - * Inner class representing an embedded CFF encoding.
  237. + * Inner class representing an embedded CFF encoding.
  238. */
  239. abstract static class EmbeddedEncoding extends CFFEncoding
  240. {
  241. @@ -1124,7 +1140,7 @@
  242. }
  243. /**
  244. - * Inner class representing a supplement for an encoding.
  245. + * Inner class representing a supplement for an encoding.
  246. */
  247. static class Supplement
  248. {
  249. @@ -1150,7 +1166,7 @@
  250. }
  251. /**
  252. - * Inner class representing a Format0 encoding.
  253. + * Inner class representing a Format0 encoding.
  254. */
  255. private static class Format0Encoding extends EmbeddedEncoding
  256. {
  257. @@ -1167,7 +1183,7 @@
  258. }
  259. /**
  260. - * Inner class representing a Format1 encoding.
  261. + * Inner class representing a Format1 encoding.
  262. */
  263. private static class Format1Encoding extends EmbeddedEncoding
  264. {
  265. @@ -1183,7 +1199,7 @@
  266. }
  267. /**
  268. - * Inner class representing a range of an encoding.
  269. + * Inner class representing a range of an encoding.
  270. */
  271. private static class Range1
  272. {
  273. @@ -1193,13 +1209,20 @@
  274. @Override
  275. public String toString()
  276. {
  277. - return getClass().getName() + "[first=" + first + ", nLeft=" + nLeft + "]";
  278. + return getClass().getName() + "[first=" + first + ", nLeft="
  279. + + nLeft + "]";
  280. }
  281. +
  282. + @Override
  283. + public boolean equals(Object obj) {
  284. + Range1 r = (Range1)obj;
  285. + return (first == r.first && nLeft == r.nLeft);
  286. + }
  287. }
  288. }
  289. /**
  290. - * Inner class representing an embedded CFF charset.
  291. + * Inner class representing an embedded CFF charset.
  292. */
  293. abstract static class EmbeddedCharset extends CFFCharset
  294. {
  295. @@ -1211,7 +1234,7 @@
  296. }
  297. /**
  298. - * Inner class representing a Format0 charset.
  299. + * Inner class representing a Format0 charset.
  300. */
  301. private static class Format0Charset extends EmbeddedCharset
  302. {
  303. @@ -1226,7 +1249,7 @@
  304. }
  305. /**
  306. - * Inner class representing a Format1 charset.
  307. + * Inner class representing a Format1 charset.
  308. */
  309. private static class Format1Charset extends EmbeddedCharset
  310. {
  311. @@ -1240,7 +1263,7 @@
  312. }
  313. /**
  314. - * Inner class representing a range of a charset.
  315. + * Inner class representing a range of a charset.
  316. */
  317. private static class Range1
  318. {
  319. @@ -1256,7 +1279,7 @@
  320. }
  321. /**
  322. - * Inner class representing a Format2 charset.
  323. + * Inner class representing a Format2 charset.
  324. */
  325. private static class Format2Charset extends EmbeddedCharset
  326. {
  327. @@ -1270,7 +1293,7 @@
  328. }
  329. /**
  330. - * Inner class representing a range of a charset.
  331. + * Inner class representing a range of a charset.
  332. */
  333. private static class Range2
  334. {
  335. @@ -1284,4 +1307,8 @@
  336. }
  337. }
  338. }
  339. +
  340. + public IndexData getStringIndex() {
  341. + return stringIndex;
  342. + }
  343. }
  344. Index: fontbox/src/main/java/org/apache/fontbox/cff/CFFFont.java
  345. ===================================================================
  346. --- fontbox/src/main/java/org/apache/fontbox/cff/CFFFont.java (revision 1546564)
  347. +++ fontbox/src/main/java/org/apache/fontbox/cff/CFFFont.java (working copy)
  348. @@ -31,7 +31,7 @@
  349. /**
  350. * This class represents a CFF/Type2 Font.
  351. - *
  352. + *
  353. * @author Villu Ruusmann
  354. * @version $Revision$
  355. */
  356. @@ -44,6 +44,8 @@
  357. private CFFEncoding fontEncoding = null;
  358. private CFFCharset fontCharset = null;
  359. private Map<String, byte[]> charStringsDict = new LinkedHashMap<String, byte[]>();
  360. + Map<Integer, Mapping> sidMappings = null;
  361. + ArrayList<Mapping> gidMappings = null;
  362. private IndexData globalSubrIndex = null;
  363. private IndexData localSubrIndex = null;
  364. @@ -97,6 +99,7 @@
  365. topDict.put(name, value);
  366. }
  367. }
  368. +
  369. /**
  370. * Returns the top dictionary.
  371. * @return the dictionary
  372. @@ -107,7 +110,7 @@
  373. }
  374. /**
  375. - * Adds the given key/value pair to the private dictionary.
  376. + * Adds the given key/value pair to the private dictionary.
  377. * @param name the given key
  378. * @param value the given value
  379. */
  380. @@ -118,7 +121,8 @@
  381. privateDict.put(name, value);
  382. }
  383. }
  384. - /**
  385. +
  386. + /**
  387. * Returns the private dictionary.
  388. * @return the dictionary
  389. */
  390. @@ -127,14 +131,60 @@
  391. return privateDict;
  392. }
  393. + /**
  394. + * Returns a mapping for a given GID
  395. + * @param GID The given GID
  396. + * @return The found mapping
  397. + */
  398. + public Mapping getMapping(int GID) {
  399. + return sidMappings.get(GID);
  400. + }
  401. +
  402. /**
  403. - * Get the mapping (code/SID/charname/bytes) for this font.
  404. - * @return mappings for codes < 256 and for codes > = 256
  405. - */
  406. - public Collection<Mapping> getMappings()
  407. + * Get the mapping (code/SID/charname/bytes) for this font.
  408. + * @return mappings for codes < 256 and for codes > = 256
  409. + */
  410. + public Collection<Mapping> getMappings() {
  411. + constructMappings();
  412. + return sidMappings.values();
  413. + }
  414. +
  415. + /**
  416. + * Gets the GID mappings list.
  417. + */
  418. + public ArrayList<Mapping> getGIDMappings() {
  419. + return gidMappings;
  420. + }
  421. +
  422. + private void constructGIDMap() {
  423. + gidMappings = new ArrayList<Mapping>();
  424. + Mapping notdef = new Mapping();
  425. + notdef.setName(".notdef");
  426. + gidMappings.add(notdef);
  427. + for (CFFCharset.Entry entry : fontCharset.getEntries())
  428. + {
  429. + String name = entry.getName();
  430. + byte[] bytes = this.charStringsDict.get(name);
  431. + if (bytes == null)
  432. + {
  433. + continue;
  434. + }
  435. + Mapping mapping = new Mapping();
  436. + mapping.setSID(entry.getSID());
  437. + mapping.setName(name);
  438. + mapping.setBytes(bytes);
  439. + gidMappings.add(mapping);
  440. + }
  441. + }
  442. +
  443. + /**
  444. + * Construct the mappings.
  445. + */
  446. + public void constructMappings()
  447. {
  448. - List<Mapping> mappings = new ArrayList<Mapping>();
  449. - Set<String> mappedNames = new HashSet<String>();
  450. + constructGIDMap();
  451. + sidMappings = new LinkedHashMap<Integer, Mapping>();
  452. + Set<String> mappedNames = new HashSet<String>();
  453. for (CFFEncoding.Entry entry : fontEncoding.getEntries())
  454. {
  455. String charName = fontCharset.getName(entry.getSID());
  456. @@ -153,7 +203,7 @@
  457. mapping.setSID(entry.getSID());
  458. mapping.setName(charName);
  459. mapping.setBytes(bytes);
  460. - mappings.add(mapping);
  461. + sidMappings.put(mapping.getSID(), mapping);
  462. mappedNames.add(charName);
  463. }
  464. if (fontEncoding instanceof CFFParser.EmbeddedEncoding)
  465. @@ -177,7 +227,7 @@
  466. mapping.setSID(supplement.getGlyph());
  467. mapping.setName(charName);
  468. mapping.setBytes(bytes);
  469. - mappings.add(mapping);
  470. + sidMappings.put(mapping.getSID(), mapping);
  471. mappedNames.add(charName);
  472. }
  473. }
  474. @@ -185,7 +235,7 @@
  475. int code = 256;
  476. for (CFFCharset.Entry entry : fontCharset.getEntries())
  477. {
  478. - String name = entry.getName();
  479. + String name = entry.getName();
  480. if (mappedNames.contains(name))
  481. {
  482. continue;
  483. @@ -201,11 +251,10 @@
  484. mapping.setName(name);
  485. mapping.setBytes(bytes);
  486. - mappings.add(mapping);
  487. + sidMappings.put(mapping.getSID(), mapping);
  488. mappedNames.add(name);
  489. }
  490. - return mappings;
  491. }
  492. /**
  493. @@ -215,34 +264,43 @@
  494. * @return -1 if the SID is missing from the Font.
  495. * @throws IOException
  496. */
  497. - public int getWidth(int SID) throws IOException {
  498. - int nominalWidth = privateDict.containsKey("nominalWidthX") ? ((Number)privateDict.get("nominalWidthX")).intValue() : 0;
  499. - int defaultWidth = privateDict.containsKey("defaultWidthX") ? ((Number)privateDict.get("defaultWidthX")).intValue() : 1000 ;
  500. -
  501. - for (Mapping m : getMappings() ){
  502. - if (m.getSID() == SID) {
  503. + public int getWidth(int SID) throws IOException {
  504. + int nominalWidth = privateDict.containsKey("nominalWidthX") ? ((Number) privateDict.get("nominalWidthX")).intValue() : 0;
  505. + int defaultWidth = privateDict.containsKey("defaultWidthX") ? ((Number) privateDict.get("defaultWidthX")).intValue() : 1000;
  506. + Mapping m = sidMappings.get(SID);
  507. + if (m != null) {
  508. + CharStringRenderer csr = getRendererForMapping(m);
  509. + // ---- If the CharString has a Width nominalWidthX must be added,
  510. + // otherwise it is the default width.
  511. + return csr.getWidth() != 0 ? csr.getWidth() + nominalWidth : defaultWidth;
  512. + }
  513. - CharStringRenderer csr = null;
  514. - if (((Number)getProperty("CharstringType")).intValue() == 2 ) {
  515. - List<Object> lSeq = m.toType2Sequence();
  516. - csr = new CharStringRenderer(false);
  517. - csr.render(lSeq);
  518. - } else {
  519. - List<Object> lSeq = m.toType1Sequence();
  520. - csr = new CharStringRenderer();
  521. - csr.render(lSeq);
  522. - }
  523. + // ---- SID Width not found, return the nodef width
  524. + return getNotDefWidth(defaultWidth, nominalWidth);
  525. + }
  526. - // ---- If the CharString has a Width nominalWidthX must be added,
  527. - // otherwise it is the default width.
  528. - return csr.getWidth() != 0 ? csr.getWidth() + nominalWidth : defaultWidth;
  529. - }
  530. - }
  531. + private CharStringRenderer getRendererForMapping(Mapping m) throws IOException {
  532. + CharStringRenderer csr = null;
  533. + if (((Number) getProperty("CharstringType")).intValue() == 2) {
  534. + List<Object> lSeq = m.toType2Sequence();
  535. + csr = new CharStringRenderer(false);
  536. + csr.render(lSeq);
  537. + } else {
  538. + List<Object> lSeq = m.toType1Sequence();
  539. + csr = new CharStringRenderer();
  540. + csr.render(lSeq);
  541. + }
  542. + return csr;
  543. + }
  544. - // ---- SID Width not found, return the nodef width
  545. - return getNotDefWidth(defaultWidth, nominalWidth);
  546. - }
  547. -
  548. + /**
  549. + * Returns the witdth of the .notdef character.
  550. + *
  551. + * @param defaultWidth default width
  552. + * @param nominalWidth nominal width
  553. + * @return the calculated width for the .notdef character
  554. + * @throws IOException if something went wrong
  555. + */
  556. protected int getNotDefWidth(int defaultWidth, int nominalWidth) throws IOException {
  557. CharStringRenderer csr;
  558. byte[] glyphDesc = this.getCharStringsDict().get(".notdef");
  559. @@ -260,6 +318,36 @@
  560. return csr.getWidth() != 0 ? csr.getWidth() + nominalWidth : defaultWidth;
  561. }
  562. + /**
  563. + * Return the Width value of the given Glyph identifier
  564. + *
  565. + * @param SID
  566. + * @return -1 if the SID is missing from the Font.
  567. + * @throws IOException
  568. + */
  569. + public int[] getBoundingBox(int SID) throws IOException {
  570. + Mapping m = sidMappings.get(SID);
  571. + if (m != null) {
  572. + CharStringRenderer csr = getRendererForMapping(m);
  573. + return csr.getBounds();
  574. + }
  575. + // ---- SID Width not found, return the nodef width
  576. + return new int[4];
  577. + }
  578. +
  579. + /**
  580. + * Gets the name of a character from the given SID
  581. + * @param SID The given SID
  582. + * @return The name of the found character
  583. + */
  584. + public String getNameOfCharFromCode(int SID) {
  585. + if (sidMappings.get(SID) != null) {
  586. + return sidMappings.get(SID).getName();
  587. + } else {
  588. + return "";
  589. + }
  590. + }
  591. +
  592. /**
  593. * Returns the CFFEncoding of the font.
  594. * @return the encoding
  595. @@ -336,50 +424,51 @@
  596. + charStringsDict + "]";
  597. }
  598. + /**
  599. + * Sets the global subroutine index data.
  600. + * @param globalSubrIndex the IndexData object containing the global subroutines
  601. + */
  602. + public void setGlobalSubrIndex(IndexData globalSubrIndexValue) {
  603. + globalSubrIndex = globalSubrIndexValue;
  604. + }
  605. - /**
  606. - * Sets the global subroutine index data.
  607. - * @param globalSubrIndex the IndexData object containing the global subroutines
  608. - */
  609. - public void setGlobalSubrIndex(IndexData globalSubrIndex) {
  610. - this.globalSubrIndex = globalSubrIndex;
  611. - }
  612. + /**
  613. + * Returns the global subroutine index data.
  614. + * @return the dictionary
  615. + */
  616. + public IndexData getGlobalSubrIndex()
  617. + {
  618. + return globalSubrIndex;
  619. + }
  620. - /**
  621. - * Returns the global subroutine index data.
  622. - * @return the dictionary
  623. - */
  624. - public IndexData getGlobalSubrIndex() {
  625. - return globalSubrIndex;
  626. - }
  627. + /**
  628. + * Returns the local subroutine index data.
  629. + * @return the dictionary
  630. + */
  631. + public IndexData getLocalSubrIndex()
  632. + {
  633. + return localSubrIndex;
  634. + }
  635. - /**
  636. - * Returns the local subroutine index data.
  637. - * @return the dictionary
  638. - */
  639. - public IndexData getLocalSubrIndex() {
  640. - return localSubrIndex;
  641. - }
  642. + /**
  643. + * Sets the local subroutine index data.
  644. + * @param localSubrIndexValue the IndexData object containing the local subroutines
  645. + */
  646. + public void setLocalSubrIndex(IndexData localSubrIndexValue) {
  647. + localSubrIndex = localSubrIndexValue;
  648. + }
  649. - /**
  650. - * Sets the local subroutine index data.
  651. - * @param localSubrIndex the IndexData object containing the local subroutines
  652. - */
  653. - public void setLocalSubrIndex(IndexData localSubrIndex) {
  654. - this.localSubrIndex = localSubrIndex;
  655. - }
  656. + /**
  657. + * This class is used for the font mapping.
  658. + *
  659. + */
  660. + public class Mapping
  661. + {
  662. + private int mappedCode;
  663. + private int mappedSID;
  664. + private String mappedName;
  665. + private byte[] mappedBytes;
  666. - /**
  667. - * This class is used for the font mapping.
  668. - *
  669. - */
  670. - public class Mapping
  671. - {
  672. - private int mappedCode;
  673. - private int mappedSID;
  674. - private String mappedName;
  675. - private byte[] mappedBytes;
  676. -
  677. /**
  678. * Converts the mapping into a Type1-sequence.
  679. * @return the Type1-sequence
  680. @@ -458,4 +547,4 @@
  681. this.mappedBytes = bytes;
  682. }
  683. }
  684. -}
  685. \ No newline at end of file
  686. +}