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