Browse Source

Fixed bug #15877: ArrayIndexOutOfBoundException with certain TrueType fonts.

Reserved name indexes were not ignored.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195837 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_20_5rc2
Jeremias Maerki 21 years ago
parent
commit
c9c36a1a4d
3 changed files with 45 additions and 11 deletions
  1. 2
    0
      CHANGES
  2. 10
    8
      src/org/apache/fop/fonts/TTFFile.java
  3. 33
    3
      src/org/apache/fop/fonts/TTFMtxEntry.java

+ 2
- 0
CHANGES View File

@@ -1,5 +1,7 @@
==============================================================================
Done since 0.20.4 release
- Fixed bug #15877: ArrayIndexOutOfBoundException with certain TrueType fonts.
Reserved name indexes were not ignored. (Jeremias Maerki)
- Fixed resolution of relative URLs in FopImageFactory with IBM JDK
Submitted by: Manuel Mall <mm@arcus.com.au> (see bug #14948)
- Fixed infinite loop when page-height="auto" (Oleg Tkachenko)

+ 10
- 8
src/org/apache/fop/fonts/TTFFile.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -138,7 +138,7 @@ public class TTFFile {
// " Encoding: "+cmap_eid);

if (cmap_pid == 3 && cmap_eid == 1) {
cmap_unioffset = cmap_offset;
cmap_unioffset = cmap_offset;
}
}

@@ -731,12 +731,14 @@ public class TTFFile {
mtx_tab[i].name =
Glyphs.mac_glyph_names[mtx_tab[i].index];
} else {
k = mtx_tab[i].index - NMACGLYPHS;
/*
* System.out.println(k+" i="+i+" mtx="+mtx_tab.length+
* " ps="+ps_glyphs_buf.length);
*/
mtx_tab[i].name = ps_glyphs_buf[k];
if (!mtx_tab[i].isIndexReserved()) {
k = mtx_tab[i].index - NMACGLYPHS;
/*
* System.out.println(k+" i="+i+" mtx="+mtx_tab.length+
* " ps="+ps_glyphs_buf.length);
*/
mtx_tab[i].name = ps_glyphs_buf[k];
}
}
}


+ 33
- 3
src/org/apache/fop/fonts/TTFMtxEntry.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
@@ -28,12 +28,42 @@ class TTFMtxEntry {
}

public String toString(TTFFile t) {
return new String("Glyph " + name + " index: " + index + " bbox [ "
return new String("Glyph " + name + " index: " + getIndexAsString() + " bbox ["
+ t.get_ttf_funit(bbox[0]) + " "
+ t.get_ttf_funit(bbox[1]) + " "
+ t.get_ttf_funit(bbox[2]) + " "
+ t.get_ttf_funit(bbox[3]) + "]" + "wx: "
+ t.get_ttf_funit(bbox[3]) + "] wx: "
+ t.get_ttf_funit(wx));
}

/**
* Returns the index.
* @return int
*/
public int getIndex() {
return index;
}

/**
* Determines whether this index represents a reserved character.
* @return True if it is reserved
*/
public boolean isIndexReserved() {
return (getIndex() >= 32768) && (getIndex() <= 65535);
}

/**
* Returns a String representation of the index taking into account if
* the index is in the reserved range.
* @return index as String
*/
public String getIndexAsString() {
if (isIndexReserved()) {
return Integer.toString(getIndex()) + " (reserved)";
} else {
return Integer.toString(getIndex());
}
}


}

Loading…
Cancel
Save