freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][hdmx-advances] 11 commits: * src/base/ftobjs.c


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][hdmx-advances] 11 commits: * src/base/ftobjs.c (FT_Request_Metrics): Fix build warning on Android.
Date: Fri, 10 Dec 2021 05:12:59 +0000

Alexei Podtelezhnikov pushed to branch hdmx-advances at FreeType / FreeType

Commits:

22 changed files:

Changes:

  • CMakeLists.txt
    ... ... @@ -163,7 +163,7 @@ project(freetype C)
    163 163
     
    
    164 164
     set(VERSION_MAJOR "2")
    
    165 165
     set(VERSION_MINOR "11")
    
    166
    -set(VERSION_PATCH "0")
    
    166
    +set(VERSION_PATCH "1")
    
    167 167
     
    
    168 168
     # Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
    
    169 169
     set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
    

  • README
    1
    -FreeType 2.11.0
    
    1
    +FreeType 2.11.1
    
    2 2
     ===============
    
    3 3
     
    
    4 4
     Homepage: https://www.freetype.org
    
    ... ... @@ -30,9 +30,9 @@ sites. Go to
    30 30
     
    
    31 31
     and download one of the following files.
    
    32 32
     
    
    33
    -  freetype-doc-2.11.0.tar.xz
    
    34
    -  freetype-doc-2.11.0.tar.gz
    
    35
    -  ftdoc2110.zip
    
    33
    +  freetype-doc-2.11.1.tar.xz
    
    34
    +  freetype-doc-2.11.1.tar.gz
    
    35
    +  ftdoc2111.zip
    
    36 36
     
    
    37 37
     To view the documentation online, go to
    
    38 38
     
    

  • builds/toplevel.mk
    ... ... @@ -226,6 +226,7 @@ patch := $(firstword $(patch))
    226 226
     # else
    
    227 227
       version := $(major).$(minor).$(patch)
    
    228 228
       winversion := $(major)$(minor)$(patch)
    
    229
    +  version_tag := VER-$(major)-$(minor)-$(patch)
    
    229 230
     # endif
    
    230 231
     
    
    231 232
     
    
    ... ... @@ -282,6 +283,10 @@ dist:
    282 283
     CONFIG_GUESS = ~/git/config/config.guess
    
    283 284
     CONFIG_SUB   = ~/git/config/config.sub
    
    284 285
     
    
    286
    +# We also use this repository to access the gnulib script that converts git
    
    287
    +# commit messages to a ChangeLog file.
    
    288
    +CHANGELOG_SCRIPT = ~/git/config/gitlog-to-changelog
    
    289
    +
    
    285 290
     
    
    286 291
     # Don't say `make do-dist'.  Always use `make dist' instead.
    
    287 292
     #
    
    ... ... @@ -299,6 +304,15 @@ do-dist: distclean refdoc
    299 304
     	cp $(CONFIG_GUESS) builds/unix
    
    300 305
     	cp $(CONFIG_SUB) builds/unix
    
    301 306
     
    
    307
    +	@# Generate `ChangeLog' file with commits since previous release.
    
    308
    +	$(CHANGELOG_SCRIPT) \
    
    309
    +	  --format='%B%n' \
    
    310
    +	  --no-cluster \
    
    311
    +	  -- `git describe --tags \
    
    312
    +	                   --abbrev=0 \
    
    313
    +	                   $(version_tag)^`..$(version_tag) \
    
    314
    +	> ChangeLog
    
    315
    +
    
    302 316
     	@# Remove intermediate files created by the `refdoc' target.
    
    303 317
     	rm -rf docs/markdown
    
    304 318
     	rm -f docs/mkdocs.yml
    

  • builds/unix/configure.raw
    ... ... @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in])
    17 17
     
    
    18 18
     # Don't forget to update `docs/VERSIONS.TXT'!
    
    19 19
     
    
    20
    -version_info='24:0:18'
    
    20
    +version_info='24:1:18'
    
    21 21
     AC_SUBST([version_info])
    
    22 22
     ft_version=`echo $version_info | tr : .`
    
    23 23
     AC_SUBST([ft_version])
    

  • builds/wince/vc2005-ce/index.html
    ... ... @@ -21,7 +21,7 @@ the following targets:
    21 21
       <li>PPC/SP WM6 (Windows Mobile 6)</li>
    
    22 22
     </ul>
    
    23 23
     
    
    24
    -It compiles the following libraries from the FreeType 2.11.0 sources:</p>
    
    24
    +It compiles the following libraries from the FreeType 2.11.1 sources:</p>
    
    25 25
     
    
    26 26
     <ul>
    
    27 27
       <pre>
    

  • builds/wince/vc2008-ce/index.html
    ... ... @@ -21,7 +21,7 @@ the following targets:
    21 21
       <li>PPC/SP WM6 (Windows Mobile 6)</li>
    
    22 22
     </ul>
    
    23 23
     
    
    24
    -It compiles the following libraries from the FreeType 2.11.0 sources:</p>
    
    24
    +It compiles the following libraries from the FreeType 2.11.1 sources:</p>
    
    25 25
     
    
    26 26
     <ul>
    
    27 27
       <pre>
    

  • builds/windows/ftdebug.c
    ... ... @@ -93,28 +93,60 @@
    93 93
     
    
    94 94
     #ifdef FT_DEBUG_LEVEL_ERROR
    
    95 95
     
    
    96
    -#include <stdarg.h>
    
    97
    -#include <stdlib.h>
    
    98
    -#include <string.h>
    
    99
    -
    
    96
    +#define WIN32_LEAN_AND_MEAN
    
    100 97
     #include <windows.h>
    
    101 98
     
    
    102 99
     
    
    100
    +#ifdef _WIN32_WCE
    
    101
    +
    
    102
    +  FT_LOACAL_DEF( void )
    
    103
    +  OutputDebugStringA( LPCSTR lpOutputString )
    
    104
    +  {
    
    105
    +    int            len;
    
    106
    +    LPWSTR         lpOutputStringW;
    
    107
    +
    
    108
    +
    
    109
    +    /* allocate memory space for converted string */
    
    110
    +    len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
    
    111
    +                               lpOutputString, -1, NULL, 0 );
    
    112
    +
    
    113
    +    lpOutputStringW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) );
    
    114
    +
    
    115
    +    if ( !len || !lpOutputStringW )
    
    116
    +      return;
    
    117
    +
    
    118
    +    /* now it is safe to do the translation */
    
    119
    +    MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
    
    120
    +                         lpOutputString, -1, lpOutputStringW, len );
    
    121
    +
    
    122
    +    OutputDebugStringW( lpOutputStringW );
    
    123
    +  }
    
    124
    +
    
    125
    +#endif /* _WIN32_WCE */
    
    126
    +
    
    127
    +
    
    103 128
       /* documentation is in ftdebug.h */
    
    104 129
     
    
    105 130
       FT_BASE_DEF( void )
    
    106 131
       FT_Message( const char*  fmt,
    
    107 132
                   ... )
    
    108 133
       {
    
    109
    -    static char  buf[8192];
    
    110
    -    va_list      ap;
    
    134
    +    va_list  ap;
    
    111 135
     
    
    112 136
     
    
    113 137
         va_start( ap, fmt );
    
    114 138
         vfprintf( stderr, fmt, ap );
    
    115
    -    /* send the string to the debugger as well */
    
    116
    -    vsprintf( buf, fmt, ap );
    
    117
    -    OutputDebugStringA( buf );
    
    139
    +#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
    
    140
    +    ( defined( _WIN32_WCE )   && _WIN32_WCE   >= 0x0600 )
    
    141
    +    if ( IsDebuggerPresent() )
    
    142
    +    {
    
    143
    +      static char  buf[1024];
    
    144
    +
    
    145
    +
    
    146
    +      vsnprintf( buf, sizeof buf, fmt, ap );
    
    147
    +      OutputDebugStringA( buf );
    
    148
    +    }
    
    149
    +#endif
    
    118 150
         va_end( ap );
    
    119 151
       }
    
    120 152
     
    
    ... ... @@ -125,13 +157,22 @@
    125 157
       FT_Panic( const char*  fmt,
    
    126 158
                 ... )
    
    127 159
       {
    
    128
    -    static char  buf[8192];
    
    129
    -    va_list      ap;
    
    160
    +    va_list  ap;
    
    130 161
     
    
    131 162
     
    
    132 163
         va_start( ap, fmt );
    
    133
    -    vsprintf( buf, fmt, ap );
    
    134
    -    OutputDebugStringA( buf );
    
    164
    +    vfprintf( stderr, fmt, ap );
    
    165
    +#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
    
    166
    +    ( defined( _WIN32_WCE )   && _WIN32_WCE   >= 0x0600 )
    
    167
    +    if ( IsDebuggerPresent() )
    
    168
    +    {
    
    169
    +      static char  buf[1024];
    
    170
    +
    
    171
    +
    
    172
    +      vsnprintf( buf, sizeof buf, fmt, ap );
    
    173
    +      OutputDebugStringA( buf );
    
    174
    +    }
    
    175
    +#endif
    
    135 176
         va_end( ap );
    
    136 177
     
    
    137 178
         exit( EXIT_FAILURE );
    

  • builds/windows/ftsystem.c
    ... ... @@ -233,6 +233,10 @@
    233 233
                             dwFlagsAndAttributes, hTemplateFile );
    
    234 234
       }
    
    235 235
     
    
    236
    +#endif
    
    237
    +
    
    238
    +#if defined( _WIN32_WCE ) || defined ( _WIN32_WINDOWS ) || \
    
    239
    +    !defined( _WIN32_WINNT ) || _WIN32_WINNT <= 0x0400
    
    236 240
     
    
    237 241
       FT_LOCAL_DEF( BOOL )
    
    238 242
       GetFileSizeEx( HANDLE         hFile,
    
    ... ... @@ -248,7 +252,7 @@
    248 252
           return TRUE;
    
    249 253
       }
    
    250 254
     
    
    251
    -#endif /* _WIN32_WCE */
    
    255
    +#endif
    
    252 256
     
    
    253 257
     
    
    254 258
       /* documentation is in ftobjs.h */
    

  • builds/windows/vc2010/index.html
    ... ... @@ -12,7 +12,7 @@
    12 12
     <p>This directory contains solution and project files for
    
    13 13
     Visual&nbsp;C++&nbsp;2010 or newer, named <tt>freetype.sln</tt>,
    
    14 14
     and <tt>freetype.vcxproj</tt>.  It compiles the following libraries
    
    15
    -from the FreeType 2.11.0 sources:</p>
    
    15
    +from the FreeType 2.11.1 sources:</p>
    
    16 16
     
    
    17 17
     <ul>
    
    18 18
       <li>freetype.dll using 'Release' or 'Debug' configurations</li>
    

  • builds/windows/visualc/freetype.vcproj
    ... ... @@ -434,6 +434,10 @@
    434 434
     					/>
    
    435 435
     				</FileConfiguration>
    
    436 436
     			</File>
    
    437
    +			<File
    
    438
    +				RelativePath="..\..\..\src\sdf\sdf.c"
    
    439
    +				>
    
    440
    +			</File>
    
    437 441
     			<File
    
    438 442
     				RelativePath="..\..\..\src\smooth\smooth.c"
    
    439 443
     				>
    

  • builds/windows/visualc/index.html
    ... ... @@ -12,7 +12,7 @@
    12 12
     <p>This directory contains project files <tt>freetype.dsp</tt> for
    
    13 13
     Visual C++ 6.0, and <tt>freetype.vcproj</tt> for Visual C++ 2002
    
    14 14
     through 2008, which you might need to upgrade automatically.
    
    15
    -It compiles the following libraries from the FreeType 2.11.0 sources:</p>
    
    15
    +It compiles the following libraries from the FreeType 2.11.1 sources:</p>
    
    16 16
     
    
    17 17
     <ul>
    
    18 18
       <li>freetype.dll using 'Release' or 'Debug' configurations</li>
    

  • builds/windows/visualce/index.html
    ... ... @@ -21,7 +21,7 @@ the following targets:
    21 21
       <li>PPC/SP WM6 (Windows Mobile 6)</li>
    
    22 22
     </ul>
    
    23 23
     
    
    24
    -It compiles the following libraries from the FreeType 2.11.0 sources:</p>
    
    24
    +It compiles the following libraries from the FreeType 2.11.1 sources:</p>
    
    25 25
     
    
    26 26
     <ul>
    
    27 27
       <pre>
    

  • docs/VERSIONS.TXT
    ... ... @@ -60,6 +60,7 @@ found on _most_ systems, but not all of them:
    60 60
     
    
    61 61
         release     libtool     so
    
    62 62
       -------------------------------
    
    63
    +     2.11.1     24.1.18   6.18.1
    
    63 64
          2.11.0     24.0.18   6.18.0
    
    64 65
          2.10.4     23.4.17   6.17.4
    
    65 66
          2.10.3     23.3.17   6.17.3
    

  • docs/freetype-config.1
    1
    -.TH FREETYPE-CONFIG 1 "July 2021" "FreeType 2.11.0"
    
    1
    +.TH FREETYPE-CONFIG 1 "December 2021" "FreeType 2.11.1"
    
    2 2
     .
    
    3 3
     .
    
    4 4
     .SH NAME
    

  • docs/release
    ... ... @@ -15,9 +15,6 @@ How to prepare a new release
    15 15
     
    
    16 16
     . docs/VERSIONS.TXT: Document changed `version_info`.
    
    17 17
     
    
    18
    -. ChangeLog: Announce new release (both in the 'freetype' and
    
    19
    -  'freetype-demos' repositories).
    
    20
    -
    
    21 18
     . Clone the git archive to another directory with
    
    22 19
     
    
    23 20
         git clone -l -s . ../freetype.test
    
    ... ... @@ -175,15 +172,9 @@ How to prepare a new release
    175 172
       `freetype-XXX.tar.xz` files as the default files to download for
    
    176 173
       'Windows' and 'Others', respectively.
    
    177 174
     
    
    178
    -. Copy the reference files (generated by `make dist`) to
    
    179
    -
    
    180
    -    <freetype-web git repository>/freetype2/docs/reference
    
    181
    -
    
    182
    -. Update the 'freetype-web' repository.  `git push` then automatically
    
    183
    -  triggers an update of the public web pages within ten minutes due to
    
    184
    -  a cron script (on 'wl@freedesktop.org') that rsyncs with
    
    185
    -
    
    186
    -    freedesktop.org://srv/freetype.freedesktop.org/www
    
    175
    +. Trigger the automatic generation of the online API reference by
    
    176
    +  updating the `FT_VERSION` variable in file `.gitlab-ci.yml` of the
    
    177
    +  'freetype-web' repository.
    
    187 178
     
    
    188 179
     . Announce new release on 'freetype-announce@nongnu.org' and to
    
    189 180
       relevant newsgroups.
    

  • include/freetype/freetype.h
    ... ... @@ -4740,7 +4740,7 @@ FT_BEGIN_HEADER
    4740 4740
        */
    
    4741 4741
     #define FREETYPE_MAJOR  2
    
    4742 4742
     #define FREETYPE_MINOR  11
    
    4743
    -#define FREETYPE_PATCH  0
    
    4743
    +#define FREETYPE_PATCH  1
    
    4744 4744
     
    
    4745 4745
     
    
    4746 4746
       /**************************************************************************
    

  • include/freetype/internal/tttypes.h
    ... ... @@ -1390,8 +1390,8 @@ FT_BEGIN_HEADER
    1390 1390
        *   hdmx_record_size ::
    
    1391 1391
        *     The size of a single hdmx record.
    
    1392 1392
        *
    
    1393
    -   *   hdmx_record_sizes ::
    
    1394
    -   *     An array holding the ppem sizes available in the 'hdmx' table.
    
    1393
    +   *   hdmx_records ::
    
    1394
    +   *     A array of pointers to the 'hdmx' table records sorted by ppem.
    
    1395 1395
        *
    
    1396 1396
        *   sbit_table ::
    
    1397 1397
        *     A pointer to the font's embedded bitmap location table.
    
    ... ... @@ -1605,7 +1605,7 @@ FT_BEGIN_HEADER
    1605 1605
         FT_ULong              hdmx_table_size;
    
    1606 1606
         FT_UInt               hdmx_record_count;
    
    1607 1607
         FT_ULong              hdmx_record_size;
    
    1608
    -    FT_Byte*              hdmx_record_sizes;
    
    1608
    +    FT_Byte**             hdmx_records;
    
    1609 1609
     
    
    1610 1610
         FT_Byte*              sbit_table;
    
    1611 1611
         FT_ULong              sbit_table_size;
    
    ... ... @@ -1769,6 +1769,9 @@ FT_BEGIN_HEADER
    1769 1769
         /* since version 2.6.2 */
    
    1770 1770
         FT_ListRec       composites;
    
    1771 1771
     
    
    1772
    +    /* since version 2.11.2 */
    
    1773
    +    FT_Byte*         widthp;
    
    1774
    +
    
    1772 1775
       } TT_LoaderRec;
    
    1773 1776
     
    
    1774 1777
     
    

  • src/base/ftobjs.c
    ... ... @@ -3230,8 +3230,8 @@
    3230 3230
     
    
    3231 3231
           scaled_w = ( scaled_w + 32 ) >> 6;
    
    3232 3232
           scaled_h = ( scaled_h + 32 ) >> 6;
    
    3233
    -      if ( scaled_w > FT_USHORT_MAX ||
    
    3234
    -           scaled_h > FT_USHORT_MAX )
    
    3233
    +      if ( scaled_w > (FT_Long)FT_USHORT_MAX ||
    
    3234
    +           scaled_h > (FT_Long)FT_USHORT_MAX )
    
    3235 3235
           {
    
    3236 3236
             FT_ERROR(( "FT_Request_Metrics: Resulting ppem size too large\n" ));
    
    3237 3237
             error = FT_ERR( Invalid_Pixel_Size );
    

  • src/base/ftver.rc
    ... ... @@ -18,8 +18,8 @@
    18 18
     
    
    19 19
     #include<windows.h>
    
    20 20
     
    
    21
    -#define FT_VERSION      2,11,0,0
    
    22
    -#define FT_VERSION_STR  "2.11.0"
    
    21
    +#define FT_VERSION      2,11,1,0
    
    22
    +#define FT_VERSION_STR  "2.11.1"
    
    23 23
     
    
    24 24
     VS_VERSION_INFO      VERSIONINFO
    
    25 25
     FILEVERSION          FT_VERSION
    

  • src/truetype/ttgload.c
    ... ... @@ -2230,10 +2230,6 @@
    2230 2230
                              FT_UInt    glyph_index )
    
    2231 2231
       {
    
    2232 2232
         TT_Face    face   = loader->face;
    
    2233
    -#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
    
    2234
    -    defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    2235
    -    TT_Driver  driver = (TT_Driver)FT_FACE_DRIVER( face );
    
    2236
    -#endif
    
    2237 2233
     
    
    2238 2234
         FT_BBox       bbox;
    
    2239 2235
         FT_Fixed      y_scale;
    
    ... ... @@ -2256,53 +2252,10 @@
    2256 2252
     
    
    2257 2253
         glyph->metrics.horiBearingX = bbox.xMin;
    
    2258 2254
         glyph->metrics.horiBearingY = bbox.yMax;
    
    2259
    -    glyph->metrics.horiAdvance  = SUB_LONG(loader->pp2.x, loader->pp1.x);
    
    2260
    -
    
    2261
    -    /* Adjust advance width to the value contained in the hdmx table   */
    
    2262
    -    /* unless FT_LOAD_COMPUTE_METRICS is set or backward compatibility */
    
    2263
    -    /* mode of the v40 interpreter is active.  See `ttinterp.h' for    */
    
    2264
    -    /* details on backward compatibility mode.                         */
    
    2265
    -    if (
    
    2266
    -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    2267
    -         !( driver->interpreter_version == TT_INTERPRETER_VERSION_40  &&
    
    2268
    -            ( loader->exec && loader->exec->backward_compatibility  ) ) &&
    
    2269
    -#endif
    
    2270
    -         !face->postscript.isFixedPitch                                 &&
    
    2271
    -         IS_HINTED( loader->load_flags )                                &&
    
    2272
    -         !( loader->load_flags & FT_LOAD_COMPUTE_METRICS )              )
    
    2273
    -    {
    
    2274
    -      FT_Byte*  widthp;
    
    2275
    -
    
    2276
    -
    
    2277
    -      widthp = tt_face_get_device_metrics( face,
    
    2278
    -                                           size->metrics->x_ppem,
    
    2279
    -                                           glyph_index );
    
    2280
    -
    
    2281
    -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
    
    2282
    -
    
    2283
    -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
    
    2284
    -      {
    
    2285
    -        FT_Bool  ignore_x_mode;
    
    2286
    -
    
    2287
    -
    
    2288
    -        ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) !=
    
    2289
    -                                 FT_RENDER_MODE_MONO );
    
    2290
    -
    
    2291
    -        if ( widthp                                                   &&
    
    2292
    -             ( ( ignore_x_mode && loader->exec->compatible_widths ) ||
    
    2293
    -                !ignore_x_mode                                      ||
    
    2294
    -                SPH_OPTION_BITMAP_WIDTHS                            ) )
    
    2295
    -          glyph->metrics.horiAdvance = *widthp * 64;
    
    2296
    -      }
    
    2297
    -      else
    
    2298
    -
    
    2299
    -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    2300
    -
    
    2301
    -      {
    
    2302
    -        if ( widthp )
    
    2303
    -          glyph->metrics.horiAdvance = *widthp * 64;
    
    2304
    -      }
    
    2305
    -    }
    
    2255
    +    if ( loader->widthp )
    
    2256
    +      glyph->metrics.horiAdvance = loader->widthp[glyph_index] * 64;
    
    2257
    +    else
    
    2258
    +      glyph->metrics.horiAdvance = SUB_LONG(loader->pp2.x, loader->pp1.x);
    
    2306 2259
     
    
    2307 2260
         /* set glyph dimensions */
    
    2308 2261
         glyph->metrics.width  = SUB_LONG( bbox.xMax, bbox.xMin );
    
    ... ... @@ -2736,11 +2689,64 @@
    2736 2689
           if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
    
    2737 2690
                exec->GS.instruct_control & 4                            )
    
    2738 2691
             exec->ignore_x_mode = 0;
    
    2739
    -#endif
    
    2692
    +
    
    2693
    +      exec->iup_called = FALSE;
    
    2694
    +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    2695
    +
    
    2696
    +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    2697
    +      /*
    
    2698
    +       * Toggle backward compatibility according to what font wants, except
    
    2699
    +       * when
    
    2700
    +       *
    
    2701
    +       * 1) we have a `tricky' font that heavily relies on the interpreter to
    
    2702
    +       *    render glyphs correctly, for example DFKai-SB, or
    
    2703
    +       * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
    
    2704
    +       *
    
    2705
    +       * In those cases, backward compatibility needs to be turned off to get
    
    2706
    +       * correct rendering.  The rendering is then completely up to the
    
    2707
    +       * font's programming.
    
    2708
    +       *
    
    2709
    +       */
    
    2710
    +      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
    
    2711
    +           subpixel_hinting_lean                                    &&
    
    2712
    +           !FT_IS_TRICKY( glyph->face )                             )
    
    2713
    +        exec->backward_compatibility = !( exec->GS.instruct_control & 4 );
    
    2714
    +      else
    
    2715
    +        exec->backward_compatibility = FALSE;
    
    2716
    +
    
    2717
    +      exec->iupx_called = FALSE;
    
    2718
    +      exec->iupy_called = FALSE;
    
    2719
    +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
    
    2740 2720
     
    
    2741 2721
           exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
    
    2742 2722
           loader->exec = exec;
    
    2743 2723
           loader->instructions = exec->glyphIns;
    
    2724
    +
    
    2725
    +      /* Use the hdmx table if any unless FT_LOAD_COMPUTE_METRICS */
    
    2726
    +      /* is set or backward compatibility mode of the v38 or v40  */
    
    2727
    +      /* interpreters is active.  See `ttinterp.h' for details on */
    
    2728
    +      /* backward compatibility mode.                             */
    
    2729
    +      if ( IS_HINTED( loader->load_flags )                                &&
    
    2730
    +           !( loader->load_flags & FT_LOAD_COMPUTE_METRICS )              &&
    
    2731
    +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    2732
    +           !( driver->interpreter_version == TT_INTERPRETER_VERSION_40  &&
    
    2733
    +              exec->backward_compatibility                              ) &&
    
    2734
    +#endif
    
    2735
    +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
    
    2736
    +           !( driver->interpreter_version == TT_INTERPRETER_VERSION_38  &&
    
    2737
    +              !SPH_OPTION_BITMAP_WIDTHS                                 &&
    
    2738
    +              FT_LOAD_TARGET_MODE( loader->load_flags ) !=
    
    2739
    +                                                   FT_RENDER_MODE_MONO  &&
    
    2740
    +              exec->compatible_widths                                   ) &&
    
    2741
    +#endif
    
    2742
    +           !face->postscript.isFixedPitch                                 )
    
    2743
    +      {
    
    2744
    +        loader->widthp = tt_face_get_device_metrics( face,
    
    2745
    +                                                     size->metrics->x_ppem,
    
    2746
    +                                                     0 );
    
    2747
    +      }
    
    2748
    +      else
    
    2749
    +        loader->widthp = NULL;
    
    2744 2750
         }
    
    2745 2751
     
    
    2746 2752
     #endif /* TT_USE_BYTECODE_INTERPRETER */
    
    ... ... @@ -2939,6 +2945,13 @@
    2939 2945
         if ( error )
    
    2940 2946
           goto Exit;
    
    2941 2947
     
    
    2948
    +    /* done if we are only interested in the `hdmx` advance */
    
    2949
    +    if ( load_flags & FT_LOAD_ADVANCE_ONLY && loader.widthp )
    
    2950
    +    {
    
    2951
    +      glyph->metrics.horiAdvance = loader.widthp[glyph_index] * 64;
    
    2952
    +      goto Done;
    
    2953
    +    }
    
    2954
    +
    
    2942 2955
         glyph->format        = FT_GLYPH_FORMAT_OUTLINE;
    
    2943 2956
         glyph->num_subglyphs = 0;
    
    2944 2957
         glyph->outline.flags = 0;
    
    ... ... @@ -3017,6 +3030,7 @@
    3017 3030
                     glyph->outline.n_points,
    
    3018 3031
                     glyph->outline.flags ));
    
    3019 3032
     
    
    3033
    +  Done:
    
    3020 3034
         tt_loader_done( &loader );
    
    3021 3035
     
    
    3022 3036
       Exit:
    

  • src/truetype/ttinterp.c
    ... ... @@ -5260,10 +5260,15 @@
    5260 5260
           }
    
    5261 5261
         }
    
    5262 5262
     
    
    5263
    -    exc->GS.instruct_control &= ~(FT_Byte)Kf;
    
    5264
    -    exc->GS.instruct_control |= (FT_Byte)L;
    
    5263
    +    /* INSTCTRL should only be use in the CVT program */
    
    5264
    +    if ( exc->iniRange == tt_coderange_cvt )
    
    5265
    +    {
    
    5266
    +      exc->GS.instruct_control &= ~(FT_Byte)Kf;
    
    5267
    +      exc->GS.instruct_control |= (FT_Byte)L;
    
    5268
    +    }
    
    5265 5269
     
    
    5266
    -    if ( K == 3 )
    
    5270
    +    /* except to change the subpixel flags temporarily */
    
    5271
    +    if ( K == 3 && exc->iniRange == tt_coderange_glyph )
    
    5267 5272
         {
    
    5268 5273
     #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
    
    5269 5274
           /* INSTCTRL modifying flag 3 also has an effect */
    
    ... ... @@ -7755,35 +7760,6 @@
    7755 7760
     #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    7756 7761
     
    
    7757 7762
     
    
    7758
    -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
    
    7759
    -    exc->iup_called = FALSE;
    
    7760
    -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    7761
    -
    
    7762
    -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    7763
    -    /*
    
    7764
    -     * Toggle backward compatibility according to what font wants, except
    
    7765
    -     * when
    
    7766
    -     *
    
    7767
    -     * 1) we have a `tricky' font that heavily relies on the interpreter to
    
    7768
    -     *    render glyphs correctly, for example DFKai-SB, or
    
    7769
    -     * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
    
    7770
    -     *
    
    7771
    -     * In those cases, backward compatibility needs to be turned off to get
    
    7772
    -     * correct rendering.  The rendering is then completely up to the
    
    7773
    -     * font's programming.
    
    7774
    -     *
    
    7775
    -     */
    
    7776
    -    if ( SUBPIXEL_HINTING_MINIMAL          &&
    
    7777
    -         exc->subpixel_hinting_lean        &&
    
    7778
    -         !FT_IS_TRICKY( &exc->face->root ) )
    
    7779
    -      exc->backward_compatibility = !( exc->GS.instruct_control & 4 );
    
    7780
    -    else
    
    7781
    -      exc->backward_compatibility = FALSE;
    
    7782
    -
    
    7783
    -    exc->iupx_called = FALSE;
    
    7784
    -    exc->iupy_called = FALSE;
    
    7785
    -#endif
    
    7786
    -
    
    7787 7763
         /* We restrict the number of twilight points to a reasonable,     */
    
    7788 7764
         /* heuristic value to avoid slow execution of malformed bytecode. */
    
    7789 7765
         num_twilight_points = FT_MAX( 30,
    

  • src/truetype/ttpload.c
    ... ... @@ -498,6 +498,14 @@
    498 498
       }
    
    499 499
     
    
    500 500
     
    
    501
    +  FT_COMPARE_DEF( int )
    
    502
    +  compare_ppem( const void*  a,
    
    503
    +                const void*  b )
    
    504
    +  {
    
    505
    +    return **(FT_Byte**)a - **(FT_Byte**)b;
    
    506
    +  }
    
    507
    +
    
    508
    +
    
    501 509
       /**************************************************************************
    
    502 510
        *
    
    503 511
        * @Function:
    
    ... ... @@ -574,20 +582,21 @@
    574 582
           goto Fail;
    
    575 583
         }
    
    576 584
     
    
    577
    -    if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) )
    
    585
    +    if ( FT_QNEW_ARRAY( face->hdmx_records, num_records ) )
    
    578 586
           goto Fail;
    
    579 587
     
    
    580
    -    /* XXX: We do not check if the records are sorted by ppem */
    
    581
    -    /* and cannot use binary search later.                    */
    
    582 588
         for ( nn = 0; nn < num_records; nn++ )
    
    583 589
         {
    
    584 590
           if ( p + record_size > limit )
    
    585 591
             break;
    
    586
    -
    
    587
    -      face->hdmx_record_sizes[nn] = p[0];
    
    588
    -      p                          += record_size;
    
    592
    +      face->hdmx_records[nn] = p;
    
    593
    +      p                     += record_size;
    
    589 594
         }
    
    590 595
     
    
    596
    +    /* The records must be already sorted by ppem but it does not */
    
    597
    +    /* hurt to make sure so that the binary search works later.   */
    
    598
    +    ft_qsort( face->hdmx_records, nn, sizeof ( FT_Byte* ), compare_ppem );
    
    599
    +
    
    591 600
         face->hdmx_record_count = nn;
    
    592 601
         face->hdmx_table_size   = table_size;
    
    593 602
         face->hdmx_record_size  = record_size;
    
    ... ... @@ -611,7 +620,7 @@
    611 620
         FT_Memory  memory = stream->memory;
    
    612 621
     
    
    613 622
     
    
    614
    -    FT_FREE( face->hdmx_record_sizes );
    
    623
    +    FT_FREE( face->hdmx_records );
    
    615 624
         FT_FRAME_RELEASE( face->hdmx_table );
    
    616 625
       }
    
    617 626
     
    
    ... ... @@ -619,27 +628,34 @@
    619 628
       /**************************************************************************
    
    620 629
        *
    
    621 630
        * Return the advance width table for a given pixel size if it is found
    
    622
    -   * in the font's `hdmx' table (if any).
    
    631
    +   * in the font's `hdmx' table (if any).  The records must be sorted for
    
    632
    +   * the binary search to work properly.
    
    623 633
        */
    
    624 634
       FT_LOCAL_DEF( FT_Byte* )
    
    625 635
       tt_face_get_device_metrics( TT_Face  face,
    
    626 636
                                   FT_UInt  ppem,
    
    627 637
                                   FT_UInt  gindex )
    
    628 638
       {
    
    629
    -    FT_UInt   nn;
    
    639
    +    FT_UInt   min         = 0;
    
    640
    +    FT_UInt   max         = face->hdmx_record_count;
    
    641
    +    FT_UInt   mid;
    
    630 642
         FT_Byte*  result      = NULL;
    
    631
    -    FT_ULong  record_size = face->hdmx_record_size;
    
    632
    -    FT_Byte*  record      = FT_OFFSET( face->hdmx_table, 8 );
    
    633 643
     
    
    634 644
     
    
    635
    -    for ( nn = 0; nn < face->hdmx_record_count; nn++ )
    
    636
    -      if ( face->hdmx_record_sizes[nn] == ppem )
    
    645
    +    while ( min < max )
    
    646
    +    {
    
    647
    +      mid = ( min + max ) >> 1;
    
    648
    +
    
    649
    +      if ( face->hdmx_records[mid][0] > ppem )
    
    650
    +        max = mid;
    
    651
    +      else if ( face->hdmx_records[mid][0] < ppem )
    
    652
    +        min = mid + 1;
    
    653
    +      else
    
    637 654
           {
    
    638
    -        gindex += 2;
    
    639
    -        if ( gindex < record_size )
    
    640
    -          result = record + nn * record_size + gindex;
    
    655
    +        result = face->hdmx_records[mid] + 2 + gindex;
    
    641 656
             break;
    
    642 657
           }
    
    658
    +    }
    
    643 659
     
    
    644 660
         return result;
    
    645 661
       }
    


  • reply via email to

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