|
|
@@ -4,7 +4,7 @@
|
|
|
/* */
|
|
|
/* FreeType high-level API and common types (specification only). */
|
|
|
/* */
|
|
|
-/* Copyright 1996-2015 by */
|
|
|
+/* Copyright 1996-2016 by */
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
/* */
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
@@ -16,8 +16,8 @@
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
-#ifndef __FREETYPE_H__
|
|
|
-#define __FREETYPE_H__
|
|
|
+#ifndef FREETYPE_H_
|
|
|
+#define FREETYPE_H_
|
|
|
|
|
|
|
|
|
#ifndef FT_FREETYPE_H
|
|
|
@@ -141,7 +141,6 @@ FT_BEGIN_HEADER
|
|
|
/* FT_FACE_FLAG_GLYPH_NAMES */
|
|
|
/* FT_FACE_FLAG_EXTERNAL_STREAM */
|
|
|
/* FT_FACE_FLAG_HINTER */
|
|
|
- /* FT_FACE_FLAG_TRICKY */
|
|
|
/* */
|
|
|
/* FT_HAS_HORIZONTAL */
|
|
|
/* FT_HAS_VERTICAL */
|
|
|
@@ -652,11 +651,11 @@ FT_BEGIN_HEADER
|
|
|
/* */
|
|
|
/* FT_ENCODING_SJIS :: */
|
|
|
/* Corresponds to Japanese SJIS encoding. More info at */
|
|
|
- /* at `http://en.wikipedia.org/wiki/Shift_JIS'. */
|
|
|
+ /* `http://en.wikipedia.org/wiki/Shift_JIS'. */
|
|
|
/* See note on multi-byte encodings below. */
|
|
|
/* */
|
|
|
/* FT_ENCODING_GB2312 :: */
|
|
|
- /* Corresponds to an encoding system for Simplified Chinese as used */
|
|
|
+ /* Corresponds to an encoding system for Simplified Chinese as */
|
|
|
/* used in mainland China. */
|
|
|
/* */
|
|
|
/* FT_ENCODING_BIG5 :: */
|
|
|
@@ -876,17 +875,36 @@ FT_BEGIN_HEADER
|
|
|
/* font formats can have multiple faces in */
|
|
|
/* a font file. */
|
|
|
/* */
|
|
|
- /* face_index :: The index of the face in the font file. It */
|
|
|
- /* is set to~0 if there is only one face in */
|
|
|
+ /* face_index :: This field holds two different values. */
|
|
|
+ /* Bits 0-15 are the index of the face in the */
|
|
|
+ /* font file (starting with value~0). They */
|
|
|
+ /* are set to~0 if there is only one face in */
|
|
|
/* the font file. */
|
|
|
/* */
|
|
|
+ /* Bits 16-30 are relevant to GX variation */
|
|
|
+ /* fonts only, holding the named instance */
|
|
|
+ /* index for the current face index (starting */
|
|
|
+ /* with value~1; value~0 indicates font access */
|
|
|
+ /* without GX variation data). For non-GX */
|
|
|
+ /* fonts, bits 16-30 are ignored. If we have */
|
|
|
+ /* the third named instance of face~4, say, */
|
|
|
+ /* `face_index' is set to 0x00030004. */
|
|
|
+ /* */
|
|
|
+ /* Bit 31 is always zero (this is, */
|
|
|
+ /* `face_index' is always a positive value). */
|
|
|
+ /* */
|
|
|
/* face_flags :: A set of bit flags that give important */
|
|
|
/* information about the face; see */
|
|
|
/* @FT_FACE_FLAG_XXX for the details. */
|
|
|
/* */
|
|
|
- /* style_flags :: A set of bit flags indicating the style of */
|
|
|
- /* the face; see @FT_STYLE_FLAG_XXX for the */
|
|
|
- /* details. */
|
|
|
+ /* style_flags :: The lower 16~bits contain a set of bit */
|
|
|
+ /* flags indicating the style of the face; see */
|
|
|
+ /* @FT_STYLE_FLAG_XXX for the details. Bits */
|
|
|
+ /* 16-30 hold the number of named instances */
|
|
|
+ /* available for the current face if we have a */
|
|
|
+ /* GX variation (sub)font. Bit 31 is always */
|
|
|
+ /* zero (this is, `style_flags' is always a */
|
|
|
+ /* positive value). */
|
|
|
/* */
|
|
|
/* num_glyphs :: The number of glyphs in the face. If the */
|
|
|
/* face is scalable and has sbits (see */
|
|
|
@@ -1085,7 +1103,7 @@ FT_BEGIN_HEADER
|
|
|
/* FT_FACE_FLAG_SCALABLE :: */
|
|
|
/* Indicates that the face contains outline glyphs. This doesn't */
|
|
|
/* prevent bitmap strikes, i.e., a face can have both this and */
|
|
|
- /* and @FT_FACE_FLAG_FIXED_SIZES set. */
|
|
|
+ /* @FT_FACE_FLAG_FIXED_SIZES set. */
|
|
|
/* */
|
|
|
/* FT_FACE_FLAG_FIXED_SIZES :: */
|
|
|
/* Indicates that the face contains bitmap strikes. See also the */
|
|
|
@@ -1204,7 +1222,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_HORIZONTAL( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1218,7 +1236,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_VERTICAL( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_VERTICAL )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1232,7 +1250,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_KERNING( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_KERNING )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_KERNING )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1247,7 +1265,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_IS_SCALABLE( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_SCALABLE )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1266,7 +1284,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_IS_SFNT( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_SFNT )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_SFNT )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1281,7 +1299,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_IS_FIXED_WIDTH( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1296,7 +1314,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_FIXED_SIZES( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1322,7 +1340,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_GLYPH_NAMES( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1337,7 +1355,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_MULTIPLE_MASTERS( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1355,7 +1373,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_IS_CID_KEYED( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1369,7 +1387,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_IS_TRICKY( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_TRICKY )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_TRICKY )
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
@@ -1383,7 +1401,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
*/
|
|
|
#define FT_HAS_COLOR( face ) \
|
|
|
- ( face->face_flags & FT_FACE_FLAG_COLOR )
|
|
|
+ ( (face)->face_flags & FT_FACE_FLAG_COLOR )
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
@@ -1392,7 +1410,7 @@ FT_BEGIN_HEADER
|
|
|
/* FT_STYLE_FLAG_XXX */
|
|
|
/* */
|
|
|
/* <Description> */
|
|
|
- /* A list of bit-flags used to indicate the style of a given face. */
|
|
|
+ /* A list of bit flags used to indicate the style of a given face. */
|
|
|
/* These are used in the `style_flags' field of @FT_FaceRec. */
|
|
|
/* */
|
|
|
/* <Values> */
|
|
|
@@ -1824,7 +1842,7 @@ FT_BEGIN_HEADER
|
|
|
/* FT_OPEN_XXX */
|
|
|
/* */
|
|
|
/* <Description> */
|
|
|
- /* A list of bit-field constants used within the `flags' field of the */
|
|
|
+ /* A list of bit field constants used within the `flags' field of the */
|
|
|
/* @FT_Open_Args structure. */
|
|
|
/* */
|
|
|
/* <Values> */
|
|
|
@@ -1923,7 +1941,7 @@ FT_BEGIN_HEADER
|
|
|
/* */
|
|
|
/* If the @FT_OPEN_MEMORY bit is set, assume that this is a */
|
|
|
/* memory file of `memory_size' bytes, located at `memory_address'. */
|
|
|
- /* The data are are not copied, and the client is responsible for */
|
|
|
+ /* The data are not copied, and the client is responsible for */
|
|
|
/* releasing and destroying them _after_ the corresponding call to */
|
|
|
/* @FT_Done_Face. */
|
|
|
/* */
|
|
|
@@ -1971,13 +1989,12 @@ FT_BEGIN_HEADER
|
|
|
/* <Input> */
|
|
|
/* pathname :: A path to the font file. */
|
|
|
/* */
|
|
|
- /* face_index :: The index of the face within the font. The first */
|
|
|
- /* face has index~0. */
|
|
|
+ /* face_index :: See @FT_Open_Face for a detailed description of this */
|
|
|
+ /* parameter. */
|
|
|
/* */
|
|
|
/* <Output> */
|
|
|
/* aface :: A handle to a new face object. If `face_index' is */
|
|
|
/* greater than or equal to zero, it must be non-NULL. */
|
|
|
- /* See @FT_Open_Face for more details. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
/* FreeType error code. 0~means success. */
|
|
|
@@ -2010,13 +2027,12 @@ FT_BEGIN_HEADER
|
|
|
/* */
|
|
|
/* file_size :: The size of the memory chunk used by the font data. */
|
|
|
/* */
|
|
|
- /* face_index :: The index of the face within the font. The first */
|
|
|
- /* face has index~0. */
|
|
|
+ /* face_index :: See @FT_Open_Face for a detailed description of this */
|
|
|
+ /* parameter. */
|
|
|
/* */
|
|
|
/* <Output> */
|
|
|
/* aface :: A handle to a new face object. If `face_index' is */
|
|
|
/* greater than or equal to zero, it must be non-NULL. */
|
|
|
- /* See @FT_Open_Face for more details. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
/* FreeType error code. 0~means success. */
|
|
|
@@ -2048,13 +2064,43 @@ FT_BEGIN_HEADER
|
|
|
/* args :: A pointer to an `FT_Open_Args' structure that must */
|
|
|
/* be filled by the caller. */
|
|
|
/* */
|
|
|
- /* face_index :: The index of the face within the font. The first */
|
|
|
- /* face has index~0. */
|
|
|
+ /* face_index :: This field holds two different values. Bits 0-15 */
|
|
|
+ /* are the index of the face in the font file (starting */
|
|
|
+ /* with value~0). Set it to~0 if there is only one */
|
|
|
+ /* face in the font file. */
|
|
|
+ /* */
|
|
|
+ /* Bits 16-30 are relevant to GX variation fonts only, */
|
|
|
+ /* specifying the named instance index for the current */
|
|
|
+ /* face index (starting with value~1; value~0 makes */
|
|
|
+ /* FreeType ignore named instances). For non-GX fonts, */
|
|
|
+ /* bits 16-30 are ignored. Assuming that you want to */
|
|
|
+ /* access the third named instance in face~4, */
|
|
|
+ /* `face_index' should be set to 0x00030004. If you */
|
|
|
+ /* want to access face~4 without GX variation handling, */
|
|
|
+ /* simply set `face_index' to value~4. */
|
|
|
+ /* */
|
|
|
+ /* FT_Open_Face and its siblings can be used to quickly */
|
|
|
+ /* check whether the font format of a given font */
|
|
|
+ /* resource is supported by FreeType. In general, if */
|
|
|
+ /* the `face_index' argument is negative, the */
|
|
|
+ /* function's return value is~0 if the font format is */
|
|
|
+ /* recognized, or non-zero otherwise. The function */
|
|
|
+ /* allocates a more or less empty face handle in */
|
|
|
+ /* `*aface' (if `aface' isn't NULL); the only two */
|
|
|
+ /* useful fields in this special case are */
|
|
|
+ /* `face->num_faces' and `face->style_flags'. For any */
|
|
|
+ /* negative value of `face_index', `face->num_faces' */
|
|
|
+ /* gives the number of faces within the font file. For */
|
|
|
+ /* the negative value `-(N+1)' (with `N' a 16-bit */
|
|
|
+ /* value), bits 16-30 in `face->style_flags' give the */
|
|
|
+ /* number of named instances in face `N' if we have a */
|
|
|
+ /* GX variation font (or zero otherwise). After */
|
|
|
+ /* examination, the returned @FT_Face structure should */
|
|
|
+ /* be deallocated with a call to @FT_Done_Face. */
|
|
|
/* */
|
|
|
/* <Output> */
|
|
|
/* aface :: A handle to a new face object. If `face_index' is */
|
|
|
/* greater than or equal to zero, it must be non-NULL. */
|
|
|
- /* See note below. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
/* FreeType error code. 0~means success. */
|
|
|
@@ -2064,16 +2110,6 @@ FT_BEGIN_HEADER
|
|
|
/* slot for the face object that can be accessed directly through */
|
|
|
/* `face->glyph'. */
|
|
|
/* */
|
|
|
- /* FT_Open_Face can be used to quickly check whether the font */
|
|
|
- /* format of a given font resource is supported by FreeType. If the */
|
|
|
- /* `face_index' field is negative, the function's return value is~0 */
|
|
|
- /* if the font format is recognized, or non-zero otherwise; */
|
|
|
- /* the function returns a more or less empty face handle in `*aface' */
|
|
|
- /* (if `aface' isn't NULL). The only useful field in this special */
|
|
|
- /* case is `face->num_faces' that gives the number of faces within */
|
|
|
- /* the font file. After examination, the returned @FT_Face structure */
|
|
|
- /* should be deallocated with a call to @FT_Done_Face. */
|
|
|
- /* */
|
|
|
/* Each new face object created with this function also owns a */
|
|
|
/* default @FT_Size object, accessible as `face->size'. */
|
|
|
/* */
|
|
|
@@ -2084,6 +2120,74 @@ FT_BEGIN_HEADER
|
|
|
/* See the discussion of reference counters in the description of */
|
|
|
/* @FT_Reference_Face. */
|
|
|
/* */
|
|
|
+ /* To loop over all faces, use code similar to the following snippet */
|
|
|
+ /* (omitting the error handling). */
|
|
|
+ /* */
|
|
|
+ /* { */
|
|
|
+ /* ... */
|
|
|
+ /* FT_Face face; */
|
|
|
+ /* FT_Long i, num_faces; */
|
|
|
+ /* */
|
|
|
+ /* */
|
|
|
+ /* error = FT_Open_Face( library, args, -1, &face ); */
|
|
|
+ /* if ( error ) { ... } */
|
|
|
+ /* */
|
|
|
+ /* num_faces = face->num_faces; */
|
|
|
+ /* FT_Done_Face( face ); */
|
|
|
+ /* */
|
|
|
+ /* for ( i = 0; i < num_faces; i++ ) */
|
|
|
+ /* { */
|
|
|
+ /* ... */
|
|
|
+ /* error = FT_Open_Face( library, args, i, &face ); */
|
|
|
+ /* ... */
|
|
|
+ /* FT_Done_Face( face ); */
|
|
|
+ /* ... */
|
|
|
+ /* } */
|
|
|
+ /* } */
|
|
|
+ /* */
|
|
|
+ /* To loop over all valid values for `face_index', use something */
|
|
|
+ /* similar to the following snippet, again without error handling. */
|
|
|
+ /* The code accesses all faces immediately (thus only a single call */
|
|
|
+ /* of `FT_Open_Face' within the do-loop), with and without named */
|
|
|
+ /* instances. */
|
|
|
+ /* */
|
|
|
+ /* { */
|
|
|
+ /* ... */
|
|
|
+ /* FT_Face face; */
|
|
|
+ /* */
|
|
|
+ /* FT_Long num_faces = 0; */
|
|
|
+ /* FT_Long num_instances = 0; */
|
|
|
+ /* */
|
|
|
+ /* FT_Long face_idx = 0; */
|
|
|
+ /* FT_Long instance_idx = 0; */
|
|
|
+ /* */
|
|
|
+ /* */
|
|
|
+ /* do */
|
|
|
+ /* { */
|
|
|
+ /* FT_Long id = ( instance_idx << 16 ) + face_idx; */
|
|
|
+ /* */
|
|
|
+ /* */
|
|
|
+ /* error = FT_Open_Face( library, args, id, &face ); */
|
|
|
+ /* if ( error ) { ... } */
|
|
|
+ /* */
|
|
|
+ /* num_faces = face->num_faces; */
|
|
|
+ /* num_instances = face->style_flags >> 16; */
|
|
|
+ /* */
|
|
|
+ /* ... */
|
|
|
+ /* */
|
|
|
+ /* FT_Done_Face( face ); */
|
|
|
+ /* */
|
|
|
+ /* if ( instance_idx < num_instances ) */
|
|
|
+ /* instance_idx++; */
|
|
|
+ /* else */
|
|
|
+ /* { */
|
|
|
+ /* face_idx++; */
|
|
|
+ /* instance_idx = 0; */
|
|
|
+ /* } */
|
|
|
+ /* */
|
|
|
+ /* } while ( face_idx < num_faces ) */
|
|
|
+ /* } */
|
|
|
+ /* */
|
|
|
FT_EXPORT( FT_Error )
|
|
|
FT_Open_Face( FT_Library library,
|
|
|
const FT_Open_Args* args,
|
|
|
@@ -2235,9 +2339,9 @@ FT_BEGIN_HEADER
|
|
|
/* used to determine both scaling values. */
|
|
|
/* */
|
|
|
/* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
|
|
|
- /* The real dimension. The sum of the the `ascender' and (minus */
|
|
|
- /* of) the `descender' fields of @FT_FaceRec are used to determine */
|
|
|
- /* both scaling values. */
|
|
|
+ /* The real dimension. The sum of the `ascender' and (minus of) */
|
|
|
+ /* the `descender' fields of @FT_FaceRec are used to determine both */
|
|
|
+ /* scaling values. */
|
|
|
/* */
|
|
|
/* FT_SIZE_REQUEST_TYPE_BBOX :: */
|
|
|
/* The font bounding box. The width and height of the `bbox' field */
|
|
|
@@ -2474,6 +2578,10 @@ FT_BEGIN_HEADER
|
|
|
/* don't have a corresponding glyph in the font). See the discussion */
|
|
|
/* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
|
|
|
/* */
|
|
|
+ /* If you receive `FT_Err_Glyph_Too_Big', try getting the glyph */
|
|
|
+ /* outline at EM size, then scale it manually and fill it as a */
|
|
|
+ /* graphics operation. */
|
|
|
+ /* */
|
|
|
FT_EXPORT( FT_Error )
|
|
|
FT_Load_Glyph( FT_Face face,
|
|
|
FT_UInt glyph_index,
|
|
|
@@ -2521,7 +2629,7 @@ FT_BEGIN_HEADER
|
|
|
* FT_LOAD_XXX
|
|
|
*
|
|
|
* @description:
|
|
|
- * A list of bit-field constants used with @FT_Load_Glyph to indicate
|
|
|
+ * A list of bit field constants used with @FT_Load_Glyph to indicate
|
|
|
* what kind of operations to perform during glyph loading.
|
|
|
*
|
|
|
* @values:
|
|
|
@@ -2638,6 +2746,16 @@ FT_BEGIN_HEADER
|
|
|
* bitmaps transparently. Those bitmaps will be in the
|
|
|
* @FT_PIXEL_MODE_GRAY format.
|
|
|
*
|
|
|
+ * FT_LOAD_COMPUTE_METRICS ::
|
|
|
+ * This flag sets computing glyph metrics without the use of bundled
|
|
|
+ * metrics tables (for example, the `hdmx' table in TrueType fonts).
|
|
|
+ * Well-behaving fonts have optimized bundled metrics and these should
|
|
|
+ * be used. This flag is mainly used by font validating or font
|
|
|
+ * editing applications, which need to ignore, verify, or edit those
|
|
|
+ * tables.
|
|
|
+ *
|
|
|
+ * Currently, this flag is only implemented for TrueType fonts.
|
|
|
+ *
|
|
|
* FT_LOAD_CROP_BITMAP ::
|
|
|
* Ignored. Deprecated.
|
|
|
*
|
|
|
@@ -2683,6 +2801,7 @@ FT_BEGIN_HEADER
|
|
|
#define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
|
|
|
/* Bits 16..19 are used by `FT_LOAD_TARGET_' */
|
|
|
#define FT_LOAD_COLOR ( 1L << 20 )
|
|
|
+#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 )
|
|
|
|
|
|
/* */
|
|
|
|
|
|
@@ -2705,9 +2824,6 @@ FT_BEGIN_HEADER
|
|
|
* have specified (e.g., the TrueType bytecode interpreter). You can set
|
|
|
* @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
|
|
|
*
|
|
|
- * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
|
|
|
- * always implies @FT_LOAD_FORCE_AUTOHINT.
|
|
|
- *
|
|
|
* @values:
|
|
|
* FT_LOAD_TARGET_NORMAL ::
|
|
|
* This corresponds to the default hinting algorithm, optimized for
|
|
|
@@ -2715,11 +2831,14 @@ FT_BEGIN_HEADER
|
|
|
* @FT_LOAD_TARGET_MONO instead.
|
|
|
*
|
|
|
* FT_LOAD_TARGET_LIGHT ::
|
|
|
- * A lighter hinting algorithm for non-monochrome modes. Many
|
|
|
- * generated glyphs are more fuzzy but better resemble its original
|
|
|
- * shape. A bit like rendering on Mac OS~X.
|
|
|
- *
|
|
|
- * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
|
|
|
+ * A lighter hinting algorithm for gray-level modes. Many generated
|
|
|
+ * glyphs are fuzzier but better resemble their original shape. This
|
|
|
+ * is achieved by snapping glyphs to the pixel grid only vertically
|
|
|
+ * (Y-axis), as is done by Microsoft's ClearType and Adobe's
|
|
|
+ * proprietary font renderer. This preserves inter-glyph spacing in
|
|
|
+ * horizontal text. The snapping is done either by the native font
|
|
|
+ * driver if the driver itself and the font support it or by the
|
|
|
+ * auto-hinter.
|
|
|
*
|
|
|
* FT_LOAD_TARGET_MONO ::
|
|
|
* Strong hinting algorithm that should only be used for monochrome
|
|
|
@@ -2740,7 +2859,7 @@ FT_BEGIN_HEADER
|
|
|
*
|
|
|
* If @FT_LOAD_RENDER is also set, the glyph is rendered in the
|
|
|
* corresponding mode (i.e., the mode that matches the used algorithm
|
|
|
- * best). An exeption is FT_LOAD_TARGET_MONO since it implies
|
|
|
+ * best). An exception is FT_LOAD_TARGET_MONO since it implies
|
|
|
* @FT_LOAD_MONOCHROME.
|
|
|
*
|
|
|
* You can use a hinting algorithm that doesn't correspond to the same
|
|
|
@@ -2826,7 +2945,10 @@ FT_BEGIN_HEADER
|
|
|
/* field in the @FT_GlyphSlotRec structure gives the format of the */
|
|
|
/* returned bitmap. */
|
|
|
/* */
|
|
|
- /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
|
|
|
+ /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity, */
|
|
|
+ /* indicating pixel coverage. Use linear alpha blending and gamma */
|
|
|
+ /* correction to correctly render non-monochrome glyph bitmaps onto a */
|
|
|
+ /* surface; see @FT_Render_Glyph. */
|
|
|
/* */
|
|
|
/* <Values> */
|
|
|
/* FT_RENDER_MODE_NORMAL :: */
|
|
|
@@ -2912,6 +3034,83 @@ FT_BEGIN_HEADER
|
|
|
/* To get meaningful results, font scaling values must be set with */
|
|
|
/* functions like @FT_Set_Char_Size before calling FT_Render_Glyph. */
|
|
|
/* */
|
|
|
+ /* When FreeType outputs a bitmap of a glyph, it really outputs an */
|
|
|
+ /* alpha coverage map. If a pixel is completely covered by a */
|
|
|
+ /* filled-in outline, the bitmap contains 0xFF at that pixel, meaning */
|
|
|
+ /* that 0xFF/0xFF fraction of that pixel is covered, meaning the */
|
|
|
+ /* pixel is 100% black (or 0% bright). If a pixel is only 50% */
|
|
|
+ /* covered (value 0x80), the pixel is made 50% black (50% bright or a */
|
|
|
+ /* middle shade of grey). 0% covered means 0% black (100% bright or */
|
|
|
+ /* white). */
|
|
|
+ /* */
|
|
|
+ /* On high-DPI screens like on smartphones and tablets, the pixels */
|
|
|
+ /* are so small that their chance of being completely covered and */
|
|
|
+ /* therefore completely black are fairly good. On the low-DPI */
|
|
|
+ /* screens, however, the situation is different. The pixels are too */
|
|
|
+ /* large for most of the details of a glyph and shades of gray are */
|
|
|
+ /* the norm rather than the exception. */
|
|
|
+ /* */
|
|
|
+ /* This is relevant because all our screens have a second problem: */
|
|
|
+ /* they are not linear. 1~+~1 is not~2. Twice the value does not */
|
|
|
+ /* result in twice the brightness. When a pixel is only 50% covered, */
|
|
|
+ /* the coverage map says 50% black, and this translates to a pixel */
|
|
|
+ /* value of 128 when you use 8~bits per channel (0-255). However, */
|
|
|
+ /* this does not translate to 50% brightness for that pixel on our */
|
|
|
+ /* sRGB and gamma~2.2 screens. Due to their non-linearity, they */
|
|
|
+ /* dwell longer in the darks and only a pixel value of about 186 */
|
|
|
+ /* results in 50% brightness – 128 ends up too dark on both bright */
|
|
|
+ /* and dark backgrounds. The net result is that dark text looks */
|
|
|
+ /* burnt-out, pixely and blotchy on bright background, bright text */
|
|
|
+ /* too frail on dark backgrounds, and colored text on colored */
|
|
|
+ /* background (for example, red on green) seems to have dark halos or */
|
|
|
+ /* `dirt' around it. The situation is especially ugly for diagonal */
|
|
|
+ /* stems like in `w' glyph shapes where the quality of FreeType's */
|
|
|
+ /* anti-aliasing depends on the correct display of grays. On */
|
|
|
+ /* high-DPI screens where smaller, fully black pixels reign supreme, */
|
|
|
+ /* this doesn't matter, but on our low-DPI screens with all the gray */
|
|
|
+ /* shades, it does. 0% and 100% brightness are the same things in */
|
|
|
+ /* linear and non-linear space, just all the shades in-between */
|
|
|
+ /* aren't. */
|
|
|
+ /* */
|
|
|
+ /* The blending function for placing text over a background is */
|
|
|
+ /* */
|
|
|
+ /* { */
|
|
|
+ /* dst = alpha * src + (1 - alpha) * dst , */
|
|
|
+ /* } */
|
|
|
+ /* */
|
|
|
+ /* which is known as the OVER operator. */
|
|
|
+ /* */
|
|
|
+ /* To correctly composite an antialiased pixel of a glyph onto a */
|
|
|
+ /* surface, */
|
|
|
+ /* */
|
|
|
+ /* 1. take the foreground and background colors (e.g., in sRGB space) */
|
|
|
+ /* and apply gamma to get them in a linear space, */
|
|
|
+ /* */
|
|
|
+ /* 2. use OVER to blend the two linear colors using the glyph pixel */
|
|
|
+ /* as the alpha value (remember, the glyph bitmap is an alpha */
|
|
|
+ /* coverage bitmap), and */
|
|
|
+ /* */
|
|
|
+ /* 3. apply inverse gamma to the blended pixel and write it back to */
|
|
|
+ /* the image. */
|
|
|
+ /* */
|
|
|
+ /* Internal testing at Adobe found that a target inverse gamma of~1.8 */
|
|
|
+ /* for step~3 gives good results across a wide range of displays with */
|
|
|
+ /* an sRGB gamma curve or a similar one. */
|
|
|
+ /* */
|
|
|
+ /* This process can cost performance. There is an approximation that */
|
|
|
+ /* does not need to know about the background color; see */
|
|
|
+ /* https://bel.fi/alankila/lcd/ and */
|
|
|
+ /* https://bel.fi/alankila/lcd/alpcor.html for details. */
|
|
|
+ /* */
|
|
|
+ /* *ATTENTION*: Linear blending is even more important when dealing */
|
|
|
+ /* with subpixel-rendered glyphs to prevent color-fringing! A */
|
|
|
+ /* subpixel-rendered glyph must first be filtered with a filter that */
|
|
|
+ /* gives equal weight to the three color primaries and does not */
|
|
|
+ /* exceed a sum of 0x100, see section @lcd_filtering. Then the */
|
|
|
+ /* only difference to gray linear blending is that subpixel-rendered */
|
|
|
+ /* linear blending is done 3~times per pixel: red foreground subpixel */
|
|
|
+ /* to red background subpixel and so on for green and blue. */
|
|
|
+ /* */
|
|
|
FT_EXPORT( FT_Error )
|
|
|
FT_Render_Glyph( FT_GlyphSlot slot,
|
|
|
FT_Render_Mode render_mode );
|
|
|
@@ -2927,15 +3126,22 @@ FT_BEGIN_HEADER
|
|
|
/* @FT_Get_Kerning. */
|
|
|
/* */
|
|
|
/* <Values> */
|
|
|
- /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
|
|
|
- /* distances (value is~0). */
|
|
|
+ /* FT_KERNING_DEFAULT :: Return grid-fitted kerning distances in */
|
|
|
+ /* pixels (value is~0). Whether they are */
|
|
|
+ /* scaled depends on @FT_LOAD_NO_SCALE. */
|
|
|
/* */
|
|
|
- /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
|
|
|
- /* distances. */
|
|
|
+ /* FT_KERNING_UNFITTED :: Return un-grid-fitted kerning distances in */
|
|
|
+ /* 26.6 fractional pixels. Whether they are */
|
|
|
+ /* scaled depends on @FT_LOAD_NO_SCALE. */
|
|
|
/* */
|
|
|
/* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
|
|
|
/* units. */
|
|
|
/* */
|
|
|
+ /* <Note> */
|
|
|
+ /* FT_KERNING_DEFAULT returns full pixel values; it also makes */
|
|
|
+ /* FreeType heuristically scale down kerning distances at small ppem */
|
|
|
+ /* values so that they don't become too big. */
|
|
|
+ /* */
|
|
|
typedef enum FT_Kerning_Mode_
|
|
|
{
|
|
|
FT_KERNING_DEFAULT = 0,
|
|
|
@@ -2972,9 +3178,10 @@ FT_BEGIN_HEADER
|
|
|
/* kerning vector. */
|
|
|
/* */
|
|
|
/* <Output> */
|
|
|
- /* akerning :: The kerning vector. This is either in font units */
|
|
|
- /* or in pixels (26.6 format) for scalable formats, */
|
|
|
- /* and in pixels for fixed-sizes formats. */
|
|
|
+ /* akerning :: The kerning vector. This is either in font units, */
|
|
|
+ /* fractional pixels (26.6 format), or pixels for */
|
|
|
+ /* scalable formats, and in pixels for fixed-sizes */
|
|
|
+ /* formats. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
/* FreeType error code. 0~means success. */
|
|
|
@@ -3070,7 +3277,7 @@ FT_BEGIN_HEADER
|
|
|
/* `.notdef'). */
|
|
|
/* */
|
|
|
/* This function always returns an error if the config macro */
|
|
|
- /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoptions.h'. */
|
|
|
+ /* `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is not defined in `ftoption.h'. */
|
|
|
/* */
|
|
|
FT_EXPORT( FT_Error )
|
|
|
FT_Get_Glyph_Name( FT_Face face,
|
|
|
@@ -3259,6 +3466,13 @@ FT_BEGIN_HEADER
|
|
|
/* } */
|
|
|
/* } */
|
|
|
/* */
|
|
|
+ /* Be aware that character codes can have values up to 0xFFFFFFFF; */
|
|
|
+ /* this might happen for non-Unicode or malformed cmaps. However, */
|
|
|
+ /* even with regular Unicode encoding, so-called `last resort fonts' */
|
|
|
+ /* (using SFNT cmap format 13, see function @FT_Get_CMap_Format) */
|
|
|
+ /* normally have entries for all Unicode characters up to 0x1FFFFF, */
|
|
|
+ /* which can cause *a lot* of iterations. */
|
|
|
+ /* */
|
|
|
/* Note that `*agindex' is set to~0 if the charmap is empty. The */
|
|
|
/* result itself can be~0 in two cases: if the charmap is empty or */
|
|
|
/* if the value~0 is the first valid character code. */
|
|
|
@@ -3454,6 +3668,9 @@ FT_BEGIN_HEADER
|
|
|
/* bitmaps available in the font, then the font is unembeddable. */
|
|
|
/* */
|
|
|
/* <Note> */
|
|
|
+ /* The flags are ORed together, thus more than a single value can be */
|
|
|
+ /* returned. */
|
|
|
+ /* */
|
|
|
/* While the fsType flags can indicate that a font may be embedded, a */
|
|
|
/* license with the font vendor may be separately required to use the */
|
|
|
/* font in this way. */
|
|
|
@@ -3839,7 +4056,8 @@ FT_BEGIN_HEADER
|
|
|
/* a :: The number to be rounded. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
- /* The result of `(a + 0x8000) & -0x10000'. */
|
|
|
+ /* `a' rounded to nearest 16.16 fixed integer, halfway cases away */
|
|
|
+ /* from zero. */
|
|
|
/* */
|
|
|
FT_EXPORT( FT_Fixed )
|
|
|
FT_RoundFix( FT_Fixed a );
|
|
|
@@ -3858,7 +4076,7 @@ FT_BEGIN_HEADER
|
|
|
/* a :: The number for which the ceiling function is to be computed. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
- /* The result of `(a + 0x10000 - 1) & -0x10000'. */
|
|
|
+ /* `a' rounded towards plus infinity. */
|
|
|
/* */
|
|
|
FT_EXPORT( FT_Fixed )
|
|
|
FT_CeilFix( FT_Fixed a );
|
|
|
@@ -3877,7 +4095,7 @@ FT_BEGIN_HEADER
|
|
|
/* a :: The number for which the floor function is to be computed. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
- /* The result of `a & -0x10000'. */
|
|
|
+ /* `a' rounded towards minus infinity. */
|
|
|
/* */
|
|
|
FT_EXPORT( FT_Fixed )
|
|
|
FT_FloorFix( FT_Fixed a );
|
|
|
@@ -3958,7 +4176,7 @@ FT_BEGIN_HEADER
|
|
|
*/
|
|
|
#define FREETYPE_MAJOR 2
|
|
|
#define FREETYPE_MINOR 6
|
|
|
-#define FREETYPE_PATCH 0
|
|
|
+#define FREETYPE_PATCH 5
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
@@ -4003,20 +4221,13 @@ FT_BEGIN_HEADER
|
|
|
/* FT_Face_CheckTrueTypePatents */
|
|
|
/* */
|
|
|
/* <Description> */
|
|
|
- /* Parse all bytecode instructions of a TrueType font file to check */
|
|
|
- /* whether any of the patented opcodes are used. This is only useful */
|
|
|
- /* if you want to be able to use the unpatented hinter with */
|
|
|
- /* fonts that do *not* use these opcodes. */
|
|
|
- /* */
|
|
|
- /* Note that this function parses *all* glyph instructions in the */
|
|
|
- /* font file, which may be slow. */
|
|
|
+ /* Deprecated, does nothing. */
|
|
|
/* */
|
|
|
/* <Input> */
|
|
|
/* face :: A face handle. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
- /* 1~if this is a TrueType font that uses one of the patented */
|
|
|
- /* opcodes, 0~otherwise. */
|
|
|
+ /* Always returns false. */
|
|
|
/* */
|
|
|
/* <Note> */
|
|
|
/* Since May 2010, TrueType hinting is no longer patented. */
|
|
|
@@ -4034,9 +4245,7 @@ FT_BEGIN_HEADER
|
|
|
/* FT_Face_SetUnpatentedHinting */
|
|
|
/* */
|
|
|
/* <Description> */
|
|
|
- /* Enable or disable the unpatented hinter for a given face. */
|
|
|
- /* Only enable it if you have determined that the face doesn't */
|
|
|
- /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
|
|
|
+ /* Deprecated, does nothing. */
|
|
|
/* */
|
|
|
/* <Input> */
|
|
|
/* face :: A face handle. */
|
|
|
@@ -4044,9 +4253,7 @@ FT_BEGIN_HEADER
|
|
|
/* value :: New boolean setting. */
|
|
|
/* */
|
|
|
/* <Return> */
|
|
|
- /* The old setting value. This will always be false if this is not */
|
|
|
- /* an SFNT font, or if the unpatented hinter is not compiled in this */
|
|
|
- /* instance of the library. */
|
|
|
+ /* Always returns false. */
|
|
|
/* */
|
|
|
/* <Note> */
|
|
|
/* Since May 2010, TrueType hinting is no longer patented. */
|
|
|
@@ -4063,7 +4270,7 @@ FT_BEGIN_HEADER
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
|
-#endif /* __FREETYPE_H__ */
|
|
|
+#endif /* FREETYPE_H_ */
|
|
|
|
|
|
|
|
|
/* END */
|