You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by SASAKI Suguru <s-...@hkg.odn.ne.jp> on 2001/07/12 04:34:23 UTC

[PATCH] Not all glyph is loaded when two or more char are mapped to one glyph

Hi, fop-team.

Current org.apache.fop.fonts.TTFFile dosen't load all glyph data
when two or more character is mapped to one glyph.
(In fact, Bitstream Cybetbit font has mapped many characters to
missingGlyph (glyphIndex = 0)).
Some character dosen't appear in outputs because of this.

This pacth will fix this problem.

=======
SASAKI Suguru
  mailto : s-sasaki@hkg.odn.ne.jp



--- src/org/apache/fop/fonts/TTFFile.java.orig	Tue Apr 17 01:07:30 2001
+++ src/org/apache/fop/fonts/TTFFile.java	Thu Jul 12 01:37:20 2001
@@ -200,13 +200,14 @@
                         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() +
+                            glyphIdx = (in.readTTFUShort() +
                                             cmap_deltas[i]) & 0xffff;
 
                             unicodeMapping.addElement(
@@ -254,7 +255,7 @@
                         }
                         else {
 
-                            int glyphIdx = (j + cmap_deltas[i]) & 0xffff;
+                            glyphIdx = (j + cmap_deltas[i]) & 0xffff;
 
                             if (glyphIdx < mtx_tab.length)
                                 mtx_tab[glyphIdx] .unicodeIndex.addElement(
@@ -308,7 +309,11 @@
                                 mtx_tab[(j+cmap_deltas[i]) & 0xffff].name);
                               */
                         }
-                        mtxPtr++;
+                        if (glyphIdx < mtx_tab.length){
+                            if(mtx_tab[glyphIdx] .unicodeIndex.size() < 2){
+                                mtxPtr++;
+                            }
+                        }
                     }
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: [PATCH] Not all glyph is loaded when two or more char are mapped to one glyph

Posted by Tore Engvig <te...@manamind.com>.
Thanks for the patch!
I just added it to cvs.

Tore


On Thu, 12 Jul 2001, SASAKI Suguru wrote:

>
> Hi, fop-team.
>
> Current org.apache.fop.fonts.TTFFile dosen't load all glyph data
> when two or more character is mapped to one glyph.
> (In fact, Bitstream Cybetbit font has mapped many characters to
> missingGlyph (glyphIndex = 0)).
> Some character dosen't appear in outputs because of this.
>
> This pacth will fix this problem.
>
> =======
> SASAKI Suguru
>   mailto : s-sasaki@hkg.odn.ne.jp
>
>
>
> --- src/org/apache/fop/fonts/TTFFile.java.orig	Tue Apr 17 01:07:30 2001
> +++ src/org/apache/fop/fonts/TTFFile.java	Thu Jul 12 01:37:20 2001
> @@ -200,13 +200,14 @@
>                          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() +
> +                            glyphIdx = (in.readTTFUShort() +
>                                              cmap_deltas[i]) & 0xffff;
>
>                              unicodeMapping.addElement(
> @@ -254,7 +255,7 @@
>                          }
>                          else {
>
> -                            int glyphIdx = (j + cmap_deltas[i]) & 0xffff;
> +                            glyphIdx = (j + cmap_deltas[i]) & 0xffff;
>
>                              if (glyphIdx < mtx_tab.length)
>                                  mtx_tab[glyphIdx] .unicodeIndex.addElement(
> @@ -308,7 +309,11 @@
>                                  mtx_tab[(j+cmap_deltas[i]) & 0xffff].name);
>                                */
>                          }
> -                        mtxPtr++;
> +                        if (glyphIdx < mtx_tab.length){
> +                            if(mtx_tab[glyphIdx] .unicodeIndex.size() < 2){
> +                                mtxPtr++;
> +                            }
> +                        }
>                      }
>                  }
>              }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org