cvs commit: xml-fop/src/org/apache/fop/fonts TTFFile.java

2003-01-21 Thread jeremias
jeremias2003/01/21 02:43:56

  Modified:src/org/apache/fop/fonts Tag: fop-0_20_2-maintain
TTFFile.java
  Log:
  Fix for bug 16257 (bad ascender/descender in XML font metrics)
  Ascender and Descender are now read from the OS/2 table if the values in the hhea 
table are zero.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.6.2.7   +15 -4 xml-fop/src/org/apache/fop/fonts/Attic/TTFFile.java
  
  Index: TTFFile.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/Attic/TTFFile.java,v
  retrieving revision 1.6.2.6
  retrieving revision 1.6.2.7
  diff -u -r1.6.2.6 -r1.6.2.7
  --- TTFFile.java  9 Jan 2003 13:47:25 -   1.6.2.6
  +++ TTFFile.java  21 Jan 2003 10:43:56 -  1.6.2.7
  @@ -68,6 +68,8 @@
   int ansiWidth[];
   HashMap ansiIndex;
   
  +private TTFDirTabEntry currentDirTab;
  +
   /**
* Position inputstream to position indicated
* in the dirtab offset + offset
  @@ -77,10 +79,10 @@
   TTFDirTabEntry dt = (TTFDirTabEntry)dirTabs.get(name);
   if (dt == null) {
   System.out.println("Dirtab " + name + " not found.");
  -return;
  +} else {
  +in.seek_set(dt.offset + offset);
  +this.currentDirTab = dt;
   }
  -
  -in.seek_set(dt.offset + offset);
   }
   
   /**
  @@ -638,6 +640,15 @@
   in.skip(2 + 2 + 3 * 2 + 8 * 2);
   nhmtx = in.readTTFUShort();
   // System.out.println("Number of horizontal metrics: " + nhmtx);
  +
  +//Check OS/2 table for ascender/descender if necessary
  +if (ascender == 0 || descender == 0) {
  +seek_tab(in, "OS/2", 68);
  +if (this.currentDirTab.length >= 78) {
  +ascender = in.readTTFShort(); //sTypoAscender
  +descender = in.readTTFShort(); //sTypoDescender
  +}
  +}
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




cvs commit: xml-fop/src/org/apache/fop/fonts TTFFile.java TTFMtxEntry.java

2003-01-09 Thread jeremias
jeremias2003/01/09 05:47:26

  Modified:.Tag: fop-0_20_2-maintain CHANGES
   src/org/apache/fop/fonts Tag: fop-0_20_2-maintain
TTFFile.java TTFMtxEntry.java
  Log:
  Fixed bug #15877: ArrayIndexOutOfBoundException with certain TrueType fonts.
  Reserved name indexes were not ignored.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.10.2.38 +2 -0  xml-fop/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /home/cvs/xml-fop/CHANGES,v
  retrieving revision 1.10.2.37
  retrieving revision 1.10.2.38
  diff -u -r1.10.2.37 -r1.10.2.38
  --- CHANGES   11 Dec 2002 14:43:15 -  1.10.2.37
  +++ CHANGES   9 Jan 2003 13:47:25 -   1.10.2.38
  @@ -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 <[EMAIL PROTECTED]> (see bug #14948)
   - Fixed infinite loop when page-height="auto" (Oleg Tkachenko)
  
  
  
  No   revision
  
  
  No   revision
  
  
  1.6.2.6   +11 -9 xml-fop/src/org/apache/fop/fonts/Attic/TTFFile.java
  
  Index: TTFFile.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/Attic/TTFFile.java,v
  retrieving revision 1.6.2.5
  retrieving revision 1.6.2.6
  diff -u -r1.6.2.5 -r1.6.2.6
  --- TTFFile.java  29 Nov 2002 09:26:59 -  1.6.2.5
  +++ TTFFile.java  9 Jan 2003 13:47:25 -   1.6.2.6
  @@ -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 @@
   // " Encoding: "+cmap_eid);
   
   if (cmap_pid == 3 && cmap_eid == 1) {
  -cmap_unioffset = cmap_offset; 
  +cmap_unioffset = cmap_offset;
   }
   }
   
  @@ -731,12 +731,14 @@
   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];
  +}
   }
   }
   
  
  
  
  1.4.2.3   +34 -4 xml-fop/src/org/apache/fop/fonts/Attic/TTFMtxEntry.java
  
  Index: TTFMtxEntry.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/Attic/TTFMtxEntry.java,v
  retrieving revision 1.4.2.2
  retrieving revision 1.4.2.3
  diff -u -r1.4.2.2 -r1.4.2.3
  --- TTFMtxEntry.java  19 Nov 2002 01:04:06 -  1.4.2.2
  +++ TTFMtxEntry.java  9 Jan 2003 13:47:26 -   1.4.2.3
  @@ -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 @@
   }
   
   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 r

cvs commit: xml-fop/src/org/apache/fop/fonts TTFFile.java

2002-11-29 Thread jeremias
jeremias2002/11/29 01:27:00

  Modified:src/org/apache/fop/fonts Tag: fop-0_20_2-maintain
TTFFile.java
  Log:
  fixed (possibly) a problem where certain fonts had a range value for the last 
character causing it to try to get invalid info also handles the lack of support for 
non-unicode cmap tables better.
  Submitted by: Keiron Liddle
  
  Some style improvements.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.6.2.5   +86 -63xml-fop/src/org/apache/fop/fonts/TTFFile.java
  
  Index: TTFFile.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/TTFFile.java,v
  retrieving revision 1.6.2.4
  retrieving revision 1.6.2.5
  diff -u -r1.6.2.4 -r1.6.2.5
  --- TTFFile.java  5 Nov 2002 07:53:48 -   1.6.2.4
  +++ TTFFile.java  29 Nov 2002 09:26:59 -  1.6.2.5
  @@ -137,8 +137,9 @@
   // System.out.println("Platform ID: "+cmap_pid+
   // " Encoding: "+cmap_eid);
   
  -if (cmap_pid == 3 && cmap_eid == 1)
  -cmap_unioffset = cmap_offset;
  +if (cmap_pid == 3 && cmap_eid == 1) {
  +cmap_unioffset = cmap_offset; 
  +}
   }
   
   if (cmap_unioffset <= 0) {
  @@ -185,7 +186,7 @@
   cmap_deltas[i] = in.readTTFShort();
   }
   
  -int startRangeOffset = in.getCurrentPos();
  +//int startRangeOffset = in.getCurrentPos();
   
   for (int i = 0; i < (cmap_segCountX2 / 2); i++) {
   cmap_rangeOffsets[i] = in.readTTFUShort();
  @@ -205,12 +206,15 @@
   j++) {
   
   // Update lastChar
  -if (j < 256 && j > lastChar)
  +if (j < 256 && j > lastChar) {
   lastChar = (short)j;
  +}
   
   if (mtxPtr < mtx_tab.length) {
   int glyphIdx;
  -if (cmap_rangeOffsets[i] != 0) {
  +// the last character 65535 = .notdef
  +// may have a range offset
  +if (cmap_rangeOffsets[i] != 0 && j != 65535) {
   int glyphOffset =
   glyphIdArrayOffset
   + ((cmap_rangeOffsets[i] / 2) + (j - 
cmap_startCounts[i]) + (i) - cmap_segCountX2 / 2)
  @@ -222,21 +226,20 @@
   unicodeMapping.add(new UnicodeMapping(glyphIdx, j));
   mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
   // Also add winAnsiWidth
  -ArrayList v =
  -(ArrayList)ansiIndex.get(new Integer(j));
  -if (v != null) {
  -for (int k = 0; k < v.size(); k++ ) {
  -Integer aIdx = (Integer)v.get(k);
  -ansiWidth[aIdx.intValue()] =
  -mtx_tab[glyphIdx].wx;
  -/*
  - * System.out.println("Added width "+
  - * mtx_tab[glyphIdx].wx +
  - * " uni: " + j +
  - * " ansi: " + aIdx.intValue());
  - */
  -}
  -}
  +ArrayList v = (ArrayList)ansiIndex.get(new Integer(j));
  +if (v != null) {
  +for (int k = 0; k < v.size(); k++ ) {
  +Integer aIdx = (Integer)v.get(k);
  +ansiWidth[aIdx.intValue()] =
  +mtx_tab[glyphIdx].wx;
  +/*
  + * System.out.println("Added width "+
  + * mtx_tab[glyphIdx].wx +
  + * " uni: " + j +
  + * " ansi: " + aIdx.intValue());
  + */
  +}
  +}
   /*
* System.out.println("Idx: "+
* glyphIdx +
  @@ -250,34 +253,35 @@
   
   glyphIdx = (j + cmap_deltas[i]) & 0x;
   
  -if (glyphIdx < mtx_tab.length)
  +if (glyphIdx < mtx_tab.length) {
   mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
  -else
  +} else {
   System.out.println("Glyph " + glyphIdx
  + " out of range: "
   

cvs commit: xml-fop/src/org/apache/fop/fonts TTFFile.java

2001-07-17 Thread tore

tore01/07/17 13:57:49

  Modified:src/org/apache/fop/fonts TTFFile.java
  Log:
  Submitted by: SASAKI Suguru ([EMAIL PROTECTED])
  Some glyphs are missed when more then one glyph maps to the same data,
  this patch fixes it.
  
  Revision  ChangesPath
  1.5   +10 -5 xml-fop/src/org/apache/fop/fonts/TTFFile.java
  
  Index: TTFFile.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/TTFFile.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TTFFile.java  2001/04/16 16:07:30 1.4
  +++ TTFFile.java  2001/07/17 20:57:47 1.5
  @@ -1,4 +1,4 @@
  -/* -- $Id: TTFFile.java,v 1.4 2001/04/16 16:07:30 tore Exp $ --
  +/* -- $Id: TTFFile.java,v 1.5 2001/07/17 20:57:47 tore Exp $ --
*
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
  @@ -200,14 +200,15 @@
   lastChar = (short) j;
   
   if (mtxPtr < mtx_tab.length) {
  +int glyphIdx;
   if (cmap_rangeOffsets[i] != 0) {
   int glyphOffset = glyphIdArrayOffset +
 ((cmap_rangeOffsets[i] / 2) +
  (j - cmap_startCounts[i]) + (i) -
  cmap_segCountX2 / 2) * 2;
   in.seek_set(glyphOffset);
  -int glyphIdx = (in.readTTFUShort() +
  -cmap_deltas[i]) & 0x;
  +glyphIdx = (in.readTTFUShort() +
  +cmap_deltas[i]) & 0x;
   
   unicodeMapping.addElement(
 new UnicodeMapping(glyphIdx, j));
  @@ -254,7 +255,7 @@
   }
   else {
   
  -int glyphIdx = (j + cmap_deltas[i]) & 0x;
  +glyphIdx = (j + cmap_deltas[i]) & 0x;
   
   if (glyphIdx < mtx_tab.length)
   mtx_tab[glyphIdx] .unicodeIndex.addElement(
  @@ -308,7 +309,11 @@
   mtx_tab[(j+cmap_deltas[i]) & 0x].name);
 */
   }
  -mtxPtr++;
  +if (glyphIdx < mtx_tab.length) {
  +if (mtx_tab[glyphIdx].unicodeIndex.size() < 2) {
  +mtxPtr++;
  +}
  +}
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]