freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [pcf] Delay encoding allocation and avo


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [pcf] Delay encoding allocation and avoid its zeroing.
Date: Wed, 26 Jan 2022 16:27:20 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • src/pcf/pcfread.c
    ... ... @@ -1034,16 +1034,6 @@ THE SOFTWARE.
    1034 1034
              enc->lastRow  > 0xFF         )
    
    1035 1035
           return FT_THROW( Invalid_Table );
    
    1036 1036
     
    
    1037
    -    nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) *
    
    1038
    -                (FT_ULong)( enc->lastRow - enc->firstRow + 1 );
    
    1039
    -
    
    1040
    -    if ( FT_NEW_ARRAY( enc->offset, nencoding ) )
    
    1041
    -      goto Bail;
    
    1042
    -
    
    1043
    -    error = FT_Stream_EnterFrame( stream, 2 * nencoding );
    
    1044
    -    if ( error )
    
    1045
    -      goto Exit;
    
    1046
    -
    
    1047 1037
         FT_TRACE5(( "\n" ));
    
    1048 1038
     
    
    1049 1039
         defaultCharRow = enc->defaultChar >> 8;
    
    ... ... @@ -1064,6 +1054,13 @@ THE SOFTWARE.
    1064 1054
           defaultCharCol = enc->firstCol;
    
    1065 1055
         }
    
    1066 1056
     
    
    1057
    +    nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) *
    
    1058
    +                (FT_ULong)( enc->lastRow - enc->firstRow + 1 );
    
    1059
    +
    
    1060
    +    error = FT_Stream_EnterFrame( stream, 2 * nencoding );
    
    1061
    +    if ( error )
    
    1062
    +      goto Bail;
    
    1063
    +
    
    1067 1064
         /*
    
    1068 1065
          * FreeType mandates that glyph index 0 is the `undefined glyph', which
    
    1069 1066
          * PCF calls the `default character'.  However, FreeType needs glyph
    
    ... ... @@ -1109,6 +1106,9 @@ THE SOFTWARE.
    1109 1106
         /* copy metrics of default character to index 0 */
    
    1110 1107
         face->metrics[0] = face->metrics[defaultCharEncodingOffset];
    
    1111 1108
     
    
    1109
    +    if ( FT_QNEW_ARRAY( enc->offset, nencoding ) )
    
    1110
    +      goto Bail;
    
    1111
    +
    
    1112 1112
         /* now loop over all values */
    
    1113 1113
         offset = enc->offset;
    
    1114 1114
         for ( i = enc->firstRow; i <= enc->lastRow; i++ )
    
    ... ... @@ -1131,11 +1131,6 @@ THE SOFTWARE.
    1131 1131
         }
    
    1132 1132
         FT_Stream_ExitFrame( stream );
    
    1133 1133
     
    
    1134
    -    return error;
    
    1135
    -
    
    1136
    -  Exit:
    
    1137
    -    FT_FREE( enc->offset );
    
    1138
    -
    
    1139 1134
       Bail:
    
    1140 1135
         return error;
    
    1141 1136
       }
    


  • reply via email to

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