freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][wl/sbix] 2 commits: * include/freetype/freetype


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][wl/sbix] 2 commits: * include/freetype/freetype.h (FT_LOAD_SBITS_ONLY): Tag macro as public.
Date: Wed, 09 Feb 2022 17:52:07 +0000

Werner Lemberg pushed to branch wl/sbix at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • include/freetype/freetype.h
    ... ... @@ -154,6 +154,7 @@ FT_BEGIN_HEADER
    154 154
        *   FT_FACE_FLAG_EXTERNAL_STREAM
    
    155 155
        *   FT_FACE_FLAG_HINTER
    
    156 156
        *   FT_FACE_FLAG_SVG
    
    157
    +   *   FT_FACE_FLAG_SBIX
    
    157 158
        *
    
    158 159
        *   FT_HAS_HORIZONTAL
    
    159 160
        *   FT_HAS_VERTICAL
    
    ... ... @@ -163,6 +164,7 @@ FT_BEGIN_HEADER
    163 164
        *   FT_HAS_COLOR
    
    164 165
        *   FT_HAS_MULTIPLE_MASTERS
    
    165 166
        *   FT_HAS_SVG
    
    167
    +   *   FT_HAS_SBIX
    
    166 168
        *
    
    167 169
        *   FT_IS_SFNT
    
    168 170
        *   FT_IS_SCALABLE
    
    ... ... @@ -227,6 +229,7 @@ FT_BEGIN_HEADER
    227 229
        *   FT_LOAD_NO_SCALE
    
    228 230
        *   FT_LOAD_NO_HINTING
    
    229 231
        *   FT_LOAD_NO_BITMAP
    
    232
    +   *   FT_LOAD_SBITS_ONLY
    
    230 233
        *   FT_LOAD_NO_AUTOHINT
    
    231 234
        *   FT_LOAD_COLOR
    
    232 235
        *
    
    ... ... @@ -1235,6 +1238,9 @@ FT_BEGIN_HEADER
    1235 1238
        *
    
    1236 1239
        *   FT_FACE_FLAG_SVG ::
    
    1237 1240
        *     [Since 2.12] The face has an 'SVG~' OpenType table.
    
    1241
    +   *
    
    1242
    +   *   FT_FACE_FLAG_SBIX ::
    
    1243
    +   *     [Since 2.12] The face has an 'sbix' OpenType table.
    
    1238 1244
        */
    
    1239 1245
     #define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
    
    1240 1246
     #define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )
    
    ... ... @@ -1253,6 +1259,7 @@ FT_BEGIN_HEADER
    1253 1259
     #define FT_FACE_FLAG_COLOR             ( 1L << 14 )
    
    1254 1260
     #define FT_FACE_FLAG_VARIATION         ( 1L << 15 )
    
    1255 1261
     #define FT_FACE_FLAG_SVG               ( 1L << 16 )
    
    1262
    +#define FT_FACE_FLAG_SBIX              ( 1L << 17 )
    
    1256 1263
     
    
    1257 1264
     
    
    1258 1265
       /**************************************************************************
    
    ... ... @@ -1509,6 +1516,68 @@ FT_BEGIN_HEADER
    1509 1516
               ( !!( (face)->face_flags & FT_FACE_FLAG_SVG ) )
    
    1510 1517
     
    
    1511 1518
     
    
    1519
    +  /**************************************************************************
    
    1520
    +   *
    
    1521
    +   * @macro:
    
    1522
    +   *   FT_HAS_SBIX
    
    1523
    +   *
    
    1524
    +   * @description:
    
    1525
    +   *   A macro that returns true whenever a face object contains an 'sbix'
    
    1526
    +   *   OpenType table.
    
    1527
    +   *
    
    1528
    +   * @note:
    
    1529
    +   *   Here is some pseudo code that roughly illustrates how to implement
    
    1530
    +   *   'sbix' handling according to the OpenType specification.
    
    1531
    +   *
    
    1532
    +   * ```
    
    1533
    +   *   if ( FT_HAS_SBIX( face ) )
    
    1534
    +   *   {
    
    1535
    +   *     <sort `face->available_size` as necessary into
    
    1536
    +   *      `preferred_sizes`[*]>
    
    1537
    +   *
    
    1538
    +   *     for ( i = 0; i < face->num_fixed_sizes; i++ )
    
    1539
    +   *     {
    
    1540
    +   *       size = preferred_sizes[i].size;
    
    1541
    +   *
    
    1542
    +   *       error = FT_Set_Pixel_Sizes( face, size, size );
    
    1543
    +   *       <error handling omitted>
    
    1544
    +   *
    
    1545
    +   *       // check whether we have a glyph in a bitmap strike
    
    1546
    +   *       error = FT_Load_Glyph( face,
    
    1547
    +   *                              glyph_index,
    
    1548
    +   *                              FT_LOAD_SBITS_ONLY          |
    
    1549
    +   *                              FT_LOAD_BITMAP_METRICS_ONLY )
    
    1550
    +   *       if ( error == FT_Err_Invalid_Argument )
    
    1551
    +   *         continue;
    
    1552
    +   *       else if ( error )
    
    1553
    +   *         <other error handling omitted>
    
    1554
    +   *       else
    
    1555
    +   *         break;
    
    1556
    +   *     }
    
    1557
    +   *
    
    1558
    +   *     if ( i == face->num_fixed_sizes )
    
    1559
    +   *       <no embedded bitmap found, load outline glyph with
    
    1560
    +   *        `FT_Load_Glyph`>
    
    1561
    +   *     else
    
    1562
    +   *       <load embedded bitmap with `FT_Load_Glyph`,
    
    1563
    +   *        scale it, display it, etc.>
    
    1564
    +   *   }
    
    1565
    +   * ```
    
    1566
    +   *
    
    1567
    +   * [*] Assuming a target value of 400dpi and available strike sizes 100,
    
    1568
    +   * 200, 300, and 400dpi, a possible order might be [400, 200, 300, 100]:
    
    1569
    +   * scaling 200dpi to 400dpi usually gives better results than scaling
    
    1570
    +   * 300dpi to 400dpi; it is also much faster.  However, scaling 100dpi to
    
    1571
    +   * 400dpi can yield a too pixelated result, thus the preference might be
    
    1572
    +   * 300dpi over 100dpi.
    
    1573
    +   *
    
    1574
    +   * @since:
    
    1575
    +   *   2.12
    
    1576
    +   */
    
    1577
    +#define FT_HAS_SBIX( face ) \
    
    1578
    +          ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX ) )
    
    1579
    +
    
    1580
    +
    
    1512 1581
       /**************************************************************************
    
    1513 1582
        *
    
    1514 1583
        * @enum:
    
    ... ... @@ -2976,6 +3045,15 @@ FT_BEGIN_HEADER
    2976 3045
        *
    
    2977 3046
        *     @FT_LOAD_NO_SCALE always sets this flag.
    
    2978 3047
        *
    
    3048
    +   *   FT_LOAD_SBITS_ONLY ::
    
    3049
    +   *     [Since 2.12] This is the opposite of @FT_LOAD_NO_BITMAP, more or
    
    3050
    +   *     less: @FT_Load_Glyph returns `FT_Err_Invalid_Argument` if the face
    
    3051
    +   *     contains a bitmap strike for the given size (or the strike selected
    
    3052
    +   *     by @FT_Select_Size) but there is no glyph in the strike.
    
    3053
    +   *
    
    3054
    +   *     Note that this load flag was part of FreeType since version 2.0.6
    
    3055
    +   *     but previously tagged as internal.
    
    3056
    +   *
    
    2979 3057
        *   FT_LOAD_VERTICAL_LAYOUT ::
    
    2980 3058
        *     Load the glyph for vertical text layout.  In particular, the
    
    2981 3059
        *     `advance` value in the @FT_GlyphSlotRec structure is set to the
    
    ... ... @@ -3120,6 +3198,7 @@ FT_BEGIN_HEADER
    3120 3198
     #define FT_LOAD_IGNORE_TRANSFORM             ( 1L << 11 )
    
    3121 3199
     #define FT_LOAD_MONOCHROME                   ( 1L << 12 )
    
    3122 3200
     #define FT_LOAD_LINEAR_DESIGN                ( 1L << 13 )
    
    3201
    +#define FT_LOAD_SBITS_ONLY                   ( 1L << 14 )
    
    3123 3202
     #define FT_LOAD_NO_AUTOHINT                  ( 1L << 15 )
    
    3124 3203
       /* Bits 16-19 are used by `FT_LOAD_TARGET_` */
    
    3125 3204
     #define FT_LOAD_COLOR                        ( 1L << 20 )
    
    ... ... @@ -3130,7 +3209,6 @@ FT_BEGIN_HEADER
    3130 3209
     
    
    3131 3210
       /* used internally only by certain font drivers */
    
    3132 3211
     #define FT_LOAD_ADVANCE_ONLY                 ( 1L << 8  )
    
    3133
    -#define FT_LOAD_SBITS_ONLY                   ( 1L << 14 )
    
    3134 3212
     #define FT_LOAD_SVG_ONLY                     ( 1L << 23 )
    
    3135 3213
     
    
    3136 3214
     
    

  • src/sfnt/sfobjs.c
    ... ... @@ -1051,6 +1051,9 @@
    1051 1051
                face->colr                                       )
    
    1052 1052
             flags |= FT_FACE_FLAG_COLOR;      /* color glyphs */
    
    1053 1053
     
    
    1054
    +      if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX )
    
    1055
    +        flags |= FT_FACE_FLAG_SBIX;       /* has 'sbix' embedded bitmaps */
    
    1056
    +
    
    1054 1057
           if ( has_outline == TRUE )
    
    1055 1058
             flags |= FT_FACE_FLAG_SCALABLE;   /* scalable outlines */
    
    1056 1059
     
    


  • reply via email to

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