freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 3481b1544: [truetype] Reset cvt and storage in contex


From: Werner Lemberg
Subject: [freetype2] master 3481b1544: [truetype] Reset cvt and storage in context load.
Date: Sat, 7 Jan 2023 01:31:46 -0500 (EST)

branch: master
commit 3481b154430faea9f6b4002519e60a8ad8ebe8d8
Author: Ben Wagner <bungeman@chromium.org>
Commit: Werner Lemberg <wl@gnu.org>

    [truetype] Reset cvt and storage in context load.
    
    Currently the cvt and storage are saved and restored in `TT_RunIns`.
    However, this is too granular as the cvt and storage area should be set to
    the original cvt and storage area only when setting up the hinting context.
    This allows for the cvt and storage area to be modified while parsing
    multiple glyphs, as is the case with composite glyphs.
    
    * src/truetype/ttinterp.h (TT_ExecContextRec): Remove `origCvt` and
    `origStorage`.
    
    * src/truetype/ttinterp.c (TT_RunIns): Don't save and restore the cvt and
    storage area.
    (Modify_CVT_Check, Ins_WS): Switch from "if in glyph and using original data
    do copy on write" to "if in glyph and not using glyph specific data do copy
    on write".
---
 src/truetype/ttinterp.c | 15 ++-------------
 src/truetype/ttinterp.h |  2 --
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 2ddeee36d..6888166f1 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -1527,9 +1527,8 @@
   static void
   Modify_CVT_Check( TT_ExecContext  exc )
   {
-    /* TT_RunIns sets origCvt and restores cvt to origCvt when done. */
     if ( exc->iniRange == tt_coderange_glyph &&
-         exc->cvt == exc->origCvt            )
+         exc->cvt != exc->glyfCvt            )
     {
       exc->error = Update_Max( exc->memory,
                                &exc->glyfCvtSize,
@@ -3115,10 +3114,8 @@
     }
     else
     {
-      /* TT_RunIns sets origStorage and restores storage to origStorage */
-      /* when done.                                                     */
       if ( exc->iniRange == tt_coderange_glyph &&
-           exc->storage == exc->origStorage    )
+           exc->storage != exc->glyfStorage    )
       {
         FT_ULong  tmp = (FT_ULong)exc->glyfStoreSize;
 
@@ -7832,8 +7829,6 @@
       exc->func_move_cvt  = Move_CVT;
     }
 
-    exc->origCvt     = exc->cvt;
-    exc->origStorage = exc->storage;
     exc->iniRange    = exc->curRange;
 
     Compute_Funcs( exc );
@@ -8594,9 +8589,6 @@
                 ins_counter,
                 ins_counter == 1 ? "" : "s" ));
 
-    exc->cvt     = exc->origCvt;
-    exc->storage = exc->origStorage;
-
     return FT_Err_Ok;
 
   LErrorCodeOverflow_:
@@ -8606,9 +8598,6 @@
     if ( exc->error && !exc->instruction_trap )
       FT_TRACE1(( "  The interpreter returned error 0x%x\n", exc->error ));
 
-    exc->cvt     = exc->origCvt;
-    exc->storage = exc->origStorage;
-
     return exc->error;
   }
 
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 48f618dc9..02199fc0c 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -193,7 +193,6 @@ FT_BEGIN_HEADER
     FT_Long*           cvt;       /* ! */
     FT_ULong           glyfCvtSize;
     FT_Long*           glyfCvt;   /* cvt working copy for glyph */
-    FT_Long*           origCvt;
 
     FT_UInt            glyphSize; /* ! glyph instructions buffer size */
     FT_Byte*           glyphIns;  /* ! glyph instructions buffer      */
@@ -224,7 +223,6 @@ FT_BEGIN_HEADER
     FT_Long*           storage;      /* ! storage area            */
     FT_UShort          glyfStoreSize;
     FT_Long*           glyfStorage;  /* storage working copy for glyph */
-    FT_Long*           origStorage;
 
     FT_F26Dot6         period;     /* values used for the */
     FT_F26Dot6         phase;      /* `SuperRounding'     */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]