Index: third_party/freetype/include/freetype/freetype.h |
diff --git a/third_party/freetype/include/freetype.h b/third_party/freetype/include/freetype/freetype.h |
similarity index 94% |
rename from third_party/freetype/include/freetype.h |
rename to third_party/freetype/include/freetype/freetype.h |
index efbd13ad8358e098010f6eabb9d73a2a87ee6a5e..b6247f510f030306b62a81f5ebb039354d8e68bd 100644 |
--- a/third_party/freetype/include/freetype.h |
+++ b/third_party/freetype/include/freetype/freetype.h |
@@ -4,7 +4,7 @@ |
/* */ |
/* FreeType high-level API and common types (specification only). */ |
/* */ |
-/* Copyright 1996-2014 by */ |
+/* Copyright 1996-2015 by */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* */ |
/* This file is part of the FreeType project, and may only be used, */ |
@@ -394,8 +394,11 @@ FT_BEGIN_HEADER |
/* It also embeds a memory manager (see @FT_Memory), as well as a */ |
/* scan-line converter object (see @FT_Raster). */ |
/* */ |
- /* In multi-threaded applications, make sure that the same FT_Library */ |
- /* object or any of its children doesn't get accessed in parallel. */ |
+ /* In multi-threaded applications it is easiest to use one */ |
+ /* `FT_Library' object per thread. In case this is too cumbersome, */ |
+ /* a single `FT_Library' object across threads is possible also */ |
+ /* (since FreeType version 2.5.6), as long as a mutex lock is used */ |
+ /* around @FT_New_Face and @FT_Done_Face. */ |
/* */ |
/* <Note> */ |
/* Library objects are normally created by @FT_Init_FreeType, and */ |
@@ -477,6 +480,14 @@ FT_BEGIN_HEADER |
/* */ |
/* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ |
/* */ |
+ /* An `FT_Face' object can only be safely used from one thread at a */ |
+ /* time. Similarly, creation and destruction of `FT_Face' with the */ |
+ /* same @FT_Library object can only be done from one thread at a */ |
+ /* time. On the other hand, functions like @FT_Load_Glyph and its */ |
+ /* siblings are thread-safe and do not need the lock to be held as */ |
+ /* long as the same `FT_Face' object is not used from multiple */ |
+ /* threads at the same time. */ |
+ /* */ |
/* <Also> */ |
/* See @FT_FaceRec for the publicly accessible fields of a given face */ |
/* object. */ |
@@ -631,9 +642,13 @@ FT_BEGIN_HEADER |
/* */ |
/* FT_ENCODING_MS_SYMBOL :: */ |
/* Corresponds to the Microsoft Symbol encoding, used to encode */ |
- /* mathematical symbols in the 32..255 character code range. For */ |
- /* more information, see */ |
- /* `http://www.kostis.net/charsets/symbol.htm'. */ |
+ /* mathematical symbols and wingdings. For more information, see */ |
+ /* `http://www.microsoft.com/typography/otspec/recom.htm', */ |
+ /* `http://www.kostis.net/charsets/symbol.htm', and */ |
+ /* `http://www.kostis.net/charsets/wingding.htm'. */ |
+ /* */ |
+ /* This encoding uses character codes from the PUA (Private Unicode */ |
+ /* Area) in the range U+F020-U+F0FF. */ |
/* */ |
/* FT_ENCODING_SJIS :: */ |
/* Corresponds to Japanese SJIS encoding. More info at */ |
@@ -651,7 +666,7 @@ FT_BEGIN_HEADER |
/* FT_ENCODING_WANSUNG :: */ |
/* Corresponds to the Korean encoding system known as Wansung. */ |
/* For more information see */ |
- /* `http://msdn.microsoft.com/en-US/goglobal/cc305154'. */ |
+ /* `https://msdn.microsoft.com/en-US/goglobal/cc305154'. */ |
/* */ |
/* FT_ENCODING_JOHAB :: */ |
/* The Korean standard character set (KS~C 5601-1992), which */ |
@@ -861,17 +876,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 */ |
@@ -893,6 +927,11 @@ FT_BEGIN_HEADER |
/* Can be NULL (e.g., in fonts embedded in a */ |
/* PDF file). */ |
/* */ |
+ /* In case the font doesn't provide a specific */ |
+ /* family name entry, FreeType tries to */ |
+ /* synthesize one, deriving it from other name */ |
+ /* entries. */ |
+ /* */ |
/* style_name :: The face's style name. This is an ASCII */ |
/* string, usually in English, that describes */ |
/* the typeface's style (like `Italic', */ |
@@ -1140,7 +1179,7 @@ FT_BEGIN_HEADER |
/* TrueType bytecode instructions to move and scale all of its */ |
/* subglyphs. */ |
/* */ |
- /* It is not possible to autohint such fonts using */ |
+ /* It is not possible to auto-hint such fonts using */ |
/* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ |
/* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ |
/* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ |
@@ -1372,7 +1411,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> */ |
@@ -1649,11 +1688,11 @@ FT_BEGIN_HEADER |
/* needs to know about the image format. */ |
/* */ |
/* lsb_delta :: The difference between hinted and unhinted */ |
- /* left side bearing while autohinting is */ |
+ /* left side bearing while auto-hinting is */ |
/* active. Zero otherwise. */ |
/* */ |
/* rsb_delta :: The difference between hinted and unhinted */ |
- /* right side bearing while autohinting is */ |
+ /* right side bearing while auto-hinting is */ |
/* active. Zero otherwise. */ |
/* */ |
/* <Note> */ |
@@ -1676,7 +1715,7 @@ FT_BEGIN_HEADER |
/* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ |
/* */ |
/* <Note> */ |
- /* Here a small pseudo code fragment that shows how to use */ |
+ /* Here is a small pseudo code fragment that shows how to use */ |
/* `lsb_delta' and `rsb_delta': */ |
/* */ |
/* { */ |
@@ -1769,8 +1808,8 @@ FT_BEGIN_HEADER |
/* use @FT_New_Library instead, followed by a call to */ |
/* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ |
/* */ |
- /* For multi-threading applications each thread should have its own */ |
- /* FT_Library object. */ |
+ /* See the documentation of @FT_Library and @FT_Face for */ |
+ /* multi-threading issues. */ |
/* */ |
/* If you need reference-counting (cf. @FT_Reference_Library), use */ |
/* @FT_New_Library and @FT_Done_Library. */ |
@@ -1804,7 +1843,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> */ |
@@ -1951,13 +1990,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. */ |
@@ -1990,13 +2028,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. */ |
@@ -2028,13 +2065,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. */ |
@@ -2044,16 +2111,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'. */ |
/* */ |
@@ -2064,6 +2121,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, |
@@ -2501,7 +2626,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: |
@@ -2618,6 +2743,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. |
* |
@@ -2663,6 +2798,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 ) |
/* */ |
@@ -2907,15 +3043,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, |
@@ -2952,9 +3095,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. */ |
@@ -3239,6 +3383,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. */ |
@@ -3398,8 +3549,9 @@ FT_BEGIN_HEADER |
/* @FT_Get_FSType_Flags; they inform client applications of embedding */ |
/* and subsetting restrictions associated with a font. */ |
/* */ |
- /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */ |
- /* more details. */ |
+ /* See */ |
+ /* http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf */ |
+ /* for more details. */ |
/* */ |
/* <Values> */ |
/* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ |
@@ -3433,6 +3585,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. */ |
@@ -3818,7 +3973,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 ); |
@@ -3837,7 +3993,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 ); |
@@ -3856,7 +4012,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 ); |
@@ -3936,8 +4092,8 @@ FT_BEGIN_HEADER |
* |
*/ |
#define FREETYPE_MAJOR 2 |
-#define FREETYPE_MINOR 5 |
-#define FREETYPE_PATCH 4 |
+#define FREETYPE_MINOR 6 |
+#define FREETYPE_PATCH 1 |
/*************************************************************************/ |