... |
... |
@@ -155,6 +155,7 @@ FT_BEGIN_HEADER |
155
|
155
|
* FT_FACE_FLAG_HINTER
|
156
|
156
|
* FT_FACE_FLAG_SVG
|
157
|
157
|
* FT_FACE_FLAG_SBIX
|
|
158
|
+ * FT_FACE_FLAG_SBIX_OVERLAY
|
158
|
159
|
*
|
159
|
160
|
* FT_HAS_HORIZONTAL
|
160
|
161
|
* FT_HAS_VERTICAL
|
... |
... |
@@ -165,6 +166,7 @@ FT_BEGIN_HEADER |
165
|
166
|
* FT_HAS_MULTIPLE_MASTERS
|
166
|
167
|
* FT_HAS_SVG
|
167
|
168
|
* FT_HAS_SBIX
|
|
169
|
+ * FT_HAS_SBIX_OVERLAY
|
168
|
170
|
*
|
169
|
171
|
* FT_IS_SFNT
|
170
|
172
|
* FT_IS_SCALABLE
|
... |
... |
@@ -1244,6 +1246,10 @@ FT_BEGIN_HEADER |
1244
|
1246
|
* For such fonts, @FT_FACE_FLAG_SCALABLE is not set by default to
|
1245
|
1247
|
* retain backward compatibility.
|
1246
|
1248
|
*
|
|
1249
|
+ * FT_FACE_FLAG_SBIX_OVERLAY ::
|
|
1250
|
+ * [Since 2.12] The face has an 'sbix' OpenType table where outlines
|
|
1251
|
+ * should be drawn on top of bitmap strikes.
|
|
1252
|
+ *
|
1247
|
1253
|
*/
|
1248
|
1254
|
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
|
1249
|
1255
|
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
|
... |
... |
@@ -1263,6 +1269,7 @@ FT_BEGIN_HEADER |
1263
|
1269
|
#define FT_FACE_FLAG_VARIATION ( 1L << 15 )
|
1264
|
1270
|
#define FT_FACE_FLAG_SVG ( 1L << 16 )
|
1265
|
1271
|
#define FT_FACE_FLAG_SBIX ( 1L << 17 )
|
|
1272
|
+#define FT_FACE_FLAG_SBIX_OVERLAY ( 1L << 18 )
|
1266
|
1273
|
|
1267
|
1274
|
|
1268
|
1275
|
/**************************************************************************
|
... |
... |
@@ -1528,6 +1535,73 @@ FT_BEGIN_HEADER |
1528
|
1535
|
* A macro that returns true whenever a face object contains an 'sbix'
|
1529
|
1536
|
* OpenType table *and* outline glyphs.
|
1530
|
1537
|
*
|
|
1538
|
+ * Currently, FreeType only supports bitmap glyphs in PNG format for this
|
|
1539
|
+ * table (i.e., JPEG and TIFF formats are unsupported, as are
|
|
1540
|
+ * Apple-specific formats not part of the OpenType specification).
|
|
1541
|
+ *
|
|
1542
|
+ * @note:
|
|
1543
|
+ * For backward compatibility, a font with an 'sbix' table is treated as
|
|
1544
|
+ * a bitmap-only face. Using @FT_Open_Face with @FT_PARAM_TAG_NO_SBIX,
|
|
1545
|
+ * an application can switch off 'sbix' handling so that the face is
|
|
1546
|
+ * treated as an ordinary outline font with scalable outlines.
|
|
1547
|
+ *
|
|
1548
|
+ * Here is some pseudo code that roughly illustrates how to implement
|
|
1549
|
+ * 'sbix' handling according to the OpenType specification.
|
|
1550
|
+ *
|
|
1551
|
+ * ```
|
|
1552
|
+ * if ( FT_HAS_SBIX( face ) )
|
|
1553
|
+ * {
|
|
1554
|
+ * // open font as a scalable one without sbix handling
|
|
1555
|
+ * FT_Face face2;
|
|
1556
|
+ * FT_Parameter param = { FT_PARAM_TAG_IGNORE_SBIX, NULL };
|
|
1557
|
+ * FT_Open_Args args = { FT_OPEN_PARAMS | ...,
|
|
1558
|
+ * ...,
|
|
1559
|
+ * 1, ¶m };
|
|
1560
|
+ *
|
|
1561
|
+ *
|
|
1562
|
+ * FT_Open_Face( library, &args, 0, &face2 );
|
|
1563
|
+ *
|
|
1564
|
+ * <sort `face->available_size` as necessary into
|
|
1565
|
+ * `preferred_sizes`[*]>
|
|
1566
|
+ *
|
|
1567
|
+ * for ( i = 0; i < face->num_fixed_sizes; i++ )
|
|
1568
|
+ * {
|
|
1569
|
+ * size = preferred_sizes[i].size;
|
|
1570
|
+ *
|
|
1571
|
+ * error = FT_Set_Pixel_Sizes( face, size, size );
|
|
1572
|
+ * <error handling omitted>
|
|
1573
|
+ *
|
|
1574
|
+ * // check whether we have a glyph in a bitmap strike
|
|
1575
|
+ * error = FT_Load_Glyph( face,
|
|
1576
|
+ * glyph_index,
|
|
1577
|
+ * FT_LOAD_SBITS_ONLY |
|
|
1578
|
+ * FT_LOAD_BITMAP_METRICS_ONLY );
|
|
1579
|
+ * if ( error == FT_Err_Invalid_Argument )
|
|
1580
|
+ * continue;
|
|
1581
|
+ * else if ( error )
|
|
1582
|
+ * <other error handling omitted>
|
|
1583
|
+ * else
|
|
1584
|
+ * break;
|
|
1585
|
+ * }
|
|
1586
|
+ *
|
|
1587
|
+ * if ( i != face->num_fixed_sizes )
|
|
1588
|
+ * <load embedded bitmap with `FT_Load_Glyph`,
|
|
1589
|
+ * scale it, display it, etc.>
|
|
1590
|
+ *
|
|
1591
|
+ * if ( i == face->num_fixed_sizes ||
|
|
1592
|
+ * FT_HAS_SBIX_OVERLAY( face ) )
|
|
1593
|
+ * <use `face2` to load outline glyph with `FT_Load_Glyph`,
|
|
1594
|
+ * scale it, display it on top of the bitmap, etc.>
|
|
1595
|
+ * }
|
|
1596
|
+ * ```
|
|
1597
|
+ *
|
|
1598
|
+ * [*] Assuming a target value of 400dpi and available strike sizes 100,
|
|
1599
|
+ * 200, 300, and 400dpi, a possible order might be [400, 200, 300, 100]:
|
|
1600
|
+ * scaling 200dpi to 400dpi usually gives better results than scaling
|
|
1601
|
+ * 300dpi to 400dpi; it is also much faster. However, scaling 100dpi to
|
|
1602
|
+ * 400dpi can yield a too pixelated result, thus the preference might be
|
|
1603
|
+ * 300dpi over 100dpi.
|
|
1604
|
+ *
|
1531
|
1605
|
* @since:
|
1532
|
1606
|
* 2.12
|
1533
|
1607
|
*/
|
... |
... |
@@ -1535,6 +1609,24 @@ FT_BEGIN_HEADER |
1535
|
1609
|
( !!( (face)->face_flags & FT_FACE_FLAG_SBIX ) )
|
1536
|
1610
|
|
1537
|
1611
|
|
|
1612
|
+ /**************************************************************************
|
|
1613
|
+ *
|
|
1614
|
+ * @macro:
|
|
1615
|
+ * FT_HAS_SBIX_OVERLAY
|
|
1616
|
+ *
|
|
1617
|
+ * @description:
|
|
1618
|
+ * A macro that returns true whenever a face object contains an 'sbix'
|
|
1619
|
+ * OpenType table with bit~1 in its `flags` field set, instructing the
|
|
1620
|
+ * application to overlay the bitmap strike with the corresponding
|
|
1621
|
+ * outline glyph. See @FT_HAS_SBIX for pseudo code how to use it.
|
|
1622
|
+ *
|
|
1623
|
+ * @since:
|
|
1624
|
+ * 2.12
|
|
1625
|
+ */
|
|
1626
|
+#define FT_HAS_SBIX_OVERLAY( face ) \
|
|
1627
|
+ ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX_OVERLAY ) )
|
|
1628
|
+
|
|
1629
|
+
|
1538
|
1630
|
/**************************************************************************
|
1539
|
1631
|
*
|
1540
|
1632
|
* @enum:
|