bugm17n - Bugs: bug #44584, Overzealous Checks Break Fonts

 
 

bug #44584: Overzealous Checks Break Fonts

Submitter:  None
Submitted:  Fri 20 Mar 2015 01:01:08 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  handa
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 15 May 2023 06:50:00 PM UTC, comment #5: 

As this seems to be fixed in the libotf-0.9.16

http://download.savannah.nongnu.org/releases/m17n/libotf-0.9.16.tar.gz

I think this can be closed.

Mike FABIAN <mike_fabian>
Group Member
Mon 15 May 2023 06:46:18 PM UTC, comment #4: 

Output of `cvs diff -u -r 1.64 -r 1.65`:


Index: ChangeLog
===================================================================
RCS file: /sources/m17n/libotf/ChangeLog,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- ChangeLog        27 Jan 2006 07:11:07 -0000        1.64
+++ ChangeLog        7 Feb 2006 12:50:22 -0000        1.65
@@ -1,3 +1,7 @@
+2006-02-07  Kenichi Handa  <handa@m17n.org>
+
+        * example/otfview.c (DumpProc): Fix calculation of x/y offsets.
+
 2006-01-27  Kenichi Handa  <handa@m17n.org>

         * example/otfview.c (DumpProc): Completely re-written to produce
Index: example/otfview.c
===================================================================
RCS file: /sources/m17n/libotf/example/otfview.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- example/otfview.c        18 Nov 2009 06:44:12 -0000        1.64
+++ example/otfview.c        18 Nov 2009 06:45:48 -0000        1.65
@@ -538,7 +538,7 @@
       for (i = 1, x = 4; i < gstring.used; i++, x += 5)
         sprintf (buf + x, " %04X", gstring.glyphs[i].glyph_id);
       while (x < size)
-        buf[x] = ' ';
+        buf[x++] = ' ';
       buf[x] = '\0';
       XtSetArg (arg[0], XtNlabel, buf);
       XtSetValues (code_list, arg, 1);
Index: src/otfdrive.c
===================================================================
RCS file: /sources/m17n/libotf/src/otfdrive.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- src/otfdrive.c        22 Dec 2008 10:46:26 -0000        1.64
+++ src/otfdrive.c        23 Dec 2008 01:07:02 -0000        1.65
@@ -1294,7 +1294,7 @@
         gstring->glyphs[i].glyph_id = 0;
       for (j = 0; j < segCount; j++)
         {
-          OTF_cmapSegument *seg = sub4->segments + i;
+          OTF_cmapSegment *seg = sub4->segments + i;

           if (c >= seg->startCount && c <= seg->endCount)
             {
Index: src/otfopen.c
===================================================================
RCS file: /sources/m17n/libotf/src/otfopen.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- src/otfopen.c        17 Mar 2014 13:36:52 -0000        1.64
+++ src/otfopen.c        27 Mar 2015 06:14:46 -0000        1.65
@@ -1424,18 +1424,16 @@
 
 /*** (1-8) Structures common to GSUB and GPOS */

-static unsigned
+static int
 read_lookup_record_list (OTF *otf, OTF_Stream *stream,
                          OTF_LookupRecord **record, int count)
 {
   char *errfmt = "LookupRecord%s";
-  unsigned errret = 0;
+  int errret = -1;
   int i;

   if (count < 0)
     READ_UINT16 (stream, count);
-  if (! count)
-    OTF_ERROR (OTF_ERROR_TABLE, " (zero count)");
   OTF_MALLOC (*record, count, "");
   for (i = 0; i < count; i++)
     {
@@ -1476,7 +1474,7 @@
                           (*rule)[i].GlyphCount) < 0)
         return errret;
       if (read_lookup_record_list (otf, stream, &(*rule)[i].LookupRecord,
-                                   (*rule)[i].LookupCount) == 0)
+                                   (*rule)[i].LookupCount) < 0)
         return errret;
     }
   RESTORE_STREAM (stream, state);
@@ -1550,7 +1548,7 @@
                           0, (*rule)[i].GlyphCount - 1) < 0)
         return errret;
       if (read_lookup_record_list (otf, stream, &(*rule)[i].LookupRecord,
-                                   (*rule)[i].LookupCount) == 0)
+                                   (*rule)[i].LookupCount) < 0)
         return errret;
     }
   RESTORE_STREAM (stream, state);
@@ -1606,6 +1604,8 @@
     READ_OFFSET (stream, (*rule)[i].offset);
   for (i = 0; i < count; i++)
     {
+      int lookup_record_count;
+
       SEEK_STREAM (stream, offset + (*rule)[i].offset);
       (*rule)[i].BacktrackGlyphCount
         = read_glyph_ids (otf, stream, &(*rule)[i].Backtrack, 0, -1);
@@ -1615,11 +1615,12 @@
         OTF_ERROR (OTF_ERROR_TABLE, " (zero count)");
       (*rule)[i].LookaheadGlyphCount
         = read_glyph_ids (otf, stream, &(*rule)[i].LookAhead, 0, -1);
-      (*rule)[i].LookupCount
+      lookup_record_count
         = read_lookup_record_list (otf, stream,
                                    &(*rule)[i].LookupRecord, -1);
-      if (! (*rule)[i].LookupCount)
+      if (lookup_record_count < 0)
         return errret;
+      (*rule)[i].LookupCount = lookup_record_count;
     }
   return count;
 }
@@ -1680,6 +1681,8 @@
     }
   for (i = 0; i < count; i++)
     {
+      int lookup_record_count;
+
       SEEK_STREAM (stream, offset + (*rule)[i].offset);
       (*rule)[i].BacktrackGlyphCount
         = read_glyph_ids (otf, stream,
@@ -1692,11 +1695,12 @@
       (*rule)[i].LookaheadGlyphCount
         = read_glyph_ids (otf, stream,
                           (OTF_GlyphID **) &(*rule)[i].LookAhead, 0, -1);
-      (*rule)[i].LookupCount
+      lookup_record_count
         = read_lookup_record_list (otf, stream,
                                    &(*rule)[i].LookupRecord, -1);
-      if (! (*rule)[i].LookupCount)
+      if (lookup_record_count < 0)
         return errret;
+      (*rule)[i].LookupCount = lookup_record_count;
     }
   return count;
 }
@@ -1834,9 +1838,11 @@
   count = read_coverage_list (otf, stream, offset,
                               &chain_context3->LookAhead, -1);
   chain_context3->LookaheadGlyphCount = (unsigned) count;
-  chain_context3->LookupCount
-    = read_lookup_record_list (otf, stream,
-                               &chain_context3->LookupRecord, -1);
+  count = read_lookup_record_list (otf, stream,
+                                   &chain_context3->LookupRecord, -1);
+  if (count < 0)
+    return -1;
+  chain_context3->LookupCount = count;
   return 0;
 }


Mike FABIAN <mike_fabian>
Group Member
Mon 15 May 2023 06:35:31 PM UTC, comment #3: 

----------------------------
revision 1.65
date: 2015-03-27 06:14:46 +0000;  author: handa;  state: Exp;  lines: +19 -13;  commitid: gaRCp1pBnYJR1dfy;
src/otfopen.c (read_lookup_record_list): Type changed to int.
Return -1 on error.
(read_rule_list, read_class_rule_list, read_chain_rule_list)
(read_chain_class_rule_list, read_chain_context3): Adjusted for
----------------------------

Mike FABIAN <mike_fabian>
Group Member
Mon 15 May 2023 06:26:00 PM UTC, comment #2: 

2015-03-27  K. Handa  <handa@gnu.org>

        * src/otfopen.c (read_lookup_record_list): Type changed to int.
        Return -1 on error.
        (read_rule_list, read_class_rule_list, read_chain_rule_list)
        (read_chain_class_rule_list, read_chain_context3): Adjusted for
        the above change.

Mike FABIAN <mike_fabian>
Group Member
Fri 27 Mar 2015 09:01:51 AM UTC, comment #1: 

Thank you for the bug report.  I've just committed a fix for read_lookup_record_list().  Please try the code in the latest CVS repository.

Kenichi Handa <handa>
Group administrator
Fri 20 Mar 2015 01:01:08 AM UTC, original submission:  

If read_lookup_record_list() in oftopen.c in package libotf returns zero, no further lookups will be read.  However, for a given input sequence of glyphs or classes of glyphs it is perfectly reasonable for no lookups to be invoked in response to a particular combination of backtrack and lookahead glyphs; this specifies that no action is to be taken in this case, whereas it may be taken for more general combinations of backtrack and lookahead glyphs.

Indeed, for modularity when trying out various techniques to achieve the same effect, one might create a subtable which effects no changes but merely inhibits other subtables of the same chained context table.  I did this with a font that works reasonably well both on Windows and with HarfBuzz; only when I tried using it with Emacs (and thus m17n) did I encounter problems.

It is possible to work around this with one's own font by adding nugatory lookups (e.g. to replace the first input character by itself).


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mike_fabian (Posted a comment)
  • -email is unavailable- added by handa (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-05-15 mike_fabian Open/ClosedOpen Closed
    2015-03-27 handa StatusNone Fixed
        Assigned toNone handa

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code