Commit 57023a55 authored by Adrian Biagioli's avatar Adrian Biagioli
Browse files

Update freetype and drawsvg_ref.dll so on Win64 DrawSVG builds correctly

parent ab7caec5
/***************************************************************************/ /****************************************************************************
/* */ *
/* ftheader.h */ * ftheader.h
/* */ *
/* Build macros of the FreeType 2 library. */ * Build macros of the FreeType 2 library.
/* */ *
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */ * Copyright (C) 1996-2019 by
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ * David Turner, Robert Wilhelm, and Werner Lemberg.
/* */ *
/* This file is part of the FreeType project, and may only be used, */ * This file is part of the FreeType project, and may only be used,
/* modified, and distributed under the terms of the FreeType project */ * modified, and distributed under the terms of the FreeType project
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ * license, LICENSE.TXT. By continuing to use, modify, or distribute
/* this file you indicate that you have read the license and */ * this file you indicate that you have read the license and
/* understand and accept it fully. */ * understand and accept it fully.
/* */ *
/***************************************************************************/ */
#ifndef __FT_HEADER_H__ #ifndef FTHEADER_H_
#define __FT_HEADER_H__ #define FTHEADER_H_
/*@***********************************************************************/ /*@***********************************************************************/
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* <Description> */ /* <Description> */
/* This macro is used in association with @FT_END_HEADER in header */ /* This macro is used in association with @FT_END_HEADER in header */
/* files to ensure that the declarations within are properly */ /* files to ensure that the declarations within are properly */
/* encapsulated in an `extern "C" { .. }' block when included from a */ /* encapsulated in an `extern "C" { .. }` block when included from a */
/* C++ compiler. */ /* C++ compiler. */
/* */ /* */
#ifdef __cplusplus #ifdef __cplusplus
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
/* <Description> */ /* <Description> */
/* This macro is used in association with @FT_BEGIN_HEADER in header */ /* This macro is used in association with @FT_BEGIN_HEADER in header */
/* files to ensure that the declarations within are properly */ /* files to ensure that the declarations within are properly */
/* encapsulated in an `extern "C" { .. }' block when included from a */ /* encapsulated in an `extern "C" { .. }` block when included from a */
/* C++ compiler. */ /* C++ compiler. */
/* */ /* */
#ifdef __cplusplus #ifdef __cplusplus
...@@ -55,55 +55,55 @@ ...@@ -55,55 +55,55 @@
#endif #endif
/*************************************************************************/ /**************************************************************************
/* */ *
/* Aliases for the FreeType 2 public and configuration files. */ * Aliases for the FreeType 2 public and configuration files.
/* */ *
/*************************************************************************/ */
/*************************************************************************/ /**************************************************************************
/* */ *
/* <Section> */ * @section:
/* header_file_macros */ * header_file_macros
/* */ *
/* <Title> */ * @title:
/* Header File Macros */ * Header File Macros
/* */ *
/* <Abstract> */ * @abstract:
/* Macro definitions used to #include specific header files. */ * Macro definitions used to `#include` specific header files.
/* */ *
/* <Description> */ * @description:
/* The following macros are defined to the name of specific */ * The following macros are defined to the name of specific FreeType~2
/* FreeType 2 header files. They can be used directly in #include */ * header files. They can be used directly in `#include` statements as
/* statements as in: */ * in:
/* */ *
/* { */ * ```
/* #include FT_FREETYPE_H */ * #include FT_FREETYPE_H
/* #include FT_MULTIPLE_MASTERS_H */ * #include FT_MULTIPLE_MASTERS_H
/* #include FT_GLYPH_H */ * #include FT_GLYPH_H
/* } */ * ```
/* */ *
/* There are several reasons why we are now using macros to name */ * There are several reasons why we are now using macros to name public
/* public header files. The first one is that such macros are not */ * header files. The first one is that such macros are not limited to
/* limited to the infamous 8.3 naming rule required by DOS (and */ * the infamous 8.3~naming rule required by DOS (and
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ * `FT_MULTIPLE_MASTERS_H` is a lot more meaningful than `ftmm.h`).
/* */ *
/* The second reason is that it allows for more flexibility in the */ * The second reason is that it allows for more flexibility in the way
/* way FreeType 2 is installed on a given system. */ * FreeType~2 is installed on a given system.
/* */ *
/*************************************************************************/ */
/* configuration files */ /* configuration files */
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_CONFIG_CONFIG_H * FT_CONFIG_CONFIG_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing * A macro used in `#include` statements to name the file containing
* FreeType 2 configuration data. * FreeType~2 configuration data.
* *
*/ */
#ifndef FT_CONFIG_CONFIG_H #ifndef FT_CONFIG_CONFIG_H
...@@ -111,14 +111,14 @@ ...@@ -111,14 +111,14 @@
#endif #endif
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_CONFIG_STANDARD_LIBRARY_H * FT_CONFIG_STANDARD_LIBRARY_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing * A macro used in `#include` statements to name the file containing
* FreeType 2 interface to the standard C library functions. * FreeType~2 interface to the standard C library functions.
* *
*/ */
#ifndef FT_CONFIG_STANDARD_LIBRARY_H #ifndef FT_CONFIG_STANDARD_LIBRARY_H
...@@ -126,14 +126,14 @@ ...@@ -126,14 +126,14 @@
#endif #endif
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_CONFIG_OPTIONS_H * FT_CONFIG_OPTIONS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing * A macro used in `#include` statements to name the file containing
* FreeType 2 project-specific configuration options. * FreeType~2 project-specific configuration options.
* *
*/ */
#ifndef FT_CONFIG_OPTIONS_H #ifndef FT_CONFIG_OPTIONS_H
...@@ -141,14 +141,14 @@ ...@@ -141,14 +141,14 @@
#endif #endif
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_CONFIG_MODULES_H * FT_CONFIG_MODULES_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* list of FreeType 2 modules that are statically linked to new library * list of FreeType~2 modules that are statically linked to new library
* instances in @FT_Init_FreeType. * instances in @FT_Init_FreeType.
* *
*/ */
...@@ -156,30 +156,31 @@ ...@@ -156,30 +156,31 @@
#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h> #define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
#endif #endif
/* */
/* public headers */ /* public headers */
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_FREETYPE_H * FT_FREETYPE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* base FreeType 2 API. * base FreeType~2 API.
* *
*/ */
#define FT_FREETYPE_H <freetype/freetype.h> #define FT_FREETYPE_H <freetype/freetype.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_ERRORS_H * FT_ERRORS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* list of FreeType 2 error codes (and messages). * list of FreeType~2 error codes (and messages).
* *
* It is included by @FT_FREETYPE_H. * It is included by @FT_FREETYPE_H.
* *
...@@ -187,27 +188,27 @@ ...@@ -187,27 +188,27 @@
#define FT_ERRORS_H <freetype/fterrors.h> #define FT_ERRORS_H <freetype/fterrors.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_MODULE_ERRORS_H * FT_MODULE_ERRORS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* list of FreeType 2 module error offsets (and messages). * list of FreeType~2 module error offsets (and messages).
* *
*/ */
#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h> #define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_SYSTEM_H * FT_SYSTEM_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 interface to low-level operations (i.e., memory management * FreeType~2 interface to low-level operations (i.e., memory management
* and stream i/o). * and stream i/o).
* *
* It is included by @FT_FREETYPE_H. * It is included by @FT_FREETYPE_H.
...@@ -216,13 +217,13 @@ ...@@ -216,13 +217,13 @@
#define FT_SYSTEM_H <freetype/ftsystem.h> #define FT_SYSTEM_H <freetype/ftsystem.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_IMAGE_H * FT_IMAGE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing type * A macro used in `#include` statements to name the file containing type
* definitions related to glyph images (i.e., bitmaps, outlines, * definitions related to glyph images (i.e., bitmaps, outlines,
* scan-converter parameters). * scan-converter parameters).
* *
...@@ -232,14 +233,14 @@ ...@@ -232,14 +233,14 @@
#define FT_IMAGE_H <freetype/ftimage.h> #define FT_IMAGE_H <freetype/ftimage.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_TYPES_H * FT_TYPES_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* basic data types defined by FreeType 2. * basic data types defined by FreeType~2.
* *
* It is included by @FT_FREETYPE_H. * It is included by @FT_FREETYPE_H.
* *
...@@ -247,14 +248,14 @@ ...@@ -247,14 +248,14 @@
#define FT_TYPES_H <freetype/fttypes.h> #define FT_TYPES_H <freetype/fttypes.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_LIST_H * FT_LIST_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* list management API of FreeType 2. * list management API of FreeType~2.
* *
* (Most applications will never need to include this file.) * (Most applications will never need to include this file.)
* *
...@@ -262,78 +263,151 @@ ...@@ -262,78 +263,151 @@
#define FT_LIST_H <freetype/ftlist.h> #define FT_LIST_H <freetype/ftlist.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_OUTLINE_H * FT_OUTLINE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* scalable outline management API of FreeType 2. * scalable outline management API of FreeType~2.
* *
*/ */
#define FT_OUTLINE_H <freetype/ftoutln.h> #define FT_OUTLINE_H <freetype/ftoutln.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_SIZES_H * FT_SIZES_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* API which manages multiple @FT_Size objects per face. * API which manages multiple @FT_Size objects per face.
* *
*/ */
#define FT_SIZES_H <freetype/ftsizes.h> #define FT_SIZES_H <freetype/ftsizes.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_MODULE_H * FT_MODULE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* module management API of FreeType 2. * module management API of FreeType~2.
* *
*/ */
#define FT_MODULE_H <freetype/ftmodapi.h> #define FT_MODULE_H <freetype/ftmodapi.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_RENDER_H * FT_RENDER_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* renderer module management API of FreeType 2. * renderer module management API of FreeType~2.
* *
*/ */
#define FT_RENDER_H <freetype/ftrender.h> #define FT_RENDER_H <freetype/ftrender.h>
/************************************************************************* /**************************************************************************
*
* @macro:
* FT_DRIVER_H
*
* @description:
* A macro used in `#include` statements to name the file containing
* structures and macros related to the driver modules.
*
*/
#define FT_DRIVER_H <freetype/ftdriver.h>
/**************************************************************************
*
* @macro:
* FT_AUTOHINTER_H
*
* @description:
* A macro used in `#include` statements to name the file containing
* structures and macros related to the auto-hinting module.
*
* Deprecated since version~2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_AUTOHINTER_H FT_DRIVER_H
/**************************************************************************
*
* @macro:
* FT_CFF_DRIVER_H
*
* @description:
* A macro used in `#include` statements to name the file containing
* structures and macros related to the CFF driver module.
*
* Deprecated since version~2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_CFF_DRIVER_H FT_DRIVER_H
/**************************************************************************
*
* @macro:
* FT_TRUETYPE_DRIVER_H
*
* @description:
* A macro used in `#include` statements to name the file containing
* structures and macros related to the TrueType driver module.
*
* Deprecated since version~2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H
/**************************************************************************
*
* @macro:
* FT_PCF_DRIVER_H
*
* @description:
* A macro used in `#include` statements to name the file containing
* structures and macros related to the PCF driver module.
*
* Deprecated since version~2.9; use @FT_DRIVER_H instead.
*
*/
#define FT_PCF_DRIVER_H FT_DRIVER_H
/**************************************************************************
* *
* @macro: * @macro:
* FT_TYPE1_TABLES_H * FT_TYPE1_TABLES_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* types and API specific to the Type 1 format. * types and API specific to the Type~1 format.
* *
*/ */
#define FT_TYPE1_TABLES_H <freetype/t1tables.h> #define FT_TYPE1_TABLES_H <freetype/t1tables.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_TRUETYPE_IDS_H * FT_TRUETYPE_IDS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* enumeration values which identify name strings, languages, encodings, * enumeration values which identify name strings, languages, encodings,
* etc. This file really contains a _large_ set of constant macro * etc. This file really contains a _large_ set of constant macro
* definitions, taken from the TrueType and OpenType specifications. * definitions, taken from the TrueType and OpenType specifications.
...@@ -342,204 +416,172 @@ ...@@ -342,204 +416,172 @@
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h> #define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_TRUETYPE_TABLES_H * FT_TRUETYPE_TABLES_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* types and API specific to the TrueType (as well as OpenType) format. * types and API specific to the TrueType (as well as OpenType) format.
* *
*/ */
#define FT_TRUETYPE_TABLES_H <freetype/tttables.h> #define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_TRUETYPE_TAGS_H * FT_TRUETYPE_TAGS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* definitions of TrueType four-byte `tags' which identify blocks in * definitions of TrueType four-byte 'tags' which identify blocks in
* SFNT-based font formats (i.e., TrueType and OpenType). * SFNT-based font formats (i.e., TrueType and OpenType).
* *
*/ */
#define FT_TRUETYPE_TAGS_H <freetype/tttags.h> #define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_BDF_H * FT_BDF_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* definitions of an API which accesses BDF-specific strings from a * definitions of an API which accesses BDF-specific strings from a face.
* face.
* *
*/ */
#define FT_BDF_H <freetype/ftbdf.h> #define FT_BDF_H <freetype/ftbdf.h>
/************************************************************************* /**************************************************************************
*
* @macro:
* FT_CID_H
*
* @description:
* A macro used in `#include` statements to name the file containing the
* definitions of an API which access CID font information from a face.
*
*/
#define FT_CID_H <freetype/ftcid.h>
/**************************************************************************
* *
* @macro: * @macro:
* FT_GZIP_H * FT_GZIP_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* definitions of an API which supports gzip-compressed files. * definitions of an API which supports gzip-compressed files.
* *
*/ */
#define FT_GZIP_H <freetype/ftgzip.h> #define FT_GZIP_H <freetype/ftgzip.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_LZW_H * FT_LZW_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* definitions of an API which supports LZW-compressed files. * definitions of an API which supports LZW-compressed files.
* *
*/ */
#define FT_LZW_H <freetype/ftlzw.h> #define FT_LZW_H <freetype/ftlzw.h>
/************************************************************************* /**************************************************************************
*
* @macro:
* FT_BZIP2_H
*
* @description:
* A macro used in `#include` statements to name the file containing the
* definitions of an API which supports bzip2-compressed files.
*
*/
#define FT_BZIP2_H <freetype/ftbzip2.h>
/**************************************************************************
* *
* @macro: * @macro:
* FT_WINFONTS_H * FT_WINFONTS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* definitions of an API which supports Windows FNT files. * definitions of an API which supports Windows FNT files.
* *
*/ */
#define FT_WINFONTS_H <freetype/ftwinfnt.h> #define FT_WINFONTS_H <freetype/ftwinfnt.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_GLYPH_H * FT_GLYPH_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* API of the optional glyph management component. * API of the optional glyph management component.
* *
*/ */
#define FT_GLYPH_H <freetype/ftglyph.h> #define FT_GLYPH_H <freetype/ftglyph.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_BITMAP_H * FT_BITMAP_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* API of the optional bitmap conversion component. * API of the optional bitmap conversion component.
* *
*/ */
#define FT_BITMAP_H <freetype/ftbitmap.h> #define FT_BITMAP_H <freetype/ftbitmap.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_BBOX_H * FT_BBOX_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* API of the optional exact bounding box computation routines. * API of the optional exact bounding box computation routines.
* *
*/ */
#define FT_BBOX_H <freetype/ftbbox.h> #define FT_BBOX_H <freetype/ftbbox.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_CACHE_H * FT_CACHE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* API of the optional FreeType 2 cache sub-system. * API of the optional FreeType~2 cache sub-system.
* *
*/ */
#define FT_CACHE_H <freetype/ftcache.h> #define FT_CACHE_H <freetype/ftcache.h>
/************************************************************************* /**************************************************************************
*
* @macro:
* FT_CACHE_IMAGE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* `glyph image' API of the FreeType 2 cache sub-system.
*
* It is used to define a cache for @FT_Glyph elements. You can also
* use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
* store small glyph bitmaps, as it will use less memory.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* glyph image-related cache declarations.
*
*/
#define FT_CACHE_IMAGE_H FT_CACHE_H
/*************************************************************************
*
* @macro:
* FT_CACHE_SMALL_BITMAPS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* `small bitmaps' API of the FreeType 2 cache sub-system.
*
* It is used to define a cache for small glyph bitmaps in a relatively
* memory-efficient way. You can also use the API defined in
* @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,
* including scalable outlines.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* small bitmaps-related cache declarations.
*
*/
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
/*************************************************************************
*
* @macro:
* FT_CACHE_CHARMAP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* `charmap' API of the FreeType 2 cache sub-system.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* charmap-based cache declarations.
*
*/
#define FT_CACHE_CHARMAP_H FT_CACHE_H
/*************************************************************************
* *
* @macro: * @macro:
* FT_MAC_H * FT_MAC_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* Macintosh-specific FreeType 2 API. The latter is used to access * Macintosh-specific FreeType~2 API. The latter is used to access fonts
* fonts embedded in resource forks. * embedded in resource forks.
* *
* This header file must be explicitly included by client applications * This header file must be explicitly included by client applications
* compiled on the Mac (note that the base API still works though). * compiled on the Mac (note that the base API still works though).
...@@ -548,174 +590,217 @@ ...@@ -548,174 +590,217 @@
#define FT_MAC_H <freetype/ftmac.h> #define FT_MAC_H <freetype/ftmac.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_MULTIPLE_MASTERS_H * FT_MULTIPLE_MASTERS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* optional multiple-masters management API of FreeType 2. * optional multiple-masters management API of FreeType~2.
* *
*/ */
#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h> #define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_SFNT_NAMES_H * FT_SFNT_NAMES_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* optional FreeType 2 API which accesses embedded `name' strings in * optional FreeType~2 API which accesses embedded 'name' strings in
* SFNT-based font formats (i.e., TrueType and OpenType). * SFNT-based font formats (i.e., TrueType and OpenType).
* *
*/ */
#define FT_SFNT_NAMES_H <freetype/ftsnames.h> #define FT_SFNT_NAMES_H <freetype/ftsnames.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_OPENTYPE_VALIDATE_H * FT_OPENTYPE_VALIDATE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* optional FreeType 2 API which validates OpenType tables (BASE, GDEF, * optional FreeType~2 API which validates OpenType tables ('BASE',
* GPOS, GSUB, JSTF). * 'GDEF', 'GPOS', 'GSUB', 'JSTF').
* *
*/ */
#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h> #define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_GX_VALIDATE_H * FT_GX_VALIDATE_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* optional FreeType 2 API which validates TrueTypeGX/AAT tables (feat, * optional FreeType~2 API which validates TrueTypeGX/AAT tables ('feat',
* mort, morx, bsln, just, kern, opbd, trak, prop). * 'mort', 'morx', 'bsln', 'just', 'kern', 'opbd', 'trak', 'prop').
* *
*/ */
#define FT_GX_VALIDATE_H <freetype/ftgxval.h> #define FT_GX_VALIDATE_H <freetype/ftgxval.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_PFR_H * FT_PFR_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which accesses PFR-specific data. * FreeType~2 API which accesses PFR-specific data.
* *
*/ */
#define FT_PFR_H <freetype/ftpfr.h> #define FT_PFR_H <freetype/ftpfr.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_STROKER_H * FT_STROKER_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which provides functions to stroke outline paths. * FreeType~2 API which provides functions to stroke outline paths.
*/ */
#define FT_STROKER_H <freetype/ftstroke.h> #define FT_STROKER_H <freetype/ftstroke.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_SYNTHESIS_H * FT_SYNTHESIS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which performs artificial obliquing and emboldening. * FreeType~2 API which performs artificial obliquing and emboldening.
*/ */
#define FT_SYNTHESIS_H <freetype/ftsynth.h> #define FT_SYNTHESIS_H <freetype/ftsynth.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_XFREE86_H * FT_FONT_FORMATS_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which provides functions specific to the XFree86 and * FreeType~2 API which provides functions specific to font formats.
* X.Org X11 servers.
*/ */
#define FT_XFREE86_H <freetype/ftxf86.h> #define FT_FONT_FORMATS_H <freetype/ftfntfmt.h>
/* deprecated */
#define FT_XFREE86_H FT_FONT_FORMATS_H
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_TRIGONOMETRY_H * FT_TRIGONOMETRY_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which performs trigonometric computations (e.g., * FreeType~2 API which performs trigonometric computations (e.g.,
* cosines and arc tangents). * cosines and arc tangents).
*/ */
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h> #define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
/************************************************************************* /**************************************************************************
* *
* @macro: * @macro:
* FT_LCD_FILTER_H * FT_LCD_FILTER_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which performs color filtering for subpixel rendering. * FreeType~2 API which performs color filtering for subpixel rendering.
*/ */
#define FT_LCD_FILTER_H <freetype/ftlcdfil.h> #define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
/************************************************************************* /**************************************************************************
*
* @macro:
* FT_INCREMENTAL_H
*
* @description:
* A macro used in `#include` statements to name the file containing the
* FreeType~2 API which performs incremental glyph loading.
*/
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
/**************************************************************************
* *
* @macro: * @macro:
* FT_GASP_H * FT_GASP_H
* *
* @description: * @description:
* A macro used in #include statements to name the file containing the * A macro used in `#include` statements to name the file containing the
* FreeType 2 API which returns entries from the TrueType GASP table. * FreeType~2 API which returns entries from the TrueType GASP table.
*/ */
#define FT_GASP_H <freetype/ftgasp.h> #define FT_GASP_H <freetype/ftgasp.h>
/**************************************************************************
*
* @macro:
* FT_ADVANCES_H
*
* @description:
* A macro used in `#include` statements to name the file containing the
* FreeType~2 API which returns individual and ranged glyph advances.
*/
#define FT_ADVANCES_H <freetype/ftadvanc.h>
/**************************************************************************
*
* @macro:
* FT_COLOR_H
*
* @description:
* A macro used in `#include` statements to name the file containing the
* FreeType~2 API which handles the OpenType 'CPAL' table.
*/
#define FT_COLOR_H <freetype/ftcolor.h>
/* */ /* */
/* These header files don't need to be included by the user. */
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h> #define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_PARAMETER_TAGS_H <freetype/ftparams.h>
/* Deprecated macros. */
#define FT_UNPATENTED_HINTING_H <freetype/ftparams.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ftparams.h>
/* `FT_CACHE_H` is the only header file needed for the cache subsystem. */
#define FT_CACHE_IMAGE_H FT_CACHE_H
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
#define FT_CACHE_CHARMAP_H FT_CACHE_H
/* The internals of the cache sub-system are no longer exposed. We */ /* The internals of the cache sub-system are no longer exposed. We */
/* default to FT_CACHE_H at the moment just in case, but we know of */ /* default to `FT_CACHE_H` at the moment just in case, but we know */
/* no rogue client that uses them. */ /* of no rogue client that uses them. */
/* */ /* */
#define FT_CACHE_MANAGER_H <freetype/ftcache.h> #define FT_CACHE_MANAGER_H FT_CACHE_H
#define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H
#define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H
#define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H
#define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H
#define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h> #define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
/* /*
* Include internal headers definitions from <freetype/internal/...> * Include internal headers definitions from `<internal/...>` only when
* only when building the library. * building the library.
*/ */
#ifdef FT2_BUILD_LIBRARY #ifdef FT2_BUILD_LIBRARY
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h> #define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
...@@ -723,7 +808,7 @@ ...@@ -723,7 +808,7 @@
#endif /* FT2_BUILD_LIBRARY */ #endif /* FT2_BUILD_LIBRARY */
#endif /* __FT2_BUILD_H__ */ #endif /* FTHEADER_H_ */
/* END */ /* END */
/*
* This file registers the FreeType modules compiled into the library.
*
* If you use GNU make, this file IS NOT USED! Instead, it is created in
* the objects directory (normally `<topdir>/objs/`) based on information
* from `<topdir>/modules.cfg`.
*
* Please read `docs/INSTALL.ANY` and `docs/CUSTOMIZE` how to compile
* FreeType without GNU make.
*
*/
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
/* EOF */
/****************************************************************************
*
* ftoption.h
*
* User-selectable configuration macros (specification only).
*
* Copyright (C) 1996-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTOPTION_H_
#define FTOPTION_H_
#include <ft2build.h>
FT_BEGIN_HEADER
/**************************************************************************
*
* USER-SELECTABLE CONFIGURATION MACROS
*
* This file contains the default configuration macro definitions for a
* standard build of the FreeType library. There are three ways to use
* this file to build project-specific versions of the library:
*
* - You can modify this file by hand, but this is not recommended in
* cases where you would like to build several versions of the library
* from a single source directory.
*
* - You can put a copy of this file in your build directory, more
* precisely in `$BUILD/freetype/config/ftoption.h`, where `$BUILD` is
* the name of a directory that is included _before_ the FreeType include
* path during compilation.
*
* The default FreeType Makefiles and Jamfiles use the build directory
* `builds/<system>` by default, but you can easily change that for your
* own projects.
*
* - Copy the file <ft2build.h> to `$BUILD/ft2build.h` and modify it
* slightly to pre-define the macro `FT_CONFIG_OPTIONS_H` used to locate
* this file during the build. For example,
*
* ```
* #define FT_CONFIG_OPTIONS_H <myftoptions.h>
* #include <freetype/config/ftheader.h>
* ```
*
* will use `$BUILD/myftoptions.h` instead of this file for macro
* definitions.
*
* Note also that you can similarly pre-define the macro
* `FT_CONFIG_MODULES_H` used to locate the file listing of the modules
* that are statically linked to the library at compile time. By
* default, this file is `<freetype/config/ftmodule.h>`.
*
* We highly recommend using the third method whenever possible.
*
*/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*#************************************************************************
*
* If you enable this configuration option, FreeType recognizes an
* environment variable called `FREETYPE_PROPERTIES`, which can be used to
* control the various font drivers and modules. The controllable
* properties are listed in the section @properties.
*
* You have to undefine this configuration option on platforms that lack
* the concept of environment variables (and thus don't have the `getenv`
* function), for example Windows CE.
*
* `FREETYPE_PROPERTIES` has the following syntax form (broken here into
* multiple lines for better readability).
*
* ```
* <optional whitespace>
* <module-name1> ':'
* <property-name1> '=' <property-value1>
* <whitespace>
* <module-name2> ':'
* <property-name2> '=' <property-value2>
* ...
* ```
*
* Example:
*
* ```
* FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
* cff:no-stem-darkening=1 \
* autofitter:warping=1
* ```
*
*/
#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
/**************************************************************************
*
* Uncomment the line below if you want to activate LCD rendering
* technology similar to ClearType in this build of the library. This
* technology triples the resolution in the direction color subpixels. To
* mitigate color fringes inherent to this technology, you also need to
* explicitly set up LCD filtering.
*
* Note that this feature is covered by several Microsoft patents and
* should not be activated in any default build of the library. When this
* macro is not defined, FreeType offers alternative LCD rendering
* technology that produces excellent output without LCD filtering.
*/
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
/**************************************************************************
*
* Many compilers provide a non-ANSI 64-bit data type that can be used by
* FreeType to speed up some computations. However, this will create some
* problems when compiling the library in strict ANSI mode.
*
* For this reason, the use of 64-bit integers is normally disabled when
* the `__STDC__` macro is defined. You can however disable this by
* defining the macro `FT_CONFIG_OPTION_FORCE_INT64` here.
*
* For most compilers, this will only create compilation warnings when
* building the library.
*
* ObNote: The compiler-specific 64-bit integers are detected in the
* file `ftconfig.h` either statically or through the `configure`
* script on supported platforms.
*/
#undef FT_CONFIG_OPTION_FORCE_INT64
/**************************************************************************
*
* If this macro is defined, do not try to use an assembler version of
* performance-critical functions (e.g., @FT_MulFix). You should only do
* that to verify that the assembler function works properly, or to execute
* benchmark tests of the various implementations.
*/
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
/**************************************************************************
*
* If this macro is defined, try to use an inlined assembler version of the
* @FT_MulFix function, which is a 'hotspot' when loading and hinting
* glyphs, and which should be executed as fast as possible.
*
* Note that if your compiler or CPU is not supported, this will default to
* the standard and portable implementation found in `ftcalc.c`.
*/
#define FT_CONFIG_OPTION_INLINE_MULFIX
/**************************************************************************
*
* LZW-compressed file support.
*
* FreeType now handles font files that have been compressed with the
* `compress` program. This is mostly used to parse many of the PCF
* files that come with various X11 distributions. The implementation
* uses NetBSD's `zopen` to partially uncompress the file on the fly (see
* `src/lzw/ftgzip.c`).
*
* Define this macro if you want to enable this 'feature'.
*/
#define FT_CONFIG_OPTION_USE_LZW
/**************************************************************************
*
* Gzip-compressed file support.
*
* FreeType now handles font files that have been compressed with the
* `gzip` program. This is mostly used to parse many of the PCF files
* that come with XFree86. The implementation uses 'zlib' to partially
* uncompress the file on the fly (see `src/gzip/ftgzip.c`).
*
* Define this macro if you want to enable this 'feature'. See also the
* macro `FT_CONFIG_OPTION_SYSTEM_ZLIB` below.
*/
#define FT_CONFIG_OPTION_USE_ZLIB
/**************************************************************************
*
* ZLib library selection
*
* This macro is only used when `FT_CONFIG_OPTION_USE_ZLIB` is defined.
* It allows FreeType's 'ftgzip' component to link to the system's
* installation of the ZLib library. This is useful on systems like
* Unix or VMS where it generally is already available.
*
* If you let it undefined, the component will use its own copy of the
* zlib sources instead. These have been modified to be included
* directly within the component and **not** export external function
* names. This allows you to link any program with FreeType _and_ ZLib
* without linking conflicts.
*
* Do not `#undef` this macro here since the build system might define
* it for certain configurations only.
*
* If you use a build system like cmake or the `configure` script,
* options set by those programs have precedence, overwriting the value
* here with the configured one.
*/
/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
/**************************************************************************
*
* Bzip2-compressed file support.
*
* FreeType now handles font files that have been compressed with the
* `bzip2` program. This is mostly used to parse many of the PCF files
* that come with XFree86. The implementation uses `libbz2` to partially
* uncompress the file on the fly (see `src/bzip2/ftbzip2.c`). Contrary
* to gzip, bzip2 currently is not included and need to use the system
* available bzip2 implementation.
*
* Define this macro if you want to enable this 'feature'.
*
* If you use a build system like cmake or the `configure` script,
* options set by those programs have precedence, overwriting the value
* here with the configured one.
*/
/* #define FT_CONFIG_OPTION_USE_BZIP2 */
/**************************************************************************
*
* Define to disable the use of file stream functions and types, `FILE`,
* `fopen`, etc. Enables the use of smaller system libraries on embedded
* systems that have multiple system libraries, some with or without file
* stream support, in the cases where file stream support is not necessary
* such as memory loading of font files.
*/
/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
/**************************************************************************
*
* PNG bitmap support.
*
* FreeType now handles loading color bitmap glyphs in the PNG format.
* This requires help from the external libpng library. Uncompressed
* color bitmaps do not need any external libraries and will be supported
* regardless of this configuration.
*
* Define this macro if you want to enable this 'feature'.
*
* If you use a build system like cmake or the `configure` script,
* options set by those programs have precedence, overwriting the value
* here with the configured one.
*/
/* #define FT_CONFIG_OPTION_USE_PNG */
/**************************************************************************
*
* HarfBuzz support.
*
* FreeType uses the HarfBuzz library to improve auto-hinting of OpenType
* fonts. If available, many glyphs not directly addressable by a font's
* character map will be hinted also.
*
* Define this macro if you want to enable this 'feature'.
*
* If you use a build system like cmake or the `configure` script,
* options set by those programs have precedence, overwriting the value
* here with the configured one.
*/
/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */
/**************************************************************************
*
* Glyph Postscript Names handling
*
* By default, FreeType 2 is compiled with the 'psnames' module. This
* module is in charge of converting a glyph name string into a Unicode
* value, or return a Macintosh standard glyph name for the use with the
* TrueType 'post' table.
*
* Undefine this macro if you do not want 'psnames' compiled in your
* build of FreeType. This has the following effects:
*
* - The TrueType driver will provide its own set of glyph names, if you
* build it to support postscript names in the TrueType 'post' table,
* but will not synthesize a missing Unicode charmap.
*
* - The Type~1 driver will not be able to synthesize a Unicode charmap
* out of the glyphs found in the fonts.
*
* You would normally undefine this configuration macro when building a
* version of FreeType that doesn't contain a Type~1 or CFF driver.
*/
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/**************************************************************************
*
* Postscript Names to Unicode Values support
*
* By default, FreeType~2 is built with the 'psnames' module compiled in.
* Among other things, the module is used to convert a glyph name into a
* Unicode value. This is especially useful in order to synthesize on
* the fly a Unicode charmap from the CFF/Type~1 driver through a big
* table named the 'Adobe Glyph List' (AGL).
*
* Undefine this macro if you do not want the Adobe Glyph List compiled
* in your 'psnames' module. The Type~1 driver will not be able to
* synthesize a Unicode charmap out of the glyphs found in the fonts.
*/
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/**************************************************************************
*
* Support for Mac fonts
*
* Define this macro if you want support for outline fonts in Mac format
* (mac dfont, mac resource, macbinary containing a mac resource) on
* non-Mac platforms.
*
* Note that the 'FOND' resource isn't checked.
*/
#define FT_CONFIG_OPTION_MAC_FONTS
/**************************************************************************
*
* Guessing methods to access embedded resource forks
*
* Enable extra Mac fonts support on non-Mac platforms (e.g., GNU/Linux).
*
* Resource forks which include fonts data are stored sometimes in
* locations which users or developers don't expected. In some cases,
* resource forks start with some offset from the head of a file. In
* other cases, the actual resource fork is stored in file different from
* what the user specifies. If this option is activated, FreeType tries
* to guess whether such offsets or different file names must be used.
*
* Note that normal, direct access of resource forks is controlled via
* the `FT_CONFIG_OPTION_MAC_FONTS` option.
*/
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#endif
/**************************************************************************
*
* Allow the use of `FT_Incremental_Interface` to load typefaces that
* contain no glyph data, but supply it via a callback function. This is
* required by clients supporting document formats which supply font data
* incrementally as the document is parsed, such as the Ghostscript
* interpreter for the PostScript language.
*/
#define FT_CONFIG_OPTION_INCREMENTAL
/**************************************************************************
*
* The size in bytes of the render pool used by the scan-line converter to
* do all of its work.
*/
#define FT_RENDER_POOL_SIZE 16384L
/**************************************************************************
*
* FT_MAX_MODULES
*
* The maximum number of modules that can be registered in a single
* FreeType library object. 32~is the default.
*/
#define FT_MAX_MODULES 32
/**************************************************************************
*
* Debug level
*
* FreeType can be compiled in debug or trace mode. In debug mode,
* errors are reported through the 'ftdebug' component. In trace mode,
* additional messages are sent to the standard output during execution.
*
* Define `FT_DEBUG_LEVEL_ERROR` to build the library in debug mode.
* Define `FT_DEBUG_LEVEL_TRACE` to build it in trace mode.
*
* Don't define any of these macros to compile in 'release' mode!
*
* Do not `#undef` these macros here since the build system might define
* them for certain configurations only.
*/
/* #define FT_DEBUG_LEVEL_ERROR */
/* #define FT_DEBUG_LEVEL_TRACE */
/**************************************************************************
*
* Autofitter debugging
*
* If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to
* control the autofitter behaviour for debugging purposes with global
* boolean variables (consequently, you should **never** enable this
* while compiling in 'release' mode):
*
* ```
* _af_debug_disable_horz_hints
* _af_debug_disable_vert_hints
* _af_debug_disable_blue_hints
* ```
*
* Additionally, the following functions provide dumps of various
* internal autofit structures to stdout (using `printf`):
*
* ```
* af_glyph_hints_dump_points
* af_glyph_hints_dump_segments
* af_glyph_hints_dump_edges
* af_glyph_hints_get_num_segments
* af_glyph_hints_get_segment_offset
* ```
*
* As an argument, they use another global variable:
*
* ```
* _af_debug_hints
* ```
*
* Please have a look at the `ftgrid` demo program to see how those
* variables and macros should be used.
*
* Do not `#undef` these macros here since the build system might define
* them for certain configurations only.
*/
/* #define FT_DEBUG_AUTOFIT */
/**************************************************************************
*
* Memory Debugging
*
* FreeType now comes with an integrated memory debugger that is capable
* of detecting simple errors like memory leaks or double deletes. To
* compile it within your build of the library, you should define
* `FT_DEBUG_MEMORY` here.
*
* Note that the memory debugger is only activated at runtime when when
* the _environment_ variable `FT2_DEBUG_MEMORY` is defined also!
*
* Do not `#undef` this macro here since the build system might define it
* for certain configurations only.
*/
/* #define FT_DEBUG_MEMORY */
/**************************************************************************
*
* Module errors
*
* If this macro is set (which is _not_ the default), the higher byte of
* an error code gives the module in which the error has occurred, while
* the lower byte is the real error code.
*
* Setting this macro makes sense for debugging purposes only, since it
* would break source compatibility of certain programs that use
* FreeType~2.
*
* More details can be found in the files `ftmoderr.h` and `fterrors.h`.
*/
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
/**************************************************************************
*
* Error Strings
*
* If this macro is set, `FT_Error_String` will return meaningful
* descriptions. This is not enabled by default to reduce the overall
* size of FreeType.
*
* More details can be found in the file `fterrors.h`.
*/
/* #define FT_CONFIG_OPTION_ERROR_STRINGS */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** S F N T D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_EMBEDDED_BITMAPS` if you want to support
* embedded bitmaps in all formats using the 'sfnt' module (namely
* TrueType~& OpenType).
*/
#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured
* outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'
* module (namely TrueType~& OpenType).
*/
#define TT_CONFIG_OPTION_COLOR_LAYERS
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to
* load and enumerate the glyph Postscript names in a TrueType or OpenType
* file.
*
* Note that when you do not compile the 'psnames' module by undefining the
* above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES`, the 'sfnt' module will
* contain additional code used to read the PS Names table from a font.
*
* (By default, the module uses 'psnames' to extract glyph names.)
*/
#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_SFNT_NAMES` if your applications need to access
* the internal name table in a SFNT-based format like TrueType or
* OpenType. The name table contains various strings used to describe the
* font, like family name, copyright, version, etc. It does not contain
* any glyph name though.
*
* Accessing SFNT names is done through the functions declared in
* `ftsnames.h`.
*/
#define TT_CONFIG_OPTION_SFNT_NAMES
/**************************************************************************
*
* TrueType CMap support
*
* Here you can fine-tune which TrueType CMap table format shall be
* supported.
*/
#define TT_CONFIG_CMAP_FORMAT_0
#define TT_CONFIG_CMAP_FORMAT_2
#define TT_CONFIG_CMAP_FORMAT_4
#define TT_CONFIG_CMAP_FORMAT_6
#define TT_CONFIG_CMAP_FORMAT_8
#define TT_CONFIG_CMAP_FORMAT_10
#define TT_CONFIG_CMAP_FORMAT_12
#define TT_CONFIG_CMAP_FORMAT_13
#define TT_CONFIG_CMAP_FORMAT_14
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` if you want to compile a
* bytecode interpreter in the TrueType driver.
*
* By undefining this, you will only compile the code necessary to load
* TrueType glyphs without hinting.
*
* Do not `#undef` this macro here, since the build system might define it
* for certain configurations only.
*/
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_SUBPIXEL_HINTING` if you want to compile
* subpixel hinting support into the TrueType driver. This modifies the
* TrueType hinting mechanism when anything but `FT_RENDER_MODE_MONO` is
* requested.
*
* In particular, it modifies the bytecode interpreter to interpret (or
* not) instructions in a certain way so that all TrueType fonts look like
* they do in a Windows ClearType (DirectWrite) environment. See [1] for a
* technical overview on what this means. See `ttinterp.h` for more
* details on the LEAN option.
*
* There are three possible values.
*
* Value 1:
* This value is associated with the 'Infinality' moniker, contributed by
* an individual nicknamed Infinality with the goal of making TrueType
* fonts render better than on Windows. A high amount of configurability
* and flexibility, down to rules for single glyphs in fonts, but also
* very slow. Its experimental and slow nature and the original
* developer losing interest meant that this option was never enabled in
* default builds.
*
* The corresponding interpreter version is v38.
*
* Value 2:
* The new default mode for the TrueType driver. The Infinality code
* base was stripped to the bare minimum and all configurability removed
* in the name of speed and simplicity. The configurability was mainly
* aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'.
* Legacy fonts are fonts that modify vertical stems to achieve clean
* black-and-white bitmaps. The new mode focuses on applying a minimal
* set of rules to all fonts indiscriminately so that modern and web
* fonts render well while legacy fonts render okay.
*
* The corresponding interpreter version is v40.
*
* Value 3:
* Compile both, making both v38 and v40 available (the latter is the
* default).
*
* By undefining these, you get rendering behavior like on Windows without
* ClearType, i.e., Windows XP without ClearType enabled and Win9x
* (interpreter version v35). Or not, depending on how much hinting blood
* and testing tears the font designer put into a given font. If you
* define one or both subpixel hinting options, you can switch between
* between v35 and the ones you define (using `FT_Property_Set`).
*
* This option requires `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` to be
* defined.
*
* [1]
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED` to compile the
* TrueType glyph loader to use Apple's definition of how to handle
* component offsets in composite glyphs.
*
* Apple and MS disagree on the default behavior of component offsets in
* composites. Apple says that they should be scaled by the scaling
* factors in the transformation matrix (roughly, it's more complex) while
* MS says they should not. OpenType defines two bits in the composite
* flags array which can be used to disambiguate, but old fonts will not
* have them.
*
* https://www.microsoft.com/typography/otspec/glyf.htm
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html
*/
#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_GX_VAR_SUPPORT` if you want to include support
* for Apple's distortable font technology ('fvar', 'gvar', 'cvar', and
* 'avar' tables). Tagged 'Font Variations', this is now part of OpenType
* also. This has many similarities to Type~1 Multiple Masters support.
*/
#define TT_CONFIG_OPTION_GX_VAR_SUPPORT
/**************************************************************************
*
* Define `TT_CONFIG_OPTION_BDF` if you want to include support for an
* embedded 'BDF~' table within SFNT-based bitmap formats.
*/
#define TT_CONFIG_OPTION_BDF
/**************************************************************************
*
* Option `TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES` controls the maximum
* number of bytecode instructions executed for a single run of the
* bytecode interpreter, needed to prevent infinite loops. You don't want
* to change this except for very special situations (e.g., making a
* library fuzzer spend less time to handle broken fonts).
*
* It is not expected that this value is ever modified by a configuring
* script; instead, it gets surrounded with `#ifndef ... #endif` so that
* the value can be set as a preprocessor option on the compiler's command
* line.
*/
#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
#endif
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* `T1_MAX_DICT_DEPTH` is the maximum depth of nest dictionaries and arrays
* in the Type~1 stream (see `t1load.c`). A minimum of~4 is required.
*/
#define T1_MAX_DICT_DEPTH 5
/**************************************************************************
*
* `T1_MAX_SUBRS_CALLS` details the maximum number of nested sub-routine
* calls during glyph loading.
*/
#define T1_MAX_SUBRS_CALLS 16
/**************************************************************************
*
* `T1_MAX_CHARSTRING_OPERANDS` is the charstring stack's capacity. A
* minimum of~16 is required.
*
* The Chinese font 'MingTiEG-Medium' (covering the CNS 11643 character
* set) needs 256.
*/
#define T1_MAX_CHARSTRINGS_OPERANDS 256
/**************************************************************************
*
* Define this configuration macro if you want to prevent the compilation
* of the 't1afm' module, which is in charge of reading Type~1 AFM files
* into an existing face. Note that if set, the Type~1 driver will be
* unable to produce kerning distances.
*/
#undef T1_CONFIG_OPTION_NO_AFM
/**************************************************************************
*
* Define this configuration macro if you want to prevent the compilation
* of the Multiple Masters font support in the Type~1 driver.
*/
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
/**************************************************************************
*
* `T1_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe Type~1
* engine gets compiled into FreeType. If defined, it is possible to
* switch between the two engines using the `hinting-engine` property of
* the 'type1' driver module.
*/
/* #define T1_CONFIG_OPTION_OLD_ENGINE */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** C F F D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* Using `CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}` it is
* possible to set up the default values of the four control points that
* define the stem darkening behaviour of the (new) CFF engine. For more
* details please read the documentation of the `darkening-parameters`
* property (file `ftdriver.h`), which allows the control at run-time.
*
* Do **not** undefine these macros!
*/
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0
/**************************************************************************
*
* `CFF_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe CFF engine
* gets compiled into FreeType. If defined, it is possible to switch
* between the two engines using the `hinting-engine` property of the 'cff'
* driver module.
*/
/* #define CFF_CONFIG_OPTION_OLD_ENGINE */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** P C F D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* There are many PCF fonts just called 'Fixed' which look completely
* different, and which have nothing to do with each other. When selecting
* 'Fixed' in KDE or Gnome one gets results that appear rather random, the
* style changes often if one changes the size and one cannot select some
* fonts at all. This option makes the 'pcf' module prepend the foundry
* name (plus a space) to the family name.
*
* We also check whether we have 'wide' characters; all put together, we
* get family names like 'Sony Fixed' or 'Misc Fixed Wide'.
*
* If this option is activated, it can be controlled with the
* `no-long-family-names` property of the 'pcf' driver module.
*/
/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* Compile 'autofit' module with CJK (Chinese, Japanese, Korean) script
* support.
*/
#define AF_CONFIG_OPTION_CJK
/**************************************************************************
*
* Compile 'autofit' module with fallback Indic script support, covering
* some scripts that the 'latin' submodule of the 'autofit' module doesn't
* (yet) handle.
*/
#define AF_CONFIG_OPTION_INDIC
/**************************************************************************
*
* Compile 'autofit' module with warp hinting. The idea of the warping
* code is to slightly scale and shift a glyph within a single dimension so
* that as much of its segments are aligned (more or less) on the grid. To
* find out the optimal scaling and shifting value, various parameter
* combinations are tried and scored.
*
* You can switch warping on and off with the `warping` property of the
* auto-hinter (see file `ftdriver.h` for more information; by default it
* is switched off).
*
* This experimental option is not active if the rendering mode is
* `FT_RENDER_MODE_LIGHT`.
*/
#define AF_CONFIG_OPTION_USE_WARPER
/**************************************************************************
*
* Use TrueType-like size metrics for 'light' auto-hinting.
*
* It is strongly recommended to avoid this option, which exists only to
* help some legacy applications retain its appearance and behaviour with
* respect to auto-hinted TrueType fonts.
*
* The very reason this option exists at all are GNU/Linux distributions
* like Fedora that did not un-patch the following change (which was
* present in FreeType between versions 2.4.6 and 2.7.1, inclusive).
*
* ```
* 2011-07-16 Steven Chu <steven.f.chu@gmail.com>
*
* [truetype] Fix metrics on size request for scalable fonts.
* ```
*
* This problematic commit is now reverted (more or less).
*/
/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */
/* */
/*
* This macro is obsolete. Support has been removed in FreeType version
* 2.5.
*/
/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
/*
* The next three macros are defined if native TrueType hinting is
* requested by the definitions above. Don't change this.
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_USE_BYTECODE_INTERPRETER
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1
#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
#endif
#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2
#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
#endif
#endif
#endif
/*
* Check CFF darkening parameters. The checks are the same as in function
* `cff_property_set` in file `cffdrivr.c`.
*/
#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \
\
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \
\
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \
\
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500
#error "Invalid CFF darkening parameters!"
#endif
FT_END_HEADER
#endif /* FTOPTION_H_ */
/* END */
/****************************************************************************
*
* ftstdlib.h
*
* ANSI-specific library and header configuration file (specification
* only).
*
* Copyright (C) 2002-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
/**************************************************************************
*
* This file is used to group all `#includes` to the ANSI~C library that
* FreeType normally requires. It also defines macros to rename the
* standard functions within the FreeType source code.
*
* Load a file which defines `FTSTDLIB_H_` before this one to override it.
*
*/
#ifndef FTSTDLIB_H_
#define FTSTDLIB_H_
#include <stddef.h>
#define ft_ptrdiff_t ptrdiff_t
/**************************************************************************
*
* integer limits
*
* `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of
* `int` and `long` in bytes at compile-time. So far, this works for all
* platforms the library has been tested on.
*
* Note that on the extremely rare platforms that do not provide integer
* types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where
* `int` is 36~bits), we do not make any guarantee about the correct
* behaviour of FreeType~2 with all fonts.
*
* In these cases, `ftconfig.h` will refuse to compile anyway with a
* message like 'couldn't find 32-bit type' or something similar.
*
*/
#include <limits.h>
#define FT_CHAR_BIT CHAR_BIT
#define FT_USHORT_MAX USHRT_MAX
#define FT_INT_MAX INT_MAX
#define FT_INT_MIN INT_MIN
#define FT_UINT_MAX UINT_MAX
#define FT_LONG_MIN LONG_MIN
#define FT_LONG_MAX LONG_MAX
#define FT_ULONG_MAX ULONG_MAX
/**************************************************************************
*
* character and string processing
*
*/
#include <string.h>
#define ft_memchr memchr
#define ft_memcmp memcmp
#define ft_memcpy memcpy
#define ft_memmove memmove
#define ft_memset memset
#define ft_strcat strcat
#define ft_strcmp strcmp
#define ft_strcpy strcpy
#define ft_strlen strlen
#define ft_strncmp strncmp
#define ft_strncpy strncpy
#define ft_strrchr strrchr
#define ft_strstr strstr
/**************************************************************************
*
* file handling
*
*/
#include <stdio.h>
#define FT_FILE FILE
#define ft_fclose fclose
#define ft_fopen fopen
#define ft_fread fread
#define ft_fseek fseek
#define ft_ftell ftell
#define ft_sprintf sprintf
/**************************************************************************
*
* sorting
*
*/
#include <stdlib.h>
#define ft_qsort qsort
/**************************************************************************
*
* memory allocation
*
*/
#define ft_scalloc calloc
#define ft_sfree free
#define ft_smalloc malloc
#define ft_srealloc realloc
/**************************************************************************
*
* miscellaneous
*
*/
#define ft_strtol strtol
#define ft_getenv getenv
/**************************************************************************
*
* execution control
*
*/
#include <setjmp.h>
#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
/* `jmp_buf` is defined as a macro */
/* on certain platforms */
#define ft_longjmp longjmp
#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
/* The following is only used for debugging purposes, i.e., if */
/* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */
#include <stdarg.h>
#endif /* FTSTDLIB_H_ */
/* END */
/****************************************************************************
*
* freetype.h
*
* FreeType high-level API and common types (specification only).
*
* Copyright (C) 1996-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FREETYPE_H_
#define FREETYPE_H_
#ifndef FT_FREETYPE_H
#error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files."
#error "Example:"
#error " #include <ft2build.h>"
#error " #include FT_FREETYPE_H"
#endif
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_TYPES_H
#include FT_ERRORS_H
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* header_inclusion
*
* @title:
* FreeType's header inclusion scheme
*
* @abstract:
* How client applications should include FreeType header files.
*
* @description:
* To be as flexible as possible (and for historical reasons), FreeType
* uses a very special inclusion scheme to load header files, for example
*
* ```
* #include <ft2build.h>
*
* #include FT_FREETYPE_H
* #include FT_OUTLINE_H
* ```
*
* A compiler and its preprocessor only needs an include path to find the
* file `ft2build.h`; the exact locations and names of the other FreeType
* header files are hidden by @header_file_macros, loaded by
* `ft2build.h`. The API documentation always gives the header macro
* name needed for a particular function.
*
*/
/**************************************************************************
*
* @section:
* user_allocation
*
* @title:
* User allocation
*
* @abstract:
* How client applications should allocate FreeType data structures.
*
* @description:
* FreeType assumes that structures allocated by the user and passed as
* arguments are zeroed out except for the actual data. In other words,
* it is recommended to use `calloc` (or variants of it) instead of
* `malloc` for allocation.
*
*/
/*************************************************************************/
/*************************************************************************/
/* */
/* B A S I C T Y P E S */
/* */
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @section:
* base_interface
*
* @title:
* Base Interface
*
* @abstract:
* The FreeType~2 base font interface.
*
* @description:
* This section describes the most important public high-level API
* functions of FreeType~2.
*
* @order:
* FT_Library
* FT_Face
* FT_Size
* FT_GlyphSlot
* FT_CharMap
* FT_Encoding
* FT_ENC_TAG
*
* FT_FaceRec
*
* FT_FACE_FLAG_SCALABLE
* FT_FACE_FLAG_FIXED_SIZES
* FT_FACE_FLAG_FIXED_WIDTH
* FT_FACE_FLAG_HORIZONTAL
* FT_FACE_FLAG_VERTICAL
* FT_FACE_FLAG_COLOR
* FT_FACE_FLAG_SFNT
* FT_FACE_FLAG_CID_KEYED
* FT_FACE_FLAG_TRICKY
* FT_FACE_FLAG_KERNING
* FT_FACE_FLAG_MULTIPLE_MASTERS
* FT_FACE_FLAG_VARIATION
* FT_FACE_FLAG_GLYPH_NAMES
* FT_FACE_FLAG_EXTERNAL_STREAM
* FT_FACE_FLAG_HINTER
*
* FT_HAS_HORIZONTAL
* FT_HAS_VERTICAL
* FT_HAS_KERNING
* FT_HAS_FIXED_SIZES
* FT_HAS_GLYPH_NAMES
* FT_HAS_COLOR
* FT_HAS_MULTIPLE_MASTERS
*
* FT_IS_SFNT
* FT_IS_SCALABLE
* FT_IS_FIXED_WIDTH
* FT_IS_CID_KEYED
* FT_IS_TRICKY
* FT_IS_NAMED_INSTANCE
* FT_IS_VARIATION
*
* FT_STYLE_FLAG_BOLD
* FT_STYLE_FLAG_ITALIC
*
* FT_SizeRec
* FT_Size_Metrics
*
* FT_GlyphSlotRec
* FT_Glyph_Metrics
* FT_SubGlyph
*
* FT_Bitmap_Size
*
* FT_Init_FreeType
* FT_Done_FreeType
*
* FT_New_Face
* FT_Done_Face
* FT_Reference_Face
* FT_New_Memory_Face
* FT_Face_Properties
* FT_Open_Face
* FT_Open_Args
* FT_Parameter
* FT_Attach_File
* FT_Attach_Stream
*
* FT_Set_Char_Size
* FT_Set_Pixel_Sizes
* FT_Request_Size
* FT_Select_Size
* FT_Size_Request_Type
* FT_Size_RequestRec
* FT_Size_Request
* FT_Set_Transform
* FT_Load_Glyph
* FT_Get_Char_Index
* FT_Get_First_Char
* FT_Get_Next_Char
* FT_Get_Name_Index
* FT_Load_Char
*
* FT_OPEN_MEMORY
* FT_OPEN_STREAM
* FT_OPEN_PATHNAME
* FT_OPEN_DRIVER
* FT_OPEN_PARAMS
*
* FT_LOAD_DEFAULT
* FT_LOAD_RENDER
* FT_LOAD_MONOCHROME
* FT_LOAD_LINEAR_DESIGN
* FT_LOAD_NO_SCALE
* FT_LOAD_NO_HINTING
* FT_LOAD_NO_BITMAP
* FT_LOAD_NO_AUTOHINT
* FT_LOAD_COLOR
*
* FT_LOAD_VERTICAL_LAYOUT
* FT_LOAD_IGNORE_TRANSFORM
* FT_LOAD_FORCE_AUTOHINT
* FT_LOAD_NO_RECURSE
* FT_LOAD_PEDANTIC
*
* FT_LOAD_TARGET_NORMAL
* FT_LOAD_TARGET_LIGHT
* FT_LOAD_TARGET_MONO
* FT_LOAD_TARGET_LCD
* FT_LOAD_TARGET_LCD_V
*
* FT_LOAD_TARGET_MODE
*
* FT_Render_Glyph
* FT_Render_Mode
* FT_Get_Kerning
* FT_Kerning_Mode
* FT_Get_Track_Kerning
* FT_Get_Glyph_Name
* FT_Get_Postscript_Name
*
* FT_CharMapRec
* FT_Select_Charmap
* FT_Set_Charmap
* FT_Get_Charmap_Index
*
* FT_Get_FSType_Flags
* FT_Get_SubGlyph_Info
*
* FT_Face_Internal
* FT_Size_Internal
* FT_Slot_Internal
*
* FT_FACE_FLAG_XXX
* FT_STYLE_FLAG_XXX
* FT_OPEN_XXX
* FT_LOAD_XXX
* FT_LOAD_TARGET_XXX
* FT_SUBGLYPH_FLAG_XXX
* FT_FSTYPE_XXX
*
* FT_HAS_FAST_GLYPHS
*
*/
/**************************************************************************
*
* @struct:
* FT_Glyph_Metrics
*
* @description:
* A structure to model the metrics of a single glyph. The values are
* expressed in 26.6 fractional pixel format; if the flag
* @FT_LOAD_NO_SCALE has been used while loading the glyph, values are
* expressed in font units instead.
*
* @fields:
* width ::
* The glyph's width.
*
* height ::
* The glyph's height.
*
* horiBearingX ::
* Left side bearing for horizontal layout.
*
* horiBearingY ::
* Top side bearing for horizontal layout.
*
* horiAdvance ::
* Advance width for horizontal layout.
*
* vertBearingX ::
* Left side bearing for vertical layout.
*
* vertBearingY ::
* Top side bearing for vertical layout. Larger positive values mean
* further below the vertical glyph origin.
*
* vertAdvance ::
* Advance height for vertical layout. Positive values mean the glyph
* has a positive advance downward.
*
* @note:
* If not disabled with @FT_LOAD_NO_HINTING, the values represent
* dimensions of the hinted glyph (in case hinting is applicable).
*
* Stroking a glyph with an outside border does not increase
* `horiAdvance` or `vertAdvance`; you have to manually adjust these
* values to account for the added width and height.
*
* FreeType doesn't use the 'VORG' table data for CFF fonts because it
* doesn't have an interface to quickly retrieve the glyph height. The
* y~coordinate of the vertical origin can be simply computed as
* `vertBearingY + height` after loading a glyph.
*/
typedef struct FT_Glyph_Metrics_
{
FT_Pos width;
FT_Pos height;
FT_Pos horiBearingX;
FT_Pos horiBearingY;
FT_Pos horiAdvance;
FT_Pos vertBearingX;
FT_Pos vertBearingY;
FT_Pos vertAdvance;
} FT_Glyph_Metrics;
/**************************************************************************
*
* @struct:
* FT_Bitmap_Size
*
* @description:
* This structure models the metrics of a bitmap strike (i.e., a set of
* glyphs for a given point size and resolution) in a bitmap font. It is
* used for the `available_sizes` field of @FT_Face.
*
* @fields:
* height ::
* The vertical distance, in pixels, between two consecutive baselines.
* It is always positive.
*
* width ::
* The average width, in pixels, of all glyphs in the strike.
*
* size ::
* The nominal size of the strike in 26.6 fractional points. This
* field is not very useful.
*
* x_ppem ::
* The horizontal ppem (nominal width) in 26.6 fractional pixels.
*
* y_ppem ::
* The vertical ppem (nominal height) in 26.6 fractional pixels.
*
* @note:
* Windows FNT:
* The nominal size given in a FNT font is not reliable. If the driver
* finds it incorrect, it sets `size` to some calculated values, and
* `x_ppem` and `y_ppem` to the pixel width and height given in the
* font, respectively.
*
* TrueType embedded bitmaps:
* `size`, `width`, and `height` values are not contained in the bitmap
* strike itself. They are computed from the global font parameters.
*/
typedef struct FT_Bitmap_Size_
{
FT_Short height;
FT_Short width;
FT_Pos size;
FT_Pos x_ppem;
FT_Pos y_ppem;
} FT_Bitmap_Size;
/*************************************************************************/
/*************************************************************************/
/* */
/* O B J E C T C L A S S E S */
/* */
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @type:
* FT_Library
*
* @description:
* A handle to a FreeType library instance. Each 'library' is completely
* independent from the others; it is the 'root' of a set of objects like
* fonts, faces, sizes, etc.
*
* It also embeds a memory manager (see @FT_Memory), as well as a
* scan-line converter object (see @FT_Raster).
*
* [Since 2.5.6] 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, 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
* destroyed with @FT_Done_FreeType. If you need reference-counting
* (cf. @FT_Reference_Library), use @FT_New_Library and @FT_Done_Library.
*/
typedef struct FT_LibraryRec_ *FT_Library;
/**************************************************************************
*
* @section:
* module_management
*
*/
/**************************************************************************
*
* @type:
* FT_Module
*
* @description:
* A handle to a given FreeType module object. A module can be a font
* driver, a renderer, or anything else that provides services to the
* former.
*/
typedef struct FT_ModuleRec_* FT_Module;
/**************************************************************************
*
* @type:
* FT_Driver
*
* @description:
* A handle to a given FreeType font driver object. A font driver is a
* module capable of creating faces from font files.
*/
typedef struct FT_DriverRec_* FT_Driver;
/**************************************************************************
*
* @type:
* FT_Renderer
*
* @description:
* A handle to a given FreeType renderer. A renderer is a module in
* charge of converting a glyph's outline image to a bitmap. It supports
* a single glyph image format, and one or more target surface depths.
*/
typedef struct FT_RendererRec_* FT_Renderer;
/**************************************************************************
*
* @section:
* base_interface
*
*/
/**************************************************************************
*
* @type:
* FT_Face
*
* @description:
* A handle to a typographic face object. A face object models a given
* typeface, in a given style.
*
* @note:
* A face object also owns a single @FT_GlyphSlot object, as well as one
* or more @FT_Size objects.
*
* Use @FT_New_Face or @FT_Open_Face to create a new face object from a
* given filepath or a custom input stream.
*
* 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.
*/
typedef struct FT_FaceRec_* FT_Face;
/**************************************************************************
*
* @type:
* FT_Size
*
* @description:
* A handle to an object that models a face scaled to a given character
* size.
*
* @note:
* An @FT_Face has one _active_ @FT_Size object that is used by functions
* like @FT_Load_Glyph to determine the scaling transformation that in
* turn is used to load and hint glyphs and metrics.
*
* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
* or even @FT_Select_Size to change the content (i.e., the scaling
* values) of the active @FT_Size.
*
* You can use @FT_New_Size to create additional size objects for a given
* @FT_Face, but they won't be used by other functions until you activate
* it through @FT_Activate_Size. Only one size can be activated at any
* given time per face.
*
* @also:
* See @FT_SizeRec for the publicly accessible fields of a given size
* object.
*/
typedef struct FT_SizeRec_* FT_Size;
/**************************************************************************
*
* @type:
* FT_GlyphSlot
*
* @description:
* A handle to a given 'glyph slot'. A slot is a container that can hold
* any of the glyphs contained in its parent face.
*
* In other words, each time you call @FT_Load_Glyph or @FT_Load_Char,
* the slot's content is erased by the new glyph data, i.e., the glyph's
* metrics, its image (bitmap or outline), and other control information.
*
* @also:
* See @FT_GlyphSlotRec for the publicly accessible glyph fields.
*/
typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
/**************************************************************************
*
* @type:
* FT_CharMap
*
* @description:
* A handle to a character map (usually abbreviated to 'charmap'). A
* charmap is used to translate character codes in a given encoding into
* glyph indexes for its parent's face. Some font formats may provide
* several charmaps per font.
*
* Each face object owns zero or more charmaps, but only one of them can
* be 'active', providing the data used by @FT_Get_Char_Index or
* @FT_Load_Char.
*
* The list of available charmaps in a face is available through the
* `face->num_charmaps` and `face->charmaps` fields of @FT_FaceRec.
*
* The currently active charmap is available as `face->charmap`. You
* should call @FT_Set_Charmap to change it.
*
* @note:
* When a new face is created (either through @FT_New_Face or
* @FT_Open_Face), the library looks for a Unicode charmap within the
* list and automatically activates it. If there is no Unicode charmap,
* FreeType doesn't set an 'active' charmap.
*
* @also:
* See @FT_CharMapRec for the publicly accessible fields of a given
* character map.
*/
typedef struct FT_CharMapRec_* FT_CharMap;
/**************************************************************************
*
* @macro:
* FT_ENC_TAG
*
* @description:
* This macro converts four-letter tags into an unsigned long. It is
* used to define 'encoding' identifiers (see @FT_Encoding).
*
* @note:
* Since many 16-bit compilers don't like 32-bit enumerations, you should
* redefine this macro in case of problems to something like this:
*
* ```
* #define FT_ENC_TAG( value, a, b, c, d ) value
* ```
*
* to get a simple enumeration without assigning special numbers.
*/
#ifndef FT_ENC_TAG
#define FT_ENC_TAG( value, a, b, c, d ) \
value = ( ( (FT_UInt32)(a) << 24 ) | \
( (FT_UInt32)(b) << 16 ) | \
( (FT_UInt32)(c) << 8 ) | \
(FT_UInt32)(d) )
#endif /* FT_ENC_TAG */
/**************************************************************************
*
* @enum:
* FT_Encoding
*
* @description:
* An enumeration to specify character sets supported by charmaps. Used
* in the @FT_Select_Charmap API function.
*
* @note:
* Despite the name, this enumeration lists specific character
* repertories (i.e., charsets), and not text encoding methods (e.g.,
* UTF-8, UTF-16, etc.).
*
* Other encodings might be defined in the future.
*
* @values:
* FT_ENCODING_NONE ::
* The encoding value~0 is reserved for all formats except BDF, PCF,
* and Windows FNT; see below for more information.
*
* FT_ENCODING_UNICODE ::
* The Unicode character set. This value covers all versions of the
* Unicode repertoire, including ASCII and Latin-1. Most fonts include
* a Unicode charmap, but not all of them.
*
* For example, if you want to access Unicode value U+1F028 (and the
* font contains it), use value 0x1F028 as the input value for
* @FT_Get_Char_Index.
*
* FT_ENCODING_MS_SYMBOL ::
* Microsoft Symbol encoding, used to encode mathematical symbols and
* wingdings. For more information, see
* 'https://www.microsoft.com/typography/otspec/recom.htm#non-standard-symbol-fonts',
* '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 ::
* Shift JIS encoding for Japanese. More info at
* 'https://en.wikipedia.org/wiki/Shift_JIS'. See note on multi-byte
* encodings below.
*
* FT_ENCODING_PRC ::
* Corresponds to encoding systems mainly for Simplified Chinese as
* used in People's Republic of China (PRC). The encoding layout is
* based on GB~2312 and its supersets GBK and GB~18030.
*
* FT_ENCODING_BIG5 ::
* Corresponds to an encoding system for Traditional Chinese as used in
* Taiwan and Hong Kong.
*
* FT_ENCODING_WANSUNG ::
* Corresponds to the Korean encoding system known as Extended Wansung
* (MS Windows code page 949). For more information see
* 'https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'.
*
* FT_ENCODING_JOHAB ::
* The Korean standard character set (KS~C 5601-1992), which
* corresponds to MS Windows code page 1361. This character set
* includes all possible Hangul character combinations.
*
* FT_ENCODING_ADOBE_LATIN_1 ::
* Corresponds to a Latin-1 encoding as defined in a Type~1 PostScript
* font. It is limited to 256 character codes.
*
* FT_ENCODING_ADOBE_STANDARD ::
* Adobe Standard encoding, as found in Type~1, CFF, and OpenType/CFF
* fonts. It is limited to 256 character codes.
*
* FT_ENCODING_ADOBE_EXPERT ::
* Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF
* fonts. It is limited to 256 character codes.
*
* FT_ENCODING_ADOBE_CUSTOM ::
* Corresponds to a custom encoding, as found in Type~1, CFF, and
* OpenType/CFF fonts. It is limited to 256 character codes.
*
* FT_ENCODING_APPLE_ROMAN ::
* Apple roman encoding. Many TrueType and OpenType fonts contain a
* charmap for this 8-bit encoding, since older versions of Mac OS are
* able to use it.
*
* FT_ENCODING_OLD_LATIN_2 ::
* This value is deprecated and was neither used nor reported by
* FreeType. Don't use or test for it.
*
* FT_ENCODING_MS_SJIS ::
* Same as FT_ENCODING_SJIS. Deprecated.
*
* FT_ENCODING_MS_GB2312 ::
* Same as FT_ENCODING_PRC. Deprecated.
*
* FT_ENCODING_MS_BIG5 ::
* Same as FT_ENCODING_BIG5. Deprecated.
*
* FT_ENCODING_MS_WANSUNG ::
* Same as FT_ENCODING_WANSUNG. Deprecated.
*
* FT_ENCODING_MS_JOHAB ::
* Same as FT_ENCODING_JOHAB. Deprecated.
*
* @note:
* By default, FreeType enables a Unicode charmap and tags it with
* `FT_ENCODING_UNICODE` when it is either provided or can be generated
* from PostScript glyph name dictionaries in the font file. All other
* encodings are considered legacy and tagged only if explicitly defined
* in the font file. Otherwise, `FT_ENCODING_NONE` is used.
*
* `FT_ENCODING_NONE` is set by the BDF and PCF drivers if the charmap is
* neither Unicode nor ISO-8859-1 (otherwise it is set to
* `FT_ENCODING_UNICODE`). Use @FT_Get_BDF_Charset_ID to find out which
* encoding is really present. If, for example, the `cs_registry` field
* is 'KOI8' and the `cs_encoding` field is 'R', the font is encoded in
* KOI8-R.
*
* `FT_ENCODING_NONE` is always set (with a single exception) by the
* winfonts driver. Use @FT_Get_WinFNT_Header and examine the `charset`
* field of the @FT_WinFNT_HeaderRec structure to find out which encoding
* is really present. For example, @FT_WinFNT_ID_CP1251 (204) means
* Windows code page 1251 (for Russian).
*
* `FT_ENCODING_NONE` is set if `platform_id` is @TT_PLATFORM_MACINTOSH
* and `encoding_id` is not `TT_MAC_ID_ROMAN` (otherwise it is set to
* `FT_ENCODING_APPLE_ROMAN`).
*
* If `platform_id` is @TT_PLATFORM_MACINTOSH, use the function
* @FT_Get_CMap_Language_ID to query the Mac language ID that may be
* needed to be able to distinguish Apple encoding variants. See
*
* https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt
*
* to get an idea how to do that. Basically, if the language ID is~0,
* don't use it, otherwise subtract 1 from the language ID. Then examine
* `encoding_id`. If, for example, `encoding_id` is `TT_MAC_ID_ROMAN`
* and the language ID (minus~1) is `TT_MAC_LANGID_GREEK`, it is the
* Greek encoding, not Roman. `TT_MAC_ID_ARABIC` with
* `TT_MAC_LANGID_FARSI` means the Farsi variant the Arabic encoding.
*/
typedef enum FT_Encoding_
{
FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
FT_ENC_TAG( FT_ENCODING_PRC, 'g', 'b', ' ', ' ' ),
FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
/* for backward compatibility */
FT_ENCODING_GB2312 = FT_ENCODING_PRC,
FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,
FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
} FT_Encoding;
/* these constants are deprecated; use the corresponding `FT_Encoding` */
/* values instead */
#define ft_encoding_none FT_ENCODING_NONE
#define ft_encoding_unicode FT_ENCODING_UNICODE
#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
#define ft_encoding_sjis FT_ENCODING_SJIS
#define ft_encoding_gb2312 FT_ENCODING_PRC
#define ft_encoding_big5 FT_ENCODING_BIG5
#define ft_encoding_wansung FT_ENCODING_WANSUNG
#define ft_encoding_johab FT_ENCODING_JOHAB
#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
/**************************************************************************
*
* @struct:
* FT_CharMapRec
*
* @description:
* The base charmap structure.
*
* @fields:
* face ::
* A handle to the parent face object.
*
* encoding ::
* An @FT_Encoding tag identifying the charmap. Use this with
* @FT_Select_Charmap.
*
* platform_id ::
* An ID number describing the platform for the following encoding ID.
* This comes directly from the TrueType specification and gets
* emulated for other formats.
*
* encoding_id ::
* A platform-specific encoding number. This also comes from the
* TrueType specification and gets emulated similarly.
*/
typedef struct FT_CharMapRec_
{
FT_Face face;
FT_Encoding encoding;
FT_UShort platform_id;
FT_UShort encoding_id;
} FT_CharMapRec;
/*************************************************************************/
/*************************************************************************/
/* */
/* B A S E O B J E C T C L A S S E S */
/* */
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @type:
* FT_Face_Internal
*
* @description:
* An opaque handle to an `FT_Face_InternalRec` structure that models the
* private data of a given @FT_Face object.
*
* This structure might change between releases of FreeType~2 and is not
* generally available to client applications.
*/
typedef struct FT_Face_InternalRec_* FT_Face_Internal;
/**************************************************************************
*
* @struct:
* FT_FaceRec
*
* @description:
* FreeType root face class structure. A face object models a typeface
* in a font file.
*
* @fields:
* num_faces ::
* The number of faces in the font file. Some font formats can have
* multiple faces in a single font file.
*
* 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.
*
* [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation
* fonts only, holding the named instance index for the current face
* index (starting with value~1; value~0 indicates font access without
* a named instance). For non-variation 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).
*
* [Since 2.9] Changing the design coordinates with
* @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
* not influence the named instance index value (only
* @FT_Set_Named_Instance does that).
*
* face_flags ::
* A set of bit flags that give important information about the face;
* see @FT_FACE_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.
*
* [Since 2.6.1] Bits 16-30 hold the number of named instances
* available for the current face if we have a GX or OpenType variation
* (sub)font. Bit 31 is always zero (this is, `style_flags` is always
* a positive value). Note that a variation font has always at least
* one named instance, namely the default instance.
*
* num_glyphs ::
* The number of glyphs in the face. If the face is scalable and has
* sbits (see `num_fixed_sizes`), it is set to the number of outline
* glyphs.
*
* For CID-keyed fonts (not in an SFNT wrapper) this value gives the
* highest CID used in the font.
*
* family_name ::
* The face's family name. This is an ASCII string, usually in
* English, that describes the typeface's family (like 'Times New
* Roman', 'Bodoni', 'Garamond', etc). This is a least common
* denominator used to list fonts. Some formats (TrueType & OpenType)
* provide localized and Unicode versions of this string. Applications
* should use the format-specific interface to access them. 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', 'Bold',
* 'Condensed', etc). Not all font formats provide a style name, so
* this field is optional, and can be set to `NULL`. As for
* `family_name`, some formats provide localized and Unicode versions
* of this string. Applications should use the format-specific
* interface to access them.
*
* num_fixed_sizes ::
* The number of bitmap strikes in the face. Even if the face is
* scalable, there might still be bitmap strikes, which are called
* 'sbits' in that case.
*
* available_sizes ::
* An array of @FT_Bitmap_Size for all bitmap strikes in the face. It
* is set to `NULL` if there is no bitmap strike.
*
* Note that FreeType tries to sanitize the strike data since they are
* sometimes sloppy or incorrect, but this can easily fail.
*
* num_charmaps ::
* The number of charmaps in the face.
*
* charmaps ::
* An array of the charmaps of the face.
*
* generic ::
* A field reserved for client uses. See the @FT_Generic type
* description.
*
* bbox ::
* The font bounding box. Coordinates are expressed in font units (see
* `units_per_EM`). The box is large enough to contain any glyph from
* the font. Thus, `bbox.yMax` can be seen as the 'maximum ascender',
* and `bbox.yMin` as the 'minimum descender'. Only relevant for
* scalable formats.
*
* Note that the bounding box might be off by (at least) one pixel for
* hinted fonts. See @FT_Size_Metrics for further discussion.
*
* units_per_EM ::
* The number of font units per EM square for this face. This is
* typically 2048 for TrueType fonts, and 1000 for Type~1 fonts. Only
* relevant for scalable formats.
*
* ascender ::
* The typographic ascender of the face, expressed in font units. For
* font formats not having this information, it is set to `bbox.yMax`.
* Only relevant for scalable formats.
*
* descender ::
* The typographic descender of the face, expressed in font units. For
* font formats not having this information, it is set to `bbox.yMin`.
* Note that this field is negative for values below the baseline.
* Only relevant for scalable formats.
*
* height ::
* This value is the vertical distance between two consecutive
* baselines, expressed in font units. It is always positive. Only
* relevant for scalable formats.
*
* If you want the global glyph height, use `ascender - descender`.
*
* max_advance_width ::
* The maximum advance width, in font units, for all glyphs in this
* face. This can be used to make word wrapping computations faster.
* Only relevant for scalable formats.
*
* max_advance_height ::
* The maximum advance height, in font units, for all glyphs in this
* face. This is only relevant for vertical layouts, and is set to
* `height` for fonts that do not provide vertical metrics. Only
* relevant for scalable formats.
*
* underline_position ::
* The position, in font units, of the underline line for this face.
* It is the center of the underlining stem. Only relevant for
* scalable formats.
*
* underline_thickness ::
* The thickness, in font units, of the underline for this face. Only
* relevant for scalable formats.
*
* glyph ::
* The face's associated glyph slot(s).
*
* size ::
* The current active size for this face.
*
* charmap ::
* The current active charmap for this face.
*
* @note:
* Fields may be changed after a call to @FT_Attach_File or
* @FT_Attach_Stream.
*
* For an OpenType variation font, the values of the following fields can
* change after a call to @FT_Set_Var_Design_Coordinates (and friends) if
* the font contains an 'MVAR' table: `ascender`, `descender`, `height`,
* `underline_position`, and `underline_thickness`.
*
* Especially for TrueType fonts see also the documentation for
* @FT_Size_Metrics.
*/
typedef struct FT_FaceRec_
{
FT_Long num_faces;
FT_Long face_index;
FT_Long face_flags;
FT_Long style_flags;
FT_Long num_glyphs;
FT_String* family_name;
FT_String* style_name;
FT_Int num_fixed_sizes;
FT_Bitmap_Size* available_sizes;
FT_Int num_charmaps;
FT_CharMap* charmaps;
FT_Generic generic;
/*# The following member variables (down to `underline_thickness`) */
/*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
/*# for bitmap fonts. */
FT_BBox bbox;
FT_UShort units_per_EM;
FT_Short ascender;
FT_Short descender;
FT_Short height;
FT_Short max_advance_width;
FT_Short max_advance_height;
FT_Short underline_position;
FT_Short underline_thickness;
FT_GlyphSlot glyph;
FT_Size size;
FT_CharMap charmap;
/*@private begin */
FT_Driver driver;
FT_Memory memory;
FT_Stream stream;
FT_ListRec sizes_list;
FT_Generic autohint; /* face-specific auto-hinter data */
void* extensions; /* unused */
FT_Face_Internal internal;
/*@private end */
} FT_FaceRec;
/**************************************************************************
*
* @enum:
* FT_FACE_FLAG_XXX
*
* @description:
* A list of bit flags used in the `face_flags` field of the @FT_FaceRec
* structure. They inform client applications of properties of the
* corresponding face.
*
* @values:
* FT_FACE_FLAG_SCALABLE ::
* The face contains outline glyphs. Note that a face can contain
* bitmap strikes also, i.e., a face can have both this flag and
* @FT_FACE_FLAG_FIXED_SIZES set.
*
* FT_FACE_FLAG_FIXED_SIZES ::
* The face contains bitmap strikes. See also the `num_fixed_sizes`
* and `available_sizes` fields of @FT_FaceRec.
*
* FT_FACE_FLAG_FIXED_WIDTH ::
* The face contains fixed-width characters (like Courier, Lucida,
* MonoType, etc.).
*
* FT_FACE_FLAG_SFNT ::
* The face uses the SFNT storage scheme. For now, this means TrueType
* and OpenType.
*
* FT_FACE_FLAG_HORIZONTAL ::
* The face contains horizontal glyph metrics. This should be set for
* all common formats.
*
* FT_FACE_FLAG_VERTICAL ::
* The face contains vertical glyph metrics. This is only available in
* some formats, not all of them.
*
* FT_FACE_FLAG_KERNING ::
* The face contains kerning information. If set, the kerning distance
* can be retrieved using the function @FT_Get_Kerning. Otherwise the
* function always return the vector (0,0). Note that FreeType doesn't
* handle kerning data from the SFNT 'GPOS' table (as present in many
* OpenType fonts).
*
* FT_FACE_FLAG_FAST_GLYPHS ::
* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT.
*
* FT_FACE_FLAG_MULTIPLE_MASTERS ::
* The face contains multiple masters and is capable of interpolating
* between them. Supported formats are Adobe MM, TrueType GX, and
* OpenType variation fonts.
*
* See section @multiple_masters for API details.
*
* FT_FACE_FLAG_GLYPH_NAMES ::
* The face contains glyph names, which can be retrieved using
* @FT_Get_Glyph_Name. Note that some TrueType fonts contain broken
* glyph name tables. Use the function @FT_Has_PS_Glyph_Names when
* needed.
*
* FT_FACE_FLAG_EXTERNAL_STREAM ::
* Used internally by FreeType to indicate that a face's stream was
* provided by the client application and should not be destroyed when
* @FT_Done_Face is called. Don't read or test this flag.
*
* FT_FACE_FLAG_HINTER ::
* The font driver has a hinting machine of its own. For example, with
* TrueType fonts, it makes sense to use data from the SFNT 'gasp'
* table only if the native TrueType hinting engine (with the bytecode
* interpreter) is available and active.
*
* FT_FACE_FLAG_CID_KEYED ::
* The face is CID-keyed. In that case, the face is not accessed by
* glyph indices but by CID values. For subsetted CID-keyed fonts this
* has the consequence that not all index values are a valid argument
* to @FT_Load_Glyph. Only the CID values for which corresponding
* glyphs in the subsetted font exist make `FT_Load_Glyph` return
* successfully; in all other cases you get an
* `FT_Err_Invalid_Argument` error.
*
* Note that CID-keyed fonts that are in an SFNT wrapper (this is, all
* OpenType/CFF fonts) don't have this flag set since the glyphs are
* accessed in the normal way (using contiguous indices); the
* 'CID-ness' isn't visible to the application.
*
* FT_FACE_FLAG_TRICKY ::
* The face is 'tricky', this is, it always needs the font format's
* native hinting engine to get a reasonable result. A typical example
* is the old Chinese font `mingli.ttf` (but not `mingliu.ttc`) that
* uses TrueType bytecode instructions to move and scale all of its
* subglyphs.
*
* 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 probably never want this except
* for demonstration purposes.
*
* Currently, there are about a dozen TrueType fonts in the list of
* tricky fonts; they are hard-coded in file `ttobjs.c`.
*
* FT_FACE_FLAG_COLOR ::
* [Since 2.5.1] The face has color glyph tables. See @FT_LOAD_COLOR
* for more information.
*
* FT_FACE_FLAG_VARIATION ::
* [Since 2.9] Set if the current face (or named instance) has been
* altered with @FT_Set_MM_Design_Coordinates,
* @FT_Set_Var_Design_Coordinates, or @FT_Set_Var_Blend_Coordinates.
* This flag is unset by a call to @FT_Set_Named_Instance.
*/
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
#define FT_FACE_FLAG_SFNT ( 1L << 3 )
#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
#define FT_FACE_FLAG_KERNING ( 1L << 6 )
#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
#define FT_FACE_FLAG_HINTER ( 1L << 11 )
#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
#define FT_FACE_FLAG_COLOR ( 1L << 14 )
#define FT_FACE_FLAG_VARIATION ( 1L << 15 )
/**************************************************************************
*
* @macro:
* FT_HAS_HORIZONTAL
*
* @description:
* A macro that returns true whenever a face object contains horizontal
* metrics (this is true for all font formats though).
*
* @also:
* @FT_HAS_VERTICAL can be used to check for vertical metrics.
*
*/
#define FT_HAS_HORIZONTAL( face ) \
( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
/**************************************************************************
*
* @macro:
* FT_HAS_VERTICAL
*
* @description:
* A macro that returns true whenever a face object contains real
* vertical metrics (and not only synthesized ones).
*
*/
#define FT_HAS_VERTICAL( face ) \
( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
/**************************************************************************
*
* @macro:
* FT_HAS_KERNING
*
* @description:
* A macro that returns true whenever a face object contains kerning data
* that can be accessed with @FT_Get_Kerning.
*
*/
#define FT_HAS_KERNING( face ) \
( (face)->face_flags & FT_FACE_FLAG_KERNING )
/**************************************************************************
*
* @macro:
* FT_IS_SCALABLE
*
* @description:
* A macro that returns true whenever a face object contains a scalable
* font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, and
* PFR font formats).
*
*/
#define FT_IS_SCALABLE( face ) \
( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
/**************************************************************************
*
* @macro:
* FT_IS_SFNT
*
* @description:
* A macro that returns true whenever a face object contains a font whose
* format is based on the SFNT storage scheme. This usually means:
* TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap
* fonts.
*
* If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
* @FT_TRUETYPE_TABLES_H are available.
*
*/
#define FT_IS_SFNT( face ) \
( (face)->face_flags & FT_FACE_FLAG_SFNT )
/**************************************************************************
*
* @macro:
* FT_IS_FIXED_WIDTH
*
* @description:
* A macro that returns true whenever a face object contains a font face
* that contains fixed-width (or 'monospace', 'fixed-pitch', etc.)
* glyphs.
*
*/
#define FT_IS_FIXED_WIDTH( face ) \
( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
/**************************************************************************
*
* @macro:
* FT_HAS_FIXED_SIZES
*
* @description:
* A macro that returns true whenever a face object contains some
* embedded bitmaps. See the `available_sizes` field of the @FT_FaceRec
* structure.
*
*/
#define FT_HAS_FIXED_SIZES( face ) \
( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
/**************************************************************************
*
* @macro:
* FT_HAS_FAST_GLYPHS
*
* @description:
* Deprecated.
*
*/
#define FT_HAS_FAST_GLYPHS( face ) 0
/**************************************************************************
*
* @macro:
* FT_HAS_GLYPH_NAMES
*
* @description:
* A macro that returns true whenever a face object contains some glyph
* names that can be accessed through @FT_Get_Glyph_Name.
*
*/
#define FT_HAS_GLYPH_NAMES( face ) \
( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
/**************************************************************************
*
* @macro:
* FT_HAS_MULTIPLE_MASTERS
*
* @description:
* A macro that returns true whenever a face object contains some
* multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
* are then available to choose the exact design you want.
*
*/
#define FT_HAS_MULTIPLE_MASTERS( face ) \
( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
/**************************************************************************
*
* @macro:
* FT_IS_NAMED_INSTANCE
*
* @description:
* A macro that returns true whenever a face object is a named instance
* of a GX or OpenType variation font.
*
* [Since 2.9] Changing the design coordinates with
* @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does
* not influence the return value of this macro (only
* @FT_Set_Named_Instance does that).
*
* @since:
* 2.7
*
*/
#define FT_IS_NAMED_INSTANCE( face ) \
( (face)->face_index & 0x7FFF0000L )
/**************************************************************************
*
* @macro:
* FT_IS_VARIATION
*
* @description:
* A macro that returns true whenever a face object has been altered by
* @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or
* @FT_Set_Var_Blend_Coordinates.
*
* @since:
* 2.9
*
*/
#define FT_IS_VARIATION( face ) \
( (face)->face_flags & FT_FACE_FLAG_VARIATION )
/**************************************************************************
*
* @macro:
* FT_IS_CID_KEYED
*
* @description:
* A macro that returns true whenever a face object contains a CID-keyed
* font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more details.
*
* If this macro is true, all functions defined in @FT_CID_H are
* available.
*
*/
#define FT_IS_CID_KEYED( face ) \
( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
/**************************************************************************
*
* @macro:
* FT_IS_TRICKY
*
* @description:
* A macro that returns true whenever a face represents a 'tricky' font.
* See the discussion of @FT_FACE_FLAG_TRICKY for more details.
*
*/
#define FT_IS_TRICKY( face ) \
( (face)->face_flags & FT_FACE_FLAG_TRICKY )
/**************************************************************************
*
* @macro:
* FT_HAS_COLOR
*
* @description:
* A macro that returns true whenever a face object contains tables for
* color glyphs.
*
* @since:
* 2.5.1
*
*/
#define FT_HAS_COLOR( face ) \
( (face)->face_flags & FT_FACE_FLAG_COLOR )
/**************************************************************************
*
* @enum:
* FT_STYLE_FLAG_XXX
*
* @description:
* A list of bit flags to indicate the style of a given face. These are
* used in the `style_flags` field of @FT_FaceRec.
*
* @values:
* FT_STYLE_FLAG_ITALIC ::
* The face style is italic or oblique.
*
* FT_STYLE_FLAG_BOLD ::
* The face is bold.
*
* @note:
* The style information as provided by FreeType is very basic. More
* details are beyond the scope and should be done on a higher level (for
* example, by analyzing various fields of the 'OS/2' table in SFNT based
* fonts).
*/
#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
#define FT_STYLE_FLAG_BOLD ( 1 << 1 )
/**************************************************************************
*
* @type:
* FT_Size_Internal
*
* @description:
* An opaque handle to an `FT_Size_InternalRec` structure, used to model
* private data of a given @FT_Size object.
*/
typedef struct FT_Size_InternalRec_* FT_Size_Internal;
/**************************************************************************
*
* @struct:
* FT_Size_Metrics
*
* @description:
* The size metrics structure gives the metrics of a size object.
*
* @fields:
* x_ppem ::
* The width of the scaled EM square in pixels, hence the term 'ppem'
* (pixels per EM). It is also referred to as 'nominal width'.
*
* y_ppem ::
* The height of the scaled EM square in pixels, hence the term 'ppem'
* (pixels per EM). It is also referred to as 'nominal height'.
*
* x_scale ::
* A 16.16 fractional scaling value to convert horizontal metrics from
* font units to 26.6 fractional pixels. Only relevant for scalable
* font formats.
*
* y_scale ::
* A 16.16 fractional scaling value to convert vertical metrics from
* font units to 26.6 fractional pixels. Only relevant for scalable
* font formats.
*
* ascender ::
* The ascender in 26.6 fractional pixels, rounded up to an integer
* value. See @FT_FaceRec for the details.
*
* descender ::
* The descender in 26.6 fractional pixels, rounded down to an integer
* value. See @FT_FaceRec for the details.
*
* height ::
* The height in 26.6 fractional pixels, rounded to an integer value.
* See @FT_FaceRec for the details.
*
* max_advance ::
* The maximum advance width in 26.6 fractional pixels, rounded to an
* integer value. See @FT_FaceRec for the details.
*
* @note:
* The scaling values, if relevant, are determined first during a size
* changing operation. The remaining fields are then set by the driver.
* For scalable formats, they are usually set to scaled values of the
* corresponding fields in @FT_FaceRec. Some values like ascender or
* descender are rounded for historical reasons; more precise values (for
* outline fonts) can be derived by scaling the corresponding @FT_FaceRec
* values manually, with code similar to the following.
*
* ```
* scaled_ascender = FT_MulFix( face->ascender,
* size_metrics->y_scale );
* ```
*
* Note that due to glyph hinting and the selected rendering mode these
* values are usually not exact; consequently, they must be treated as
* unreliable with an error margin of at least one pixel!
*
* Indeed, the only way to get the exact metrics is to render _all_
* glyphs. As this would be a definite performance hit, it is up to
* client applications to perform such computations.
*
* The `FT_Size_Metrics` structure is valid for bitmap fonts also.
*
*
* **TrueType fonts with native bytecode hinting**
*
* All applications that handle TrueType fonts with native hinting must
* be aware that TTFs expect different rounding of vertical font
* dimensions. The application has to cater for this, especially if it
* wants to rely on a TTF's vertical data (for example, to properly align
* box characters vertically).
*
* Only the application knows _in advance_ that it is going to use native
* hinting for TTFs! FreeType, on the other hand, selects the hinting
* mode not at the time of creating an @FT_Size object but much later,
* namely while calling @FT_Load_Glyph.
*
* Here is some pseudo code that illustrates a possible solution.
*
* ```
* font_format = FT_Get_Font_Format( face );
*
* if ( !strcmp( font_format, "TrueType" ) &&
* do_native_bytecode_hinting )
* {
* ascender = ROUND( FT_MulFix( face->ascender,
* size_metrics->y_scale ) );
* descender = ROUND( FT_MulFix( face->descender,
* size_metrics->y_scale ) );
* }
* else
* {
* ascender = size_metrics->ascender;
* descender = size_metrics->descender;
* }
*
* height = size_metrics->height;
* max_advance = size_metrics->max_advance;
* ```
*/
typedef struct FT_Size_Metrics_
{
FT_UShort x_ppem; /* horizontal pixels per EM */
FT_UShort y_ppem; /* vertical pixels per EM */
FT_Fixed x_scale; /* scaling values used to convert font */
FT_Fixed y_scale; /* units to 26.6 fractional pixels */
FT_Pos ascender; /* ascender in 26.6 frac. pixels */
FT_Pos descender; /* descender in 26.6 frac. pixels */
FT_Pos height; /* text height in 26.6 frac. pixels */
FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
} FT_Size_Metrics;
/**************************************************************************
*
* @struct:
* FT_SizeRec
*
* @description:
* FreeType root size class structure. A size object models a face
* object at a given size.
*
* @fields:
* face ::
* Handle to the parent face object.
*
* generic ::
* A typeless pointer, unused by the FreeType library or any of its
* drivers. It can be used by client applications to link their own
* data to each size object.
*
* metrics ::
* Metrics for this size object. This field is read-only.
*/
typedef struct FT_SizeRec_
{
FT_Face face; /* parent face object */
FT_Generic generic; /* generic pointer for client uses */
FT_Size_Metrics metrics; /* size metrics */
FT_Size_Internal internal;
} FT_SizeRec;
/**************************************************************************
*
* @struct:
* FT_SubGlyph
*
* @description:
* The subglyph structure is an internal object used to describe
* subglyphs (for example, in the case of composites).
*
* @note:
* The subglyph implementation is not part of the high-level API, hence
* the forward structure declaration.
*
* You can however retrieve subglyph information with
* @FT_Get_SubGlyph_Info.
*/
typedef struct FT_SubGlyphRec_* FT_SubGlyph;
/**************************************************************************
*
* @type:
* FT_Slot_Internal
*
* @description:
* An opaque handle to an `FT_Slot_InternalRec` structure, used to model
* private data of a given @FT_GlyphSlot object.
*/
typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
/**************************************************************************
*
* @struct:
* FT_GlyphSlotRec
*
* @description:
* FreeType root glyph slot class structure. A glyph slot is a container
* where individual glyphs can be loaded, be they in outline or bitmap
* format.
*
* @fields:
* library ::
* A handle to the FreeType library instance this slot belongs to.
*
* face ::
* A handle to the parent face object.
*
* next ::
* In some cases (like some font tools), several glyph slots per face
* object can be a good thing. As this is rare, the glyph slots are
* listed through a direct, single-linked list using its `next` field.
*
* glyph_index ::
* [Since 2.10] The glyph index passed as an argument to @FT_Load_Glyph
* while initializing the glyph slot.
*
* generic ::
* A typeless pointer unused by the FreeType library or any of its
* drivers. It can be used by client applications to link their own
* data to each glyph slot object.
*
* metrics ::
* The metrics of the last loaded glyph in the slot. The returned
* values depend on the last load flags (see the @FT_Load_Glyph API
* function) and can be expressed either in 26.6 fractional pixels or
* font units.
*
* Note that even when the glyph image is transformed, the metrics are
* not.
*
* linearHoriAdvance ::
* The advance width of the unhinted glyph. Its value is expressed in
* 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when
* loading the glyph. This field can be important to perform correct
* WYSIWYG layout. Only relevant for outline glyphs.
*
* linearVertAdvance ::
* The advance height of the unhinted glyph. Its value is expressed in
* 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when
* loading the glyph. This field can be important to perform correct
* WYSIWYG layout. Only relevant for outline glyphs.
*
* advance ::
* This shorthand is, depending on @FT_LOAD_IGNORE_TRANSFORM, the
* transformed (hinted) advance width for the glyph, in 26.6 fractional
* pixel format. As specified with @FT_LOAD_VERTICAL_LAYOUT, it uses
* either the `horiAdvance` or the `vertAdvance` value of `metrics`
* field.
*
* format ::
* This field indicates the format of the image contained in the glyph
* slot. Typically @FT_GLYPH_FORMAT_BITMAP, @FT_GLYPH_FORMAT_OUTLINE,
* or @FT_GLYPH_FORMAT_COMPOSITE, but other values are possible.
*
* bitmap ::
* This field is used as a bitmap descriptor. Note that the address
* and content of the bitmap buffer can change between calls of
* @FT_Load_Glyph and a few other functions.
*
* bitmap_left ::
* The bitmap's left bearing expressed in integer pixels.
*
* bitmap_top ::
* The bitmap's top bearing expressed in integer pixels. This is the
* distance from the baseline to the top-most glyph scanline, upwards
* y~coordinates being **positive**.
*
* outline ::
* The outline descriptor for the current glyph image if its format is
* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is loaded, `outline` can be
* transformed, distorted, emboldened, etc. However, it must not be
* freed.
*
* [Since 2.10.1] If @FT_LOAD_NO_SCALE is set, outline coordinates of
* OpenType variation fonts for a selected instance are internally
* handled as 26.6 fractional font units but returned as (rounded)
* integers, as expected. To get unrounded font units, don't use
* @FT_LOAD_NO_SCALE but load the glyph with @FT_LOAD_NO_HINTING and
* scale it, using the font's `units_per_EM` value as the ppem.
*
* num_subglyphs ::
* The number of subglyphs in a composite glyph. This field is only
* valid for the composite glyph format that should normally only be
* loaded with the @FT_LOAD_NO_RECURSE flag.
*
* subglyphs ::
* An array of subglyph descriptors for composite glyphs. There are
* `num_subglyphs` elements in there. Currently internal to FreeType.
*
* control_data ::
* Certain font drivers can also return the control data for a given
* glyph image (e.g. TrueType bytecode, Type~1 charstrings, etc.).
* This field is a pointer to such data; it is currently internal to
* FreeType.
*
* control_len ::
* This is the length in bytes of the control data. Currently internal
* to FreeType.
*
* other ::
* Reserved.
*
* lsb_delta ::
* The difference between hinted and unhinted left side bearing while
* auto-hinting is active. Zero otherwise.
*
* rsb_delta ::
* The difference between hinted and unhinted right side bearing while
* auto-hinting is active. Zero otherwise.
*
* @note:
* If @FT_Load_Glyph is called with default flags (see @FT_LOAD_DEFAULT)
* the glyph image is loaded in the glyph slot in its native format
* (e.g., an outline glyph for TrueType and Type~1 formats). [Since 2.9]
* The prospective bitmap metrics are calculated according to
* @FT_LOAD_TARGET_XXX and other flags even for the outline glyph, even
* if @FT_LOAD_RENDER is not set.
*
* This image can later be converted into a bitmap by calling
* @FT_Render_Glyph. This function searches the current renderer for the
* native image's format, then invokes it.
*
* The renderer is in charge of transforming the native image through the
* slot's face transformation fields, then converting it into a bitmap
* that is returned in `slot->bitmap`.
*
* Note that `slot->bitmap_left` and `slot->bitmap_top` are also used to
* specify the position of the bitmap relative to the current pen
* position (e.g., coordinates (0,0) on the baseline). Of course,
* `slot->format` is also changed to @FT_GLYPH_FORMAT_BITMAP.
*
* Here is a small pseudo code fragment that shows how to use `lsb_delta`
* and `rsb_delta` to do fractional positioning of glyphs:
*
* ```
* FT_GlyphSlot slot = face->glyph;
* FT_Pos origin_x = 0;
*
*
* for all glyphs do
* <load glyph with `FT_Load_Glyph'>
*
* FT_Outline_Translate( slot->outline, origin_x & 63, 0 );
*
* <save glyph image, or render glyph, or ...>
*
* <compute kern between current and next glyph
* and add it to `origin_x'>
*
* origin_x += slot->advance.x;
* origin_x += slot->lsb_delta - slot->rsb_delta;
* endfor
* ```
*
* Here is another small pseudo code fragment that shows how to use
* `lsb_delta` and `rsb_delta` to improve integer positioning of glyphs:
*
* ```
* FT_GlyphSlot slot = face->glyph;
* FT_Pos origin_x = 0;
* FT_Pos prev_rsb_delta = 0;
*
*
* for all glyphs do
* <compute kern between current and previous glyph
* and add it to `origin_x'>
*
* <load glyph with `FT_Load_Glyph'>
*
* if ( prev_rsb_delta - slot->lsb_delta > 32 )
* origin_x -= 64;
* else if ( prev_rsb_delta - slot->lsb_delta < -31 )
* origin_x += 64;
*
* prev_rsb_delta = slot->rsb_delta;
*
* <save glyph image, or render glyph, or ...>
*
* origin_x += slot->advance.x;
* endfor
* ```
*
* If you use strong auto-hinting, you **must** apply these delta values!
* Otherwise you will experience far too large inter-glyph spacing at
* small rendering sizes in most cases. Note that it doesn't harm to use
* the above code for other hinting modes also, since the delta values
* are zero then.
*/
typedef struct FT_GlyphSlotRec_
{
FT_Library library;
FT_Face face;
FT_GlyphSlot next;
FT_UInt glyph_index; /* new in 2.10; was reserved previously */
FT_Generic generic;
FT_Glyph_Metrics metrics;
FT_Fixed linearHoriAdvance;
FT_Fixed linearVertAdvance;
FT_Vector advance;
FT_Glyph_Format format;
FT_Bitmap bitmap;
FT_Int bitmap_left;
FT_Int bitmap_top;
FT_Outline outline;
FT_UInt num_subglyphs;
FT_SubGlyph subglyphs;
void* control_data;
long control_len;
FT_Pos lsb_delta;
FT_Pos rsb_delta;
void* other;
FT_Slot_Internal internal;
} FT_GlyphSlotRec;
/*************************************************************************/
/*************************************************************************/
/* */
/* F U N C T I O N S */
/* */
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @function:
* FT_Init_FreeType
*
* @description:
* Initialize a new FreeType library object. The set of modules that are
* registered by this function is determined at build time.
*
* @output:
* alibrary ::
* A handle to a new library object.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* In case you want to provide your own memory allocating routines, use
* @FT_New_Library instead, followed by a call to @FT_Add_Default_Modules
* (or a series of calls to @FT_Add_Module) and
* @FT_Set_Default_Properties.
*
* 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.
*
* If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is
* set, this function reads the `FREETYPE_PROPERTIES` environment
* variable to control driver properties. See section @properties for
* more.
*/
FT_EXPORT( FT_Error )
FT_Init_FreeType( FT_Library *alibrary );
/**************************************************************************
*
* @function:
* FT_Done_FreeType
*
* @description:
* Destroy a given FreeType library object and all of its children,
* including resources, drivers, faces, sizes, etc.
*
* @input:
* library ::
* A handle to the target library object.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Done_FreeType( FT_Library library );
/**************************************************************************
*
* @enum:
* FT_OPEN_XXX
*
* @description:
* A list of bit field constants used within the `flags` field of the
* @FT_Open_Args structure.
*
* @values:
* FT_OPEN_MEMORY ::
* This is a memory-based stream.
*
* FT_OPEN_STREAM ::
* Copy the stream from the `stream` field.
*
* FT_OPEN_PATHNAME ::
* Create a new input stream from a C~path name.
*
* FT_OPEN_DRIVER ::
* Use the `driver` field.
*
* FT_OPEN_PARAMS ::
* Use the `num_params` and `params` fields.
*
* @note:
* The `FT_OPEN_MEMORY`, `FT_OPEN_STREAM`, and `FT_OPEN_PATHNAME` flags
* are mutually exclusive.
*/
#define FT_OPEN_MEMORY 0x1
#define FT_OPEN_STREAM 0x2
#define FT_OPEN_PATHNAME 0x4
#define FT_OPEN_DRIVER 0x8
#define FT_OPEN_PARAMS 0x10
/* these constants are deprecated; use the corresponding `FT_OPEN_XXX` */
/* values instead */
#define ft_open_memory FT_OPEN_MEMORY
#define ft_open_stream FT_OPEN_STREAM
#define ft_open_pathname FT_OPEN_PATHNAME
#define ft_open_driver FT_OPEN_DRIVER
#define ft_open_params FT_OPEN_PARAMS
/**************************************************************************
*
* @struct:
* FT_Parameter
*
* @description:
* A simple structure to pass more or less generic parameters to
* @FT_Open_Face and @FT_Face_Properties.
*
* @fields:
* tag ::
* A four-byte identification tag.
*
* data ::
* A pointer to the parameter data.
*
* @note:
* The ID and function of parameters are driver-specific. See section
* @parameter_tags for more information.
*/
typedef struct FT_Parameter_
{
FT_ULong tag;
FT_Pointer data;
} FT_Parameter;
/**************************************************************************
*
* @struct:
* FT_Open_Args
*
* @description:
* A structure to indicate how to open a new font file or stream. A
* pointer to such a structure can be used as a parameter for the
* functions @FT_Open_Face and @FT_Attach_Stream.
*
* @fields:
* flags ::
* A set of bit flags indicating how to use the structure.
*
* memory_base ::
* The first byte of the file in memory.
*
* memory_size ::
* The size in bytes of the file in memory.
*
* pathname ::
* A pointer to an 8-bit file pathname.
*
* stream ::
* A handle to a source stream object.
*
* driver ::
* This field is exclusively used by @FT_Open_Face; it simply specifies
* the font driver to use for opening the face. If set to `NULL`,
* FreeType tries to load the face with each one of the drivers in its
* list.
*
* num_params ::
* The number of extra parameters.
*
* params ::
* Extra parameters passed to the font driver when opening a new face.
*
* @note:
* The stream type is determined by the contents of `flags` that are
* tested in the following order by @FT_Open_Face:
*
* 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 not
* copied, and the client is responsible for releasing and destroying
* them _after_ the corresponding call to @FT_Done_Face.
*
* Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a custom
* input stream `stream` is used.
*
* Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this is a
* normal file and use `pathname` to open it.
*
* If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to open
* the file with the driver whose handler is in `driver`.
*
* If the @FT_OPEN_PARAMS bit is set, the parameters given by
* `num_params` and `params` is used. They are ignored otherwise.
*
* Ideally, both the `pathname` and `params` fields should be tagged as
* 'const'; this is missing for API backward compatibility. In other
* words, applications should treat them as read-only.
*/
typedef struct FT_Open_Args_
{
FT_UInt flags;
const FT_Byte* memory_base;
FT_Long memory_size;
FT_String* pathname;
FT_Stream stream;
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
} FT_Open_Args;
/**************************************************************************
*
* @function:
* FT_New_Face
*
* @description:
* Call @FT_Open_Face to open a font by its pathname.
*
* @inout:
* library ::
* A handle to the library resource.
*
* @input:
* pathname ::
* A path to the font file.
*
* 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`.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Use @FT_Done_Face to destroy the created @FT_Face object (along with
* its slot and sizes).
*/
FT_EXPORT( FT_Error )
FT_New_Face( FT_Library library,
const char* filepathname,
FT_Long face_index,
FT_Face *aface );
/**************************************************************************
*
* @function:
* FT_New_Memory_Face
*
* @description:
* Call @FT_Open_Face to open a font that has been loaded into memory.
*
* @inout:
* library ::
* A handle to the library resource.
*
* @input:
* file_base ::
* A pointer to the beginning of the font data.
*
* file_size ::
* The size of the memory chunk used by the font data.
*
* 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`.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You must not deallocate the memory before calling @FT_Done_Face.
*/
FT_EXPORT( FT_Error )
FT_New_Memory_Face( FT_Library library,
const FT_Byte* file_base,
FT_Long file_size,
FT_Long face_index,
FT_Face *aface );
/**************************************************************************
*
* @function:
* FT_Open_Face
*
* @description:
* Create a face object from a given resource described by @FT_Open_Args.
*
* @inout:
* library ::
* A handle to the library resource.
*
* @input:
* args ::
* A pointer to an `FT_Open_Args` structure that must be filled by the
* caller.
*
* 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.
*
* [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType 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-variation 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 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 non-negative 16-bit value), bits 16-30 in
* `face->style_flags` give the number of named instances in face 'N'
* if we have a 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`.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Unlike FreeType 1.x, this function automatically creates a glyph slot
* for the face object that can be accessed directly through
* `face->glyph`.
*
* Each new face object created with this function also owns a default
* @FT_Size object, accessible as `face->size`.
*
* One @FT_Library instance can have multiple face objects, this is,
* @FT_Open_Face and its siblings can be called multiple times using the
* same `library` argument.
*
* See the discussion of reference counters in the description of
* @FT_Reference_Face.
*
* @example:
* 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,
FT_Long face_index,
FT_Face *aface );
/**************************************************************************
*
* @function:
* FT_Attach_File
*
* @description:
* Call @FT_Attach_Stream to attach a file.
*
* @inout:
* face ::
* The target face object.
*
* @input:
* filepathname ::
* The pathname.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Attach_File( FT_Face face,
const char* filepathname );
/**************************************************************************
*
* @function:
* FT_Attach_Stream
*
* @description:
* 'Attach' data to a face object. Normally, this is used to read
* additional information for the face object. For example, you can
* attach an AFM file that comes with a Type~1 font to get the kerning
* values and other metrics.
*
* @inout:
* face ::
* The target face object.
*
* @input:
* parameters ::
* A pointer to @FT_Open_Args that must be filled by the caller.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The meaning of the 'attach' (i.e., what really happens when the new
* file is read) is not fixed by FreeType itself. It really depends on
* the font format (and thus the font driver).
*
* Client applications are expected to know what they are doing when
* invoking this function. Most drivers simply do not implement file or
* stream attachments.
*/
FT_EXPORT( FT_Error )
FT_Attach_Stream( FT_Face face,
FT_Open_Args* parameters );
/**************************************************************************
*
* @function:
* FT_Reference_Face
*
* @description:
* A counter gets initialized to~1 at the time an @FT_Face structure is
* created. This function increments the counter. @FT_Done_Face then
* only destroys a face if the counter is~1, otherwise it simply
* decrements the counter.
*
* This function helps in managing life-cycles of structures that
* reference @FT_Face objects.
*
* @input:
* face ::
* A handle to a target face object.
*
* @return:
* FreeType error code. 0~means success.
*
* @since:
* 2.4.2
*/
FT_EXPORT( FT_Error )
FT_Reference_Face( FT_Face face );
/**************************************************************************
*
* @function:
* FT_Done_Face
*
* @description:
* Discard a given face object, as well as all of its child slots and
* sizes.
*
* @input:
* face ::
* A handle to a target face object.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* See the discussion of reference counters in the description of
* @FT_Reference_Face.
*/
FT_EXPORT( FT_Error )
FT_Done_Face( FT_Face face );
/**************************************************************************
*
* @function:
* FT_Select_Size
*
* @description:
* Select a bitmap strike. To be more precise, this function sets the
* scaling factors of the active @FT_Size object in a face so that
* bitmaps from this particular strike are taken by @FT_Load_Glyph and
* friends.
*
* @inout:
* face ::
* A handle to a target face object.
*
* @input:
* strike_index ::
* The index of the bitmap strike in the `available_sizes` field of
* @FT_FaceRec structure.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* For bitmaps embedded in outline fonts it is common that only a subset
* of the available glyphs at a given ppem value is available. FreeType
* silently uses outlines if there is no bitmap for a given glyph index.
*
* For GX and OpenType variation fonts, a bitmap strike makes sense only
* if the default instance is active (this is, no glyph variation takes
* place); otherwise, FreeType simply ignores bitmap strikes. The same
* is true for all named instances that are different from the default
* instance.
*
* Don't use this function if you are using the FreeType cache API.
*/
FT_EXPORT( FT_Error )
FT_Select_Size( FT_Face face,
FT_Int strike_index );
/**************************************************************************
*
* @enum:
* FT_Size_Request_Type
*
* @description:
* An enumeration type that lists the supported size request types, i.e.,
* what input size (in font units) maps to the requested output size (in
* pixels, as computed from the arguments of @FT_Size_Request).
*
* @values:
* FT_SIZE_REQUEST_TYPE_NOMINAL ::
* The nominal size. The `units_per_EM` field of @FT_FaceRec is used
* to determine both scaling values.
*
* This is the standard scaling found in most applications. In
* particular, use this size request type for TrueType fonts if they
* provide optical scaling or something similar. Note, however, that
* `units_per_EM` is a rather abstract value which bears no relation to
* the actual size of the glyphs in a font.
*
* FT_SIZE_REQUEST_TYPE_REAL_DIM ::
* The real dimension. The sum of the `ascender` and (minus of) the
* `descender` fields of @FT_FaceRec is used to determine both scaling
* values.
*
* FT_SIZE_REQUEST_TYPE_BBOX ::
* The font bounding box. The width and height of the `bbox` field of
* @FT_FaceRec are used to determine the horizontal and vertical
* scaling value, respectively.
*
* FT_SIZE_REQUEST_TYPE_CELL ::
* The `max_advance_width` field of @FT_FaceRec is used to determine
* the horizontal scaling value; the vertical scaling value is
* determined the same way as @FT_SIZE_REQUEST_TYPE_REAL_DIM does.
* Finally, both scaling values are set to the smaller one. This type
* is useful if you want to specify the font size for, say, a window of
* a given dimension and 80x24 cells.
*
* FT_SIZE_REQUEST_TYPE_SCALES ::
* Specify the scaling values directly.
*
* @note:
* The above descriptions only apply to scalable formats. For bitmap
* formats, the behaviour is up to the driver.
*
* See the note section of @FT_Size_Metrics if you wonder how size
* requesting relates to scaling values.
*/
typedef enum FT_Size_Request_Type_
{
FT_SIZE_REQUEST_TYPE_NOMINAL,
FT_SIZE_REQUEST_TYPE_REAL_DIM,
FT_SIZE_REQUEST_TYPE_BBOX,
FT_SIZE_REQUEST_TYPE_CELL,
FT_SIZE_REQUEST_TYPE_SCALES,
FT_SIZE_REQUEST_TYPE_MAX
} FT_Size_Request_Type;
/**************************************************************************
*
* @struct:
* FT_Size_RequestRec
*
* @description:
* A structure to model a size request.
*
* @fields:
* type ::
* See @FT_Size_Request_Type.
*
* width ::
* The desired width, given as a 26.6 fractional point value (with 72pt
* = 1in).
*
* height ::
* The desired height, given as a 26.6 fractional point value (with
* 72pt = 1in).
*
* horiResolution ::
* The horizontal resolution (dpi, i.e., pixels per inch). If set to
* zero, `width` is treated as a 26.6 fractional **pixel** value, which
* gets internally rounded to an integer.
*
* vertResolution ::
* The vertical resolution (dpi, i.e., pixels per inch). If set to
* zero, `height` is treated as a 26.6 fractional **pixel** value,
* which gets internally rounded to an integer.
*
* @note:
* If `width` is zero, the horizontal scaling value is set equal to the
* vertical scaling value, and vice versa.
*
* If `type` is `FT_SIZE_REQUEST_TYPE_SCALES`, `width` and `height` are
* interpreted directly as 16.16 fractional scaling values, without any
* further modification, and both `horiResolution` and `vertResolution`
* are ignored.
*/
typedef struct FT_Size_RequestRec_
{
FT_Size_Request_Type type;
FT_Long width;
FT_Long height;
FT_UInt horiResolution;
FT_UInt vertResolution;
} FT_Size_RequestRec;
/**************************************************************************
*
* @struct:
* FT_Size_Request
*
* @description:
* A handle to a size request structure.
*/
typedef struct FT_Size_RequestRec_ *FT_Size_Request;
/**************************************************************************
*
* @function:
* FT_Request_Size
*
* @description:
* Resize the scale of the active @FT_Size object in a face.
*
* @inout:
* face ::
* A handle to a target face object.
*
* @input:
* req ::
* A pointer to a @FT_Size_RequestRec.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Although drivers may select the bitmap strike matching the request,
* you should not rely on this if you intend to select a particular
* bitmap strike. Use @FT_Select_Size instead in that case.
*
* The relation between the requested size and the resulting glyph size
* is dependent entirely on how the size is defined in the source face.
* The font designer chooses the final size of each glyph relative to
* this size. For more information refer to
* 'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.
*
* Contrary to @FT_Set_Char_Size, this function doesn't have special code
* to normalize zero-valued widths, heights, or resolutions (which lead
* to errors in most cases).
*
* Don't use this function if you are using the FreeType cache API.
*/
FT_EXPORT( FT_Error )
FT_Request_Size( FT_Face face,
FT_Size_Request req );
/**************************************************************************
*
* @function:
* FT_Set_Char_Size
*
* @description:
* Call @FT_Request_Size to request the nominal size (in points).
*
* @inout:
* face ::
* A handle to a target face object.
*
* @input:
* char_width ::
* The nominal width, in 26.6 fractional points.
*
* char_height ::
* The nominal height, in 26.6 fractional points.
*
* horz_resolution ::
* The horizontal resolution in dpi.
*
* vert_resolution ::
* The vertical resolution in dpi.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* While this function allows fractional points as input values, the
* resulting ppem value for the given resolution is always rounded to the
* nearest integer.
*
* If either the character width or height is zero, it is set equal to
* the other value.
*
* If either the horizontal or vertical resolution is zero, it is set
* equal to the other value.
*
* A character width or height smaller than 1pt is set to 1pt; if both
* resolution values are zero, they are set to 72dpi.
*
* Don't use this function if you are using the FreeType cache API.
*/
FT_EXPORT( FT_Error )
FT_Set_Char_Size( FT_Face face,
FT_F26Dot6 char_width,
FT_F26Dot6 char_height,
FT_UInt horz_resolution,
FT_UInt vert_resolution );
/**************************************************************************
*
* @function:
* FT_Set_Pixel_Sizes
*
* @description:
* Call @FT_Request_Size to request the nominal size (in pixels).
*
* @inout:
* face ::
* A handle to the target face object.
*
* @input:
* pixel_width ::
* The nominal width, in pixels.
*
* pixel_height ::
* The nominal height, in pixels.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* You should not rely on the resulting glyphs matching or being
* constrained to this pixel size. Refer to @FT_Request_Size to
* understand how requested sizes relate to actual sizes.
*
* Don't use this function if you are using the FreeType cache API.
*/
FT_EXPORT( FT_Error )
FT_Set_Pixel_Sizes( FT_Face face,
FT_UInt pixel_width,
FT_UInt pixel_height );
/**************************************************************************
*
* @function:
* FT_Load_Glyph
*
* @description:
* Load a glyph into the glyph slot of a face object.
*
* @inout:
* face ::
* A handle to the target face object where the glyph is loaded.
*
* @input:
* glyph_index ::
* The index of the glyph in the font file. For CID-keyed fonts
* (either in PS or in CFF format) this argument specifies the CID
* value.
*
* load_flags ::
* A flag indicating what to load for this glyph. The @FT_LOAD_XXX
* constants can be used to control the glyph loading process (e.g.,
* whether the outline should be scaled, whether to load bitmaps or
* not, whether to hint the outline, etc).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The loaded glyph may be transformed. See @FT_Set_Transform for the
* details.
*
* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument` is returned
* for invalid CID values (this is, for CID values that 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,
FT_Int32 load_flags );
/**************************************************************************
*
* @function:
* FT_Load_Char
*
* @description:
* Load a glyph into the glyph slot of a face object, accessed by its
* character code.
*
* @inout:
* face ::
* A handle to a target face object where the glyph is loaded.
*
* @input:
* char_code ::
* The glyph's character code, according to the current charmap used in
* the face.
*
* load_flags ::
* A flag indicating what to load for this glyph. The @FT_LOAD_XXX
* constants can be used to control the glyph loading process (e.g.,
* whether the outline should be scaled, whether to load bitmaps or
* not, whether to hint the outline, etc).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.
*
* Many fonts contain glyphs that can't be loaded by this function since
* its glyph indices are not listed in any of the font's charmaps.
*
* If no active cmap is set up (i.e., `face->charmap` is zero), the call
* to @FT_Get_Char_Index is omitted, and the function behaves identically
* to @FT_Load_Glyph.
*/
FT_EXPORT( FT_Error )
FT_Load_Char( FT_Face face,
FT_ULong char_code,
FT_Int32 load_flags );
/**************************************************************************
*
* @enum:
* FT_LOAD_XXX
*
* @description:
* A list of bit field constants for @FT_Load_Glyph to indicate what kind
* of operations to perform during glyph loading.
*
* @values:
* FT_LOAD_DEFAULT ::
* Corresponding to~0, this value is used as the default glyph load
* operation. In this case, the following happens:
*
* 1. FreeType looks for a bitmap for the glyph corresponding to the
* face's current size. If one is found, the function returns. The
* bitmap data can be accessed from the glyph slot (see note below).
*
* 2. If no embedded bitmap is searched for or found, FreeType looks
* for a scalable outline. If one is found, it is loaded from the font
* file, scaled to device pixels, then 'hinted' to the pixel grid in
* order to optimize it. The outline data can be accessed from the
* glyph slot (see note below).
*
* Note that by default the glyph loader doesn't render outlines into
* bitmaps. The following flags are used to modify this default
* behaviour to more specific and useful cases.
*
* FT_LOAD_NO_SCALE ::
* Don't scale the loaded outline glyph but keep it in font units.
*
* This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
* unsets @FT_LOAD_RENDER.
*
* If the font is 'tricky' (see @FT_FACE_FLAG_TRICKY for more), using
* `FT_LOAD_NO_SCALE` usually yields meaningless outlines because the
* subglyphs must be scaled and positioned with hinting instructions.
* This can be solved by loading the font without `FT_LOAD_NO_SCALE`
* and setting the character size to `font->units_per_EM`.
*
* FT_LOAD_NO_HINTING ::
* Disable hinting. This generally generates 'blurrier' bitmap glyphs
* when the glyph are rendered in any of the anti-aliased modes. See
* also the note below.
*
* This flag is implied by @FT_LOAD_NO_SCALE.
*
* FT_LOAD_RENDER ::
* Call @FT_Render_Glyph after the glyph is loaded. By default, the
* glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
* overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
*
* This flag is unset by @FT_LOAD_NO_SCALE.
*
* FT_LOAD_NO_BITMAP ::
* Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
* flag.
*
* @FT_LOAD_NO_SCALE always sets this flag.
*
* FT_LOAD_VERTICAL_LAYOUT ::
* Load the glyph for vertical text layout. In particular, the
* `advance` value in the @FT_GlyphSlotRec structure is set to the
* `vertAdvance` value of the `metrics` field.
*
* In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use this
* flag currently. Reason is that in this case vertical metrics get
* synthesized, and those values are not always consistent across
* various font formats.
*
* FT_LOAD_FORCE_AUTOHINT ::
* Prefer the auto-hinter over the font's native hinter. See also the
* note below.
*
* FT_LOAD_PEDANTIC ::
* Make the font driver perform pedantic verifications during glyph
* loading and hinting. This is mostly used to detect broken glyphs in
* fonts. By default, FreeType tries to handle broken fonts also.
*
* In particular, errors from the TrueType bytecode engine are not
* passed to the application if this flag is not set; this might result
* in partially hinted or distorted glyphs in case a glyph's bytecode
* is buggy.
*
* FT_LOAD_NO_RECURSE ::
* Don't load composite glyphs recursively. Instead, the font driver
* fills the `num_subglyph` and `subglyphs` values of the glyph slot;
* it also sets `glyph->format` to @FT_GLYPH_FORMAT_COMPOSITE. The
* description of subglyphs can then be accessed with
* @FT_Get_SubGlyph_Info.
*
* Don't use this flag for retrieving metrics information since some
* font drivers only return rudimentary data.
*
* This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
*
* FT_LOAD_IGNORE_TRANSFORM ::
* Ignore the transform matrix set by @FT_Set_Transform.
*
* FT_LOAD_MONOCHROME ::
* This flag is used with @FT_LOAD_RENDER to indicate that you want to
* render an outline glyph to a 1-bit monochrome bitmap glyph, with
* 8~pixels packed into each byte of the bitmap data.
*
* Note that this has no effect on the hinting algorithm used. You
* should rather use @FT_LOAD_TARGET_MONO so that the
* monochrome-optimized hinting algorithm is used.
*
* FT_LOAD_LINEAR_DESIGN ::
* Keep `linearHoriAdvance` and `linearVertAdvance` fields of
* @FT_GlyphSlotRec in font units. See @FT_GlyphSlotRec for details.
*
* FT_LOAD_NO_AUTOHINT ::
* Disable the auto-hinter. See also the note below.
*
* FT_LOAD_COLOR ::
* Load colored glyphs. There are slight differences depending on the
* font format.
*
* [Since 2.5] Load embedded color bitmap images. The resulting color
* bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format,
* with pre-multiplied color channels. If the flag is not set and
* color bitmaps are found, they are converted to 256-level gray
* bitmaps, using the @FT_PIXEL_MODE_GRAY format.
*
* [Since 2.10, experimental] If the glyph index contains an entry in
* the face's 'COLR' table with a 'CPAL' palette table (as defined in
* the OpenType specification), make @FT_Render_Glyph provide a default
* blending of the color glyph layers associated with the glyph index,
* using the same bitmap format as embedded color bitmap images. This
* is mainly for convenience; for full control of color layers use
* @FT_Get_Color_Glyph_Layer and FreeType's color functions like
* @FT_Palette_Select instead of setting @FT_LOAD_COLOR for rendering
* so that the client application can handle blending by itself.
*
* FT_LOAD_COMPUTE_METRICS ::
* [Since 2.6.1] Compute glyph metrics from the glyph data, without the
* use of bundled metrics tables (for example, the 'hdmx' table in
* TrueType fonts). 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_BITMAP_METRICS_ONLY ::
* [Since 2.7.1] Request loading of the metrics and bitmap image
* information of a (possibly embedded) bitmap glyph without allocating
* or copying the bitmap image data itself. No effect if the target
* glyph is not a bitmap image.
*
* This flag unsets @FT_LOAD_RENDER.
*
* FT_LOAD_CROP_BITMAP ::
* Ignored. Deprecated.
*
* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
* Ignored. Deprecated.
*
* @note:
* By default, hinting is enabled and the font's native hinter (see
* @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
* disable hinting by setting @FT_LOAD_NO_HINTING or change the
* precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
* @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be used
* at all.
*
* See the description of @FT_FACE_FLAG_TRICKY for a special exception
* (affecting only a handful of Asian fonts).
*
* Besides deciding which hinter to use, you can also decide which
* hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
*
* Note that the auto-hinter needs a valid Unicode cmap (either a native
* one or synthesized by FreeType) for producing correct results. If a
* font provides an incorrect mapping (for example, assigning the
* character code U+005A, LATIN CAPITAL LETTER~Z, to a glyph depicting a
* mathematical integral sign), the auto-hinter might produce useless
* results.
*
*/
#define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE ( 1L << 0 )
#define FT_LOAD_NO_HINTING ( 1L << 1 )
#define FT_LOAD_RENDER ( 1L << 2 )
#define FT_LOAD_NO_BITMAP ( 1L << 3 )
#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
#define FT_LOAD_CROP_BITMAP ( 1L << 6 )
#define FT_LOAD_PEDANTIC ( 1L << 7 )
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
#define FT_LOAD_NO_RECURSE ( 1L << 10 )
#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
#define FT_LOAD_MONOCHROME ( 1L << 12 )
#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
#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 )
#define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 )
/* */
/* used internally only by certain font drivers */
#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
#define FT_LOAD_SBITS_ONLY ( 1L << 14 )
/**************************************************************************
*
* @enum:
* FT_LOAD_TARGET_XXX
*
* @description:
* A list of values to select a specific hinting algorithm for the
* hinter. You should OR one of these values to your `load_flags` when
* calling @FT_Load_Glyph.
*
* Note that a font's native hinters may ignore the hinting algorithm you
* have specified (e.g., the TrueType bytecode interpreter). You can set
* @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
*
* @values:
* FT_LOAD_TARGET_NORMAL ::
* The default hinting algorithm, optimized for standard gray-level
* rendering. For monochrome output, use @FT_LOAD_TARGET_MONO instead.
*
* FT_LOAD_TARGET_LIGHT ::
* 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 FreeType's new CFF engine or Microsoft's
* ClearType 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.
*
* Advance widths are rounded to integer values; however, using the
* `lsb_delta` and `rsb_delta` fields of @FT_GlyphSlotRec, it is
* possible to get fractional advance widths for subpixel positioning
* (which is recommended to use).
*
* If configuration option `AF_CONFIG_OPTION_TT_SIZE_METRICS` is
* active, TrueType-like metrics are used to make this mode behave
* similarly as in unpatched FreeType versions between 2.4.6 and 2.7.1
* (inclusive).
*
* FT_LOAD_TARGET_MONO ::
* Strong hinting algorithm that should only be used for monochrome
* output. The result is probably unpleasant if the glyph is rendered
* in non-monochrome modes.
*
* Note that for outline fonts only the TrueType font driver has proper
* monochrome hinting support, provided the TTFs contain hints for B/W
* rendering (which most fonts no longer provide). If these conditions
* are not met it is very likely that you get ugly results at smaller
* sizes.
*
* FT_LOAD_TARGET_LCD ::
* A variant of @FT_LOAD_TARGET_LIGHT optimized for horizontally
* decimated LCD displays.
*
* FT_LOAD_TARGET_LCD_V ::
* A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
* decimated LCD displays.
*
* @note:
* You should use only _one_ of the `FT_LOAD_TARGET_XXX` values in your
* `load_flags`. They can't be ORed.
*
* 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 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
* rendering mode. As an example, it is possible to use the 'light'
* hinting algorithm and have the results rendered in horizontal LCD
* pixel mode, with code like
*
* ```
* FT_Load_Glyph( face, glyph_index,
* load_flags | FT_LOAD_TARGET_LIGHT );
*
* FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
* ```
*
* In general, you should stick with one rendering mode. For example,
* switching between @FT_LOAD_TARGET_NORMAL and @FT_LOAD_TARGET_MONO
* enforces a lot of recomputation for TrueType fonts, which is slow.
* Another reason is caching: Selecting a different mode usually causes
* changes in both the outlines and the rasterized bitmaps; it is thus
* necessary to empty the cache after a mode switch to avoid false hits.
*
*/
#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
/**************************************************************************
*
* @macro:
* FT_LOAD_TARGET_MODE
*
* @description:
* Return the @FT_Render_Mode corresponding to a given
* @FT_LOAD_TARGET_XXX value.
*
*/
#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
/**************************************************************************
*
* @function:
* FT_Set_Transform
*
* @description:
* Set the transformation that is applied to glyph images when they are
* loaded into a glyph slot through @FT_Load_Glyph.
*
* @inout:
* face ::
* A handle to the source face object.
*
* @input:
* matrix ::
* A pointer to the transformation's 2x2 matrix. Use `NULL` for the
* identity matrix.
* delta ::
* A pointer to the translation vector. Use `NULL` for the null vector.
*
* @note:
* The transformation is only applied to scalable image formats after the
* glyph has been loaded. It means that hinting is unaltered by the
* transformation and is performed on the character size given in the
* last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes.
*
* Note that this also transforms the `face.glyph.advance` field, but
* **not** the values in `face.glyph.metrics`.
*/
FT_EXPORT( void )
FT_Set_Transform( FT_Face face,
FT_Matrix* matrix,
FT_Vector* delta );
/**************************************************************************
*
* @enum:
* FT_Render_Mode
*
* @description:
* Render modes supported by FreeType~2. Each mode corresponds to a
* specific type of scanline conversion performed on the outline.
*
* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode` 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,
* 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 ::
* Default render mode; it corresponds to 8-bit anti-aliased bitmaps.
*
* FT_RENDER_MODE_LIGHT ::
* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only defined as
* a separate value because render modes are also used indirectly to
* define hinting algorithm selectors. See @FT_LOAD_TARGET_XXX for
* details.
*
* FT_RENDER_MODE_MONO ::
* This mode corresponds to 1-bit bitmaps (with 2~levels of opacity).
*
* FT_RENDER_MODE_LCD ::
* This mode corresponds to horizontal RGB and BGR subpixel displays
* like LCD screens. It produces 8-bit bitmaps that are 3~times the
* width of the original glyph outline in pixels, and which use the
* @FT_PIXEL_MODE_LCD mode.
*
* FT_RENDER_MODE_LCD_V ::
* This mode corresponds to vertical RGB and BGR subpixel displays
* (like PDA screens, rotated LCD displays, etc.). It produces 8-bit
* bitmaps that are 3~times the height of the original glyph outline in
* pixels and use the @FT_PIXEL_MODE_LCD_V mode.
*
* @note:
* Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your
* `ftoption.h`, which enables patented ClearType-style rendering, the
* LCD-optimized glyph bitmaps should be filtered to reduce color fringes
* inherent to this technology. You can either set up LCD filtering with
* @FT_Library_SetLcdFilter or @FT_Face_Properties, or do the filtering
* yourself. The default FreeType LCD rendering technology does not
* require filtering.
*
* The selected render mode only affects vector glyphs of a font.
* Embedded bitmaps often have a different pixel mode like
* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform them
* into 8-bit pixmaps.
*/
typedef enum FT_Render_Mode_
{
FT_RENDER_MODE_NORMAL = 0,
FT_RENDER_MODE_LIGHT,
FT_RENDER_MODE_MONO,
FT_RENDER_MODE_LCD,
FT_RENDER_MODE_LCD_V,
FT_RENDER_MODE_MAX
} FT_Render_Mode;
/* these constants are deprecated; use the corresponding */
/* `FT_Render_Mode` values instead */
#define ft_render_mode_normal FT_RENDER_MODE_NORMAL
#define ft_render_mode_mono FT_RENDER_MODE_MONO
/**************************************************************************
*
* @function:
* FT_Render_Glyph
*
* @description:
* Convert a given glyph image to a bitmap. It does so by inspecting the
* glyph image format, finding the relevant renderer, and invoking it.
*
* @inout:
* slot ::
* A handle to the glyph slot containing the image to convert.
*
* @input:
* render_mode ::
* The render mode used to render the glyph image into a bitmap. See
* @FT_Render_Mode for a list of possible values.
*
* If @FT_RENDER_MODE_NORMAL is used, a previous call of @FT_Load_Glyph
* with flag @FT_LOAD_COLOR makes FT_Render_Glyph provide a default
* blending of colored glyph layers associated with the current glyph
* slot (provided the font contains such layers) instead of rendering
* the glyph slot's outline. This is an experimental feature; see
* @FT_LOAD_COLOR for more information.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* 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_rendering. 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 );
/**************************************************************************
*
* @enum:
* FT_Kerning_Mode
*
* @description:
* An enumeration to specify the format of kerning values returned by
* @FT_Get_Kerning.
*
* @values:
* FT_KERNING_DEFAULT ::
* Return grid-fitted kerning distances in 26.6 fractional pixels.
*
* FT_KERNING_UNFITTED ::
* Return un-grid-fitted kerning distances in 26.6 fractional pixels.
*
* 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.
*
* Both `FT_KERNING_DEFAULT` and `FT_KERNING_UNFITTED` use the current
* horizontal scaling factor (as set e.g. with @FT_Set_Char_Size) to
* convert font units to pixels.
*/
typedef enum FT_Kerning_Mode_
{
FT_KERNING_DEFAULT = 0,
FT_KERNING_UNFITTED,
FT_KERNING_UNSCALED
} FT_Kerning_Mode;
/* these constants are deprecated; use the corresponding */
/* `FT_Kerning_Mode` values instead */
#define ft_kerning_default FT_KERNING_DEFAULT
#define ft_kerning_unfitted FT_KERNING_UNFITTED
#define ft_kerning_unscaled FT_KERNING_UNSCALED
/**************************************************************************
*
* @function:
* FT_Get_Kerning
*
* @description:
* Return the kerning vector between two glyphs of the same face.
*
* @input:
* face ::
* A handle to a source face object.
*
* left_glyph ::
* The index of the left glyph in the kern pair.
*
* right_glyph ::
* The index of the right glyph in the kern pair.
*
* kern_mode ::
* See @FT_Kerning_Mode for more information. Determines the scale and
* dimension of the returned kerning vector.
*
* @output:
* 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.
*
* @note:
* Only horizontal layouts (left-to-right & right-to-left) are supported
* by this method. Other layouts, or more sophisticated kernings, are
* out of the scope of this API function -- they can be implemented
* through format-specific interfaces.
*
* Kerning for OpenType fonts implemented in a 'GPOS' table is not
* supported; use @FT_HAS_KERNING to find out whether a font has data
* that can be extracted with `FT_Get_Kerning`.
*/
FT_EXPORT( FT_Error )
FT_Get_Kerning( FT_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_UInt kern_mode,
FT_Vector *akerning );
/**************************************************************************
*
* @function:
* FT_Get_Track_Kerning
*
* @description:
* Return the track kerning for a given face object at a given size.
*
* @input:
* face ::
* A handle to a source face object.
*
* point_size ::
* The point size in 16.16 fractional points.
*
* degree ::
* The degree of tightness. Increasingly negative values represent
* tighter track kerning, while increasingly positive values represent
* looser track kerning. Value zero means no track kerning.
*
* @output:
* akerning ::
* The kerning in 16.16 fractional points, to be uniformly applied
* between all glyphs.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Currently, only the Type~1 font driver supports track kerning, using
* data from AFM files (if attached with @FT_Attach_File or
* @FT_Attach_Stream).
*
* Only very few AFM files come with track kerning data; please refer to
* Adobe's AFM specification for more details.
*/
FT_EXPORT( FT_Error )
FT_Get_Track_Kerning( FT_Face face,
FT_Fixed point_size,
FT_Int degree,
FT_Fixed* akerning );
/**************************************************************************
*
* @function:
* FT_Get_Glyph_Name
*
* @description:
* Retrieve the ASCII name of a given glyph in a face. This only works
* for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1.
*
* @input:
* face ::
* A handle to a source face object.
*
* glyph_index ::
* The glyph index.
*
* buffer_max ::
* The maximum number of bytes available in the buffer.
*
* @output:
* buffer ::
* A pointer to a target buffer where the name is copied to.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* An error is returned if the face doesn't provide glyph names or if the
* glyph index is invalid. In all cases of failure, the first byte of
* `buffer` is set to~0 to indicate an empty name.
*
* The glyph name is truncated to fit within the buffer if it is too
* long. The returned string is always zero-terminated.
*
* Be aware that FreeType reorders glyph indices internally so that glyph
* index~0 always corresponds to the 'missing glyph' (called '.notdef').
*
* This function always returns an error if the config macro
* `FT_CONFIG_OPTION_NO_GLYPH_NAMES` is not defined in `ftoption.h`.
*/
FT_EXPORT( FT_Error )
FT_Get_Glyph_Name( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max );
/**************************************************************************
*
* @function:
* FT_Get_Postscript_Name
*
* @description:
* Retrieve the ASCII PostScript name of a given face, if available.
* This only works with PostScript, TrueType, and OpenType fonts.
*
* @input:
* face ::
* A handle to the source face object.
*
* @return:
* A pointer to the face's PostScript name. `NULL` if unavailable.
*
* @note:
* The returned pointer is owned by the face and is destroyed with it.
*
* For variation fonts, this string changes if you select a different
* instance, and you have to call `FT_Get_PostScript_Name` again to
* retrieve it. FreeType follows Adobe TechNote #5902, 'Generating
* PostScript Names for Fonts Using OpenType Font Variations'.
*
* https://download.macromedia.com/pub/developer/opentype/tech-notes/5902.AdobePSNameGeneration.html
*
* [Since 2.9] Special PostScript names for named instances are only
* returned if the named instance is set with @FT_Set_Named_Instance (and
* the font has corresponding entries in its 'fvar' table). If
* @FT_IS_VARIATION returns true, the algorithmically derived PostScript
* name is provided, not looking up special entries for named instances.
*/
FT_EXPORT( const char* )
FT_Get_Postscript_Name( FT_Face face );
/**************************************************************************
*
* @function:
* FT_Select_Charmap
*
* @description:
* Select a given charmap by its encoding tag (as listed in
* `freetype.h`).
*
* @inout:
* face ::
* A handle to the source face object.
*
* @input:
* encoding ::
* A handle to the selected encoding.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function returns an error if no charmap in the face corresponds
* to the encoding queried here.
*
* Because many fonts contain more than a single cmap for Unicode
* encoding, this function has some special code to select the one that
* covers Unicode best ('best' in the sense that a UCS-4 cmap is
* preferred to a UCS-2 cmap). It is thus preferable to @FT_Set_Charmap
* in this case.
*/
FT_EXPORT( FT_Error )
FT_Select_Charmap( FT_Face face,
FT_Encoding encoding );
/**************************************************************************
*
* @function:
* FT_Set_Charmap
*
* @description:
* Select a given charmap for character code to glyph index mapping.
*
* @inout:
* face ::
* A handle to the source face object.
*
* @input:
* charmap ::
* A handle to the selected charmap.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function returns an error if the charmap is not part of the face
* (i.e., if it is not listed in the `face->charmaps` table).
*
* It also fails if an OpenType type~14 charmap is selected (which
* doesn't map character codes to glyph indices at all).
*/
FT_EXPORT( FT_Error )
FT_Set_Charmap( FT_Face face,
FT_CharMap charmap );
/**************************************************************************
*
* @function:
* FT_Get_Charmap_Index
*
* @description:
* Retrieve index of a given charmap.
*
* @input:
* charmap ::
* A handle to a charmap.
*
* @return:
* The index into the array of character maps within the face to which
* `charmap` belongs. If an error occurs, -1 is returned.
*
*/
FT_EXPORT( FT_Int )
FT_Get_Charmap_Index( FT_CharMap charmap );
/**************************************************************************
*
* @function:
* FT_Get_Char_Index
*
* @description:
* Return the glyph index of a given character code. This function uses
* the currently selected charmap to do the mapping.
*
* @input:
* face ::
* A handle to the source face object.
*
* charcode ::
* The character code.
*
* @return:
* The glyph index. 0~means 'undefined character code'.
*
* @note:
* If you use FreeType to manipulate the contents of font files directly,
* be aware that the glyph index returned by this function doesn't always
* correspond to the internal indices used within the file. This is done
* to ensure that value~0 always corresponds to the 'missing glyph'. If
* the first glyph is not named '.notdef', then for Type~1 and Type~42
* fonts, '.notdef' will be moved into the glyph ID~0 position, and
* whatever was there will be moved to the position '.notdef' had. For
* Type~1 fonts, if there is no '.notdef' glyph at all, then one will be
* created at index~0 and whatever was there will be moved to the last
* index -- Type~42 fonts are considered invalid under this condition.
*/
FT_EXPORT( FT_UInt )
FT_Get_Char_Index( FT_Face face,
FT_ULong charcode );
/**************************************************************************
*
* @function:
* FT_Get_First_Char
*
* @description:
* Return the first character code in the current charmap of a given
* face, together with its corresponding glyph index.
*
* @input:
* face ::
* A handle to the source face object.
*
* @output:
* agindex ::
* Glyph index of first character code. 0~if charmap is empty.
*
* @return:
* The charmap's first character code.
*
* @note:
* You should use this function together with @FT_Get_Next_Char to parse
* all character codes available in a given charmap. The code should
* look like this:
*
* ```
* FT_ULong charcode;
* FT_UInt gindex;
*
*
* charcode = FT_Get_First_Char( face, &gindex );
* while ( gindex != 0 )
* {
* ... do something with (charcode,gindex) pair ...
*
* charcode = FT_Get_Next_Char( face, charcode, &gindex );
* }
* ```
*
* 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.
*/
FT_EXPORT( FT_ULong )
FT_Get_First_Char( FT_Face face,
FT_UInt *agindex );
/**************************************************************************
*
* @function:
* FT_Get_Next_Char
*
* @description:
* Return the next character code in the current charmap of a given face
* following the value `char_code`, as well as the corresponding glyph
* index.
*
* @input:
* face ::
* A handle to the source face object.
*
* char_code ::
* The starting character code.
*
* @output:
* agindex ::
* Glyph index of next character code. 0~if charmap is empty.
*
* @return:
* The charmap's next character code.
*
* @note:
* You should use this function with @FT_Get_First_Char to walk over all
* character codes available in a given charmap. See the note for that
* function for a simple code example.
*
* Note that `*agindex` is set to~0 when there are no more codes in the
* charmap.
*/
FT_EXPORT( FT_ULong )
FT_Get_Next_Char( FT_Face face,
FT_ULong char_code,
FT_UInt *agindex );
/**************************************************************************
*
* @function:
* FT_Face_Properties
*
* @description:
* Set or override certain (library or module-wide) properties on a
* face-by-face basis. Useful for finer-grained control and avoiding
* locks on shared structures (threads can modify their own faces as they
* see fit).
*
* Contrary to @FT_Property_Set, this function uses @FT_Parameter so that
* you can pass multiple properties to the target face in one call. Note
* that only a subset of the available properties can be controlled.
*
* * @FT_PARAM_TAG_STEM_DARKENING (stem darkening, corresponding to the
* property `no-stem-darkening` provided by the 'autofit', 'cff',
* 'type1', and 't1cid' modules; see @no-stem-darkening).
*
* * @FT_PARAM_TAG_LCD_FILTER_WEIGHTS (LCD filter weights, corresponding
* to function @FT_Library_SetLcdFilterWeights).
*
* * @FT_PARAM_TAG_RANDOM_SEED (seed value for the CFF, Type~1, and CID
* 'random' operator, corresponding to the `random-seed` property
* provided by the 'cff', 'type1', and 't1cid' modules; see
* @random-seed).
*
* Pass `NULL` as `data` in @FT_Parameter for a given tag to reset the
* option and use the library or module default again.
*
* @input:
* face ::
* A handle to the source face object.
*
* num_properties ::
* The number of properties that follow.
*
* properties ::
* A handle to an @FT_Parameter array with `num_properties` elements.
*
* @return:
* FreeType error code. 0~means success.
*
* @example:
* Here is an example that sets three properties. You must define
* `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` to make the LCD filter examples
* work.
*
* ```
* FT_Parameter property1;
* FT_Bool darken_stems = 1;
*
* FT_Parameter property2;
* FT_LcdFiveTapFilter custom_weight =
* { 0x11, 0x44, 0x56, 0x44, 0x11 };
*
* FT_Parameter property3;
* FT_Int32 random_seed = 314159265;
*
* FT_Parameter properties[3] = { property1,
* property2,
* property3 };
*
*
* property1.tag = FT_PARAM_TAG_STEM_DARKENING;
* property1.data = &darken_stems;
*
* property2.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
* property2.data = custom_weight;
*
* property3.tag = FT_PARAM_TAG_RANDOM_SEED;
* property3.data = &random_seed;
*
* FT_Face_Properties( face, 3, properties );
* ```
*
* The next example resets a single property to its default value.
*
* ```
* FT_Parameter property;
*
*
* property.tag = FT_PARAM_TAG_LCD_FILTER_WEIGHTS;
* property.data = NULL;
*
* FT_Face_Properties( face, 1, &property );
* ```
*
* @since:
* 2.8
*
*/
FT_EXPORT( FT_Error )
FT_Face_Properties( FT_Face face,
FT_UInt num_properties,
FT_Parameter* properties );
/**************************************************************************
*
* @function:
* FT_Get_Name_Index
*
* @description:
* Return the glyph index of a given glyph name.
*
* @input:
* face ::
* A handle to the source face object.
*
* glyph_name ::
* The glyph name.
*
* @return:
* The glyph index. 0~means 'undefined character code'.
*/
FT_EXPORT( FT_UInt )
FT_Get_Name_Index( FT_Face face,
const FT_String* glyph_name );
/**************************************************************************
*
* @enum:
* FT_SUBGLYPH_FLAG_XXX
*
* @description:
* A list of constants describing subglyphs. Please refer to the 'glyf'
* table description in the OpenType specification for the meaning of the
* various flags (which get synthesized for non-OpenType subglyphs).
*
* https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#composite-glyph-description
*
* @values:
* FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
* FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
* FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
* FT_SUBGLYPH_FLAG_SCALE ::
* FT_SUBGLYPH_FLAG_XY_SCALE ::
* FT_SUBGLYPH_FLAG_2X2 ::
* FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
*
*/
#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
#define FT_SUBGLYPH_FLAG_SCALE 8
#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
#define FT_SUBGLYPH_FLAG_2X2 0x80
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
/**************************************************************************
*
* @function:
* FT_Get_SubGlyph_Info
*
* @description:
* Retrieve a description of a given subglyph. Only use it if
* `glyph->format` is @FT_GLYPH_FORMAT_COMPOSITE; an error is returned
* otherwise.
*
* @input:
* glyph ::
* The source glyph slot.
*
* sub_index ::
* The index of the subglyph. Must be less than
* `glyph->num_subglyphs`.
*
* @output:
* p_index ::
* The glyph index of the subglyph.
*
* p_flags ::
* The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
*
* p_arg1 ::
* The subglyph's first argument (if any).
*
* p_arg2 ::
* The subglyph's second argument (if any).
*
* p_transform ::
* The subglyph transformation (if any).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The values of `*p_arg1`, `*p_arg2`, and `*p_transform` must be
* interpreted depending on the flags returned in `*p_flags`. See the
* OpenType specification for details.
*
* https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#composite-glyph-description
*
*/
FT_EXPORT( FT_Error )
FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
FT_UInt sub_index,
FT_Int *p_index,
FT_UInt *p_flags,
FT_Int *p_arg1,
FT_Int *p_arg2,
FT_Matrix *p_transform );
/**************************************************************************
*
* @section:
* layer_management
*
* @title:
* Glyph Layer Management
*
* @abstract:
* Retrieving and manipulating OpenType's 'COLR' table data.
*
* @description:
* The functions described here allow access of colored glyph layer data
* in OpenType's 'COLR' tables.
*/
/**************************************************************************
*
* @struct:
* FT_LayerIterator
*
* @description:
* This iterator object is needed for @FT_Get_Color_Glyph_Layer.
*
* @fields:
* num_layers ::
* The number of glyph layers for the requested glyph index. Will be
* set by @FT_Get_Color_Glyph_Layer.
*
* layer ::
* The current layer. Will be set by @FT_Get_Color_Glyph_Layer.
*
* p ::
* An opaque pointer into 'COLR' table data. The caller must set this
* to `NULL` before the first call of @FT_Get_Color_Glyph_Layer.
*/
typedef struct FT_LayerIterator_
{
FT_UInt num_layers;
FT_UInt layer;
FT_Byte* p;
} FT_LayerIterator;
/**************************************************************************
*
* @function:
* FT_Get_Color_Glyph_Layer
*
* @description:
* This is an interface to the 'COLR' table in OpenType fonts to
* iteratively retrieve the colored glyph layers associated with the
* current glyph slot.
*
* https://docs.microsoft.com/en-us/typography/opentype/spec/colr
*
* The glyph layer data for a given glyph index, if present, provides an
* alternative, multi-colour glyph representation: Instead of rendering
* the outline or bitmap with the given glyph index, glyphs with the
* indices and colors returned by this function are rendered layer by
* layer.
*
* The returned elements are ordered in the z~direction from bottom to
* top; the 'n'th element should be rendered with the associated palette
* color and blended on top of the already rendered layers (elements 0,
* 1, ..., n-1).
*
* @input:
* face ::
* A handle to the parent face object.
*
* base_glyph ::
* The glyph index the colored glyph layers are associated with.
*
* @inout:
* iterator ::
* An @FT_LayerIterator object. For the first call you should set
* `iterator->p` to `NULL`. For all following calls, simply use the
* same object again.
*
* @output:
* aglyph_index ::
* The glyph index of the current layer.
*
* acolor_index ::
* The color index into the font face's color palette of the current
* layer. The value 0xFFFF is special; it doesn't reference a palette
* entry but indicates that the text foreground color should be used
* instead (to be set up by the application outside of FreeType).
*
* The color palette can be retrieved with @FT_Palette_Select.
*
* @return:
* Value~1 if everything is OK. If there are no more layers (or if there
* are no layers at all), value~0 gets returned. In case of an error,
* value~0 is returned also.
*
* @note:
* This function is necessary if you want to handle glyph layers by
* yourself. In particular, functions that operate with @FT_GlyphRec
* objects (like @FT_Get_Glyph or @FT_Glyph_To_Bitmap) don't have access
* to this information.
*
* Note that @FT_Render_Glyph is able to handle colored glyph layers
* automatically if the @FT_LOAD_COLOR flag is passed to a previous call
* to @FT_Load_Glyph. [This is an experimental feature.]
*
* @example:
* ```
* FT_Color* palette;
* FT_LayerIterator iterator;
*
* FT_Bool have_layers;
* FT_UInt layer_glyph_index;
* FT_UInt layer_color_index;
*
*
* error = FT_Palette_Select( face, palette_index, &palette );
* if ( error )
* palette = NULL;
*
* iterator.p = NULL;
* have_layers = FT_Get_Color_Glyph_Layer( face,
* glyph_index,
* &layer_glyph_index,
* &layer_color_index,
* &iterator );
*
* if ( palette && have_layers )
* {
* do
* {
* FT_Color layer_color;
*
*
* if ( layer_color_index == 0xFFFF )
* layer_color = text_foreground_color;
* else
* layer_color = palette[layer_color_index];
*
* // Load and render glyph `layer_glyph_index', then
* // blend resulting pixmap (using color `layer_color')
* // with previously created pixmaps.
*
* } while ( FT_Get_Color_Glyph_Layer( face,
* glyph_index,
* &layer_glyph_index,
* &layer_color_index,
* &iterator ) );
* }
* ```
*/
FT_EXPORT( FT_Bool )
FT_Get_Color_Glyph_Layer( FT_Face face,
FT_UInt base_glyph,
FT_UInt *aglyph_index,
FT_UInt *acolor_index,
FT_LayerIterator* iterator );
/**************************************************************************
*
* @section:
* base_interface
*
*/
/**************************************************************************
*
* @enum:
* FT_FSTYPE_XXX
*
* @description:
* A list of bit flags used in the `fsType` field of the OS/2 table in a
* TrueType or OpenType font and the `FSType` entry in a PostScript font.
* These bit flags are returned by @FT_Get_FSType_Flags; they inform
* client applications of embedding and subsetting restrictions
* associated with a font.
*
* See
* https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/FontPolicies.pdf
* for more details.
*
* @values:
* FT_FSTYPE_INSTALLABLE_EMBEDDING ::
* Fonts with no fsType bit set may be embedded and permanently
* installed on the remote system by an application.
*
* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING ::
* Fonts that have only this bit set must not be modified, embedded or
* exchanged in any manner without first obtaining permission of the
* font software copyright owner.
*
* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING ::
* The font may be embedded and temporarily loaded on the remote
* system. Documents containing Preview & Print fonts must be opened
* 'read-only'; no edits can be applied to the document.
*
* FT_FSTYPE_EDITABLE_EMBEDDING ::
* The font may be embedded but must only be installed temporarily on
* other systems. In contrast to Preview & Print fonts, documents
* containing editable fonts may be opened for reading, editing is
* permitted, and changes may be saved.
*
* FT_FSTYPE_NO_SUBSETTING ::
* The font may not be subsetted prior to embedding.
*
* FT_FSTYPE_BITMAP_EMBEDDING_ONLY ::
* Only bitmaps contained in the font may be embedded; no outline data
* may be embedded. If there are no 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.
*/
#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
#define FT_FSTYPE_NO_SUBSETTING 0x0100
#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
/**************************************************************************
*
* @function:
* FT_Get_FSType_Flags
*
* @description:
* Return the `fsType` flags for a font.
*
* @input:
* face ::
* A handle to the source face object.
*
* @return:
* The `fsType` flags, see @FT_FSTYPE_XXX.
*
* @note:
* Use this function rather than directly reading the `fs_type` field in
* the @PS_FontInfoRec structure, which is only guaranteed to return the
* correct results for Type~1 fonts.
*
* @since:
* 2.3.8
*/
FT_EXPORT( FT_UShort )
FT_Get_FSType_Flags( FT_Face face );
/**************************************************************************
*
* @section:
* glyph_variants
*
* @title:
* Unicode Variation Sequences
*
* @abstract:
* The FreeType~2 interface to Unicode Variation Sequences (UVS), using
* the SFNT cmap format~14.
*
* @description:
* Many characters, especially for CJK scripts, have variant forms. They
* are a sort of grey area somewhere between being totally irrelevant and
* semantically distinct; for this reason, the Unicode consortium decided
* to introduce Variation Sequences (VS), consisting of a Unicode base
* character and a variation selector instead of further extending the
* already huge number of characters.
*
* Unicode maintains two different sets, namely 'Standardized Variation
* Sequences' and registered 'Ideographic Variation Sequences' (IVS),
* collected in the 'Ideographic Variation Database' (IVD).
*
* https://unicode.org/Public/UCD/latest/ucd/StandardizedVariants.txt
* https://unicode.org/reports/tr37/ https://unicode.org/ivd/
*
* To date (January 2017), the character with the most ideographic
* variations is U+9089, having 32 such IVS.
*
* Three Mongolian Variation Selectors have the values U+180B-U+180D; 256
* generic Variation Selectors are encoded in the ranges U+FE00-U+FE0F
* and U+E0100-U+E01EF. IVS currently use Variation Selectors from the
* range U+E0100-U+E01EF only.
*
* A VS consists of the base character value followed by a single
* Variation Selector. For example, to get the first variation of
* U+9089, you have to write the character sequence `U+9089 U+E0100`.
*
* Adobe and MS decided to support both standardized and ideographic VS
* with a new cmap subtable (format~14). It is an odd subtable because
* it is not a mapping of input code points to glyphs, but contains lists
* of all variations supported by the font.
*
* A variation may be either 'default' or 'non-default' for a given font.
* A default variation is the one you will get for that code point if you
* look it up in the standard Unicode cmap. A non-default variation is a
* different glyph.
*
*/
/**************************************************************************
*
* @function:
* FT_Face_GetCharVariantIndex
*
* @description:
* Return the glyph index of a given character code as modified by the
* variation selector.
*
* @input:
* face ::
* A handle to the source face object.
*
* charcode ::
* The character code point in Unicode.
*
* variantSelector ::
* The Unicode code point of the variation selector.
*
* @return:
* The glyph index. 0~means either 'undefined character code', or
* 'undefined selector code', or 'no variation selector cmap subtable',
* or 'current CharMap is not Unicode'.
*
* @note:
* If you use FreeType to manipulate the contents of font files directly,
* be aware that the glyph index returned by this function doesn't always
* correspond to the internal indices used within the file. This is done
* to ensure that value~0 always corresponds to the 'missing glyph'.
*
* This function is only meaningful if
* a) the font has a variation selector cmap sub table, and
* b) the current charmap has a Unicode encoding.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_UInt )
FT_Face_GetCharVariantIndex( FT_Face face,
FT_ULong charcode,
FT_ULong variantSelector );
/**************************************************************************
*
* @function:
* FT_Face_GetCharVariantIsDefault
*
* @description:
* Check whether this variation of this Unicode character is the one to
* be found in the charmap.
*
* @input:
* face ::
* A handle to the source face object.
*
* charcode ::
* The character codepoint in Unicode.
*
* variantSelector ::
* The Unicode codepoint of the variation selector.
*
* @return:
* 1~if found in the standard (Unicode) cmap, 0~if found in the variation
* selector cmap, or -1 if it is not a variation.
*
* @note:
* This function is only meaningful if the font has a variation selector
* cmap subtable.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_Int )
FT_Face_GetCharVariantIsDefault( FT_Face face,
FT_ULong charcode,
FT_ULong variantSelector );
/**************************************************************************
*
* @function:
* FT_Face_GetVariantSelectors
*
* @description:
* Return a zero-terminated list of Unicode variation selectors found in
* the font.
*
* @input:
* face ::
* A handle to the source face object.
*
* @return:
* A pointer to an array of selector code points, or `NULL` if there is
* no valid variation selector cmap subtable.
*
* @note:
* The last item in the array is~0; the array is owned by the @FT_Face
* object but can be overwritten or released on the next call to a
* FreeType function.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_UInt32* )
FT_Face_GetVariantSelectors( FT_Face face );
/**************************************************************************
*
* @function:
* FT_Face_GetVariantsOfChar
*
* @description:
* Return a zero-terminated list of Unicode variation selectors found for
* the specified character code.
*
* @input:
* face ::
* A handle to the source face object.
*
* charcode ::
* The character codepoint in Unicode.
*
* @return:
* A pointer to an array of variation selector code points that are
* active for the given character, or `NULL` if the corresponding list is
* empty.
*
* @note:
* The last item in the array is~0; the array is owned by the @FT_Face
* object but can be overwritten or released on the next call to a
* FreeType function.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_UInt32* )
FT_Face_GetVariantsOfChar( FT_Face face,
FT_ULong charcode );
/**************************************************************************
*
* @function:
* FT_Face_GetCharsOfVariant
*
* @description:
* Return a zero-terminated list of Unicode character codes found for the
* specified variation selector.
*
* @input:
* face ::
* A handle to the source face object.
*
* variantSelector ::
* The variation selector code point in Unicode.
*
* @return:
* A list of all the code points that are specified by this selector
* (both default and non-default codes are returned) or `NULL` if there
* is no valid cmap or the variation selector is invalid.
*
* @note:
* The last item in the array is~0; the array is owned by the @FT_Face
* object but can be overwritten or released on the next call to a
* FreeType function.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_UInt32* )
FT_Face_GetCharsOfVariant( FT_Face face,
FT_ULong variantSelector );
/**************************************************************************
*
* @section:
* computations
*
* @title:
* Computations
*
* @abstract:
* Crunching fixed numbers and vectors.
*
* @description:
* This section contains various functions used to perform computations
* on 16.16 fixed-float numbers or 2d vectors.
*
* **Attention**: Most arithmetic functions take `FT_Long` as arguments.
* For historical reasons, FreeType was designed under the assumption
* that `FT_Long` is a 32-bit integer; results can thus be undefined if
* the arguments don't fit into 32 bits.
*
* @order:
* FT_MulDiv
* FT_MulFix
* FT_DivFix
* FT_RoundFix
* FT_CeilFix
* FT_FloorFix
* FT_Vector_Transform
* FT_Matrix_Multiply
* FT_Matrix_Invert
*
*/
/**************************************************************************
*
* @function:
* FT_MulDiv
*
* @description:
* Compute `(a*b)/c` with maximum accuracy, using a 64-bit intermediate
* integer whenever necessary.
*
* This function isn't necessarily as fast as some processor-specific
* operations, but is at least completely portable.
*
* @input:
* a ::
* The first multiplier.
*
* b ::
* The second multiplier.
*
* c ::
* The divisor.
*
* @return:
* The result of `(a*b)/c`. This function never traps when trying to
* divide by zero; it simply returns 'MaxInt' or 'MinInt' depending on
* the signs of `a` and `b`.
*/
FT_EXPORT( FT_Long )
FT_MulDiv( FT_Long a,
FT_Long b,
FT_Long c );
/**************************************************************************
*
* @function:
* FT_MulFix
*
* @description:
* Compute `(a*b)/0x10000` with maximum accuracy. Its main use is to
* multiply a given value by a 16.16 fixed-point factor.
*
* @input:
* a ::
* The first multiplier.
*
* b ::
* The second multiplier. Use a 16.16 factor here whenever possible
* (see note below).
*
* @return:
* The result of `(a*b)/0x10000`.
*
* @note:
* This function has been optimized for the case where the absolute value
* of `a` is less than 2048, and `b` is a 16.16 scaling factor. As this
* happens mainly when scaling from notional units to fractional pixels
* in FreeType, it resulted in noticeable speed improvements between
* versions 2.x and 1.x.
*
* As a conclusion, always try to place a 16.16 factor as the _second_
* argument of this function; this can make a great difference.
*/
FT_EXPORT( FT_Long )
FT_MulFix( FT_Long a,
FT_Long b );
/**************************************************************************
*
* @function:
* FT_DivFix
*
* @description:
* Compute `(a*0x10000)/b` with maximum accuracy. Its main use is to
* divide a given value by a 16.16 fixed-point factor.
*
* @input:
* a ::
* The numerator.
*
* b ::
* The denominator. Use a 16.16 factor here.
*
* @return:
* The result of `(a*0x10000)/b`.
*/
FT_EXPORT( FT_Long )
FT_DivFix( FT_Long a,
FT_Long b );
/**************************************************************************
*
* @function:
* FT_RoundFix
*
* @description:
* Round a 16.16 fixed number.
*
* @input:
* a ::
* The number to be rounded.
*
* @return:
* `a` rounded to the nearest 16.16 fixed integer, halfway cases away
* from zero.
*
* @note:
* The function uses wrap-around arithmetic.
*/
FT_EXPORT( FT_Fixed )
FT_RoundFix( FT_Fixed a );
/**************************************************************************
*
* @function:
* FT_CeilFix
*
* @description:
* Compute the smallest following integer of a 16.16 fixed number.
*
* @input:
* a ::
* The number for which the ceiling function is to be computed.
*
* @return:
* `a` rounded towards plus infinity.
*
* @note:
* The function uses wrap-around arithmetic.
*/
FT_EXPORT( FT_Fixed )
FT_CeilFix( FT_Fixed a );
/**************************************************************************
*
* @function:
* FT_FloorFix
*
* @description:
* Compute the largest previous integer of a 16.16 fixed number.
*
* @input:
* a ::
* The number for which the floor function is to be computed.
*
* @return:
* `a` rounded towards minus infinity.
*/
FT_EXPORT( FT_Fixed )
FT_FloorFix( FT_Fixed a );
/**************************************************************************
*
* @function:
* FT_Vector_Transform
*
* @description:
* Transform a single vector through a 2x2 matrix.
*
* @inout:
* vector ::
* The target vector to transform.
*
* @input:
* matrix ::
* A pointer to the source 2x2 matrix.
*
* @note:
* The result is undefined if either `vector` or `matrix` is invalid.
*/
FT_EXPORT( void )
FT_Vector_Transform( FT_Vector* vector,
const FT_Matrix* matrix );
/**************************************************************************
*
* @section:
* version
*
* @title:
* FreeType Version
*
* @abstract:
* Functions and macros related to FreeType versions.
*
* @description:
* Note that those functions and macros are of limited use because even a
* new release of FreeType with only documentation changes increases the
* version number.
*
* @order:
* FT_Library_Version
*
* FREETYPE_MAJOR
* FREETYPE_MINOR
* FREETYPE_PATCH
*
* FT_Face_CheckTrueTypePatents
* FT_Face_SetUnpatentedHinting
*
*/
/**************************************************************************
*
* @enum:
* FREETYPE_XXX
*
* @description:
* These three macros identify the FreeType source code version. Use
* @FT_Library_Version to access them at runtime.
*
* @values:
* FREETYPE_MAJOR ::
* The major version number.
* FREETYPE_MINOR ::
* The minor version number.
* FREETYPE_PATCH ::
* The patch level.
*
* @note:
* The version number of FreeType if built as a dynamic link library with
* the 'libtool' package is _not_ controlled by these three macros.
*
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 10
#define FREETYPE_PATCH 1
/**************************************************************************
*
* @function:
* FT_Library_Version
*
* @description:
* Return the version of the FreeType library being used. This is useful
* when dynamically linking to the library, since one cannot use the
* macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and @FREETYPE_PATCH.
*
* @input:
* library ::
* A source library handle.
*
* @output:
* amajor ::
* The major version number.
*
* aminor ::
* The minor version number.
*
* apatch ::
* The patch version number.
*
* @note:
* The reason why this function takes a `library` argument is because
* certain programs implement library initialization in a custom way that
* doesn't use @FT_Init_FreeType.
*
* In such cases, the library version might not be available before the
* library object has been created.
*/
FT_EXPORT( void )
FT_Library_Version( FT_Library library,
FT_Int *amajor,
FT_Int *aminor,
FT_Int *apatch );
/**************************************************************************
*
* @function:
* FT_Face_CheckTrueTypePatents
*
* @description:
* Deprecated, does nothing.
*
* @input:
* face ::
* A face handle.
*
* @return:
* Always returns false.
*
* @note:
* Since May 2010, TrueType hinting is no longer patented.
*
* @since:
* 2.3.5
*/
FT_EXPORT( FT_Bool )
FT_Face_CheckTrueTypePatents( FT_Face face );
/**************************************************************************
*
* @function:
* FT_Face_SetUnpatentedHinting
*
* @description:
* Deprecated, does nothing.
*
* @input:
* face ::
* A face handle.
*
* value ::
* New boolean setting.
*
* @return:
* Always returns false.
*
* @note:
* Since May 2010, TrueType hinting is no longer patented.
*
* @since:
* 2.3.5
*/
FT_EXPORT( FT_Bool )
FT_Face_SetUnpatentedHinting( FT_Face face,
FT_Bool value );
/* */
FT_END_HEADER
#endif /* FREETYPE_H_ */
/* END */
/****************************************************************************
*
* ftadvanc.h
*
* Quick computation of advance widths (specification only).
*
* Copyright (C) 2008-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTADVANC_H_
#define FTADVANC_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* quick_advance
*
* @title:
* Quick retrieval of advance values
*
* @abstract:
* Retrieve horizontal and vertical advance values without processing
* glyph outlines, if possible.
*
* @description:
* This section contains functions to quickly extract advance values
* without handling glyph outlines, if possible.
*
* @order:
* FT_Get_Advance
* FT_Get_Advances
*
*/
/**************************************************************************
*
* @enum:
* FT_ADVANCE_FLAG_FAST_ONLY
*
* @description:
* A bit-flag to be OR-ed with the `flags` parameter of the
* @FT_Get_Advance and @FT_Get_Advances functions.
*
* If set, it indicates that you want these functions to fail if the
* corresponding hinting mode or font driver doesn't allow for very quick
* advance computation.
*
* Typically, glyphs that are either unscaled, unhinted, bitmapped, or
* light-hinted can have their advance width computed very quickly.
*
* Normal and bytecode hinted modes that require loading, scaling, and
* hinting of the glyph outline, are extremely slow by comparison.
*/
#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L
/**************************************************************************
*
* @function:
* FT_Get_Advance
*
* @description:
* Retrieve the advance value of a given glyph outline in an @FT_Face.
*
* @input:
* face ::
* The source @FT_Face handle.
*
* gindex ::
* The glyph index.
*
* load_flags ::
* A set of bit flags similar to those used when calling
* @FT_Load_Glyph, used to determine what kind of advances you need.
* @output:
* padvance ::
* The advance value. If scaling is performed (based on the value of
* `load_flags`), the advance value is in 16.16 format. Otherwise, it
* is in font units.
*
* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the vertical advance
* corresponding to a vertical layout. Otherwise, it is the horizontal
* advance in a horizontal layout.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if
* the corresponding font backend doesn't have a quick way to retrieve
* the advances.
*
* A scaled advance is returned in 16.16 format but isn't transformed by
* the affine transformation specified by @FT_Set_Transform.
*/
FT_EXPORT( FT_Error )
FT_Get_Advance( FT_Face face,
FT_UInt gindex,
FT_Int32 load_flags,
FT_Fixed *padvance );
/**************************************************************************
*
* @function:
* FT_Get_Advances
*
* @description:
* Retrieve the advance values of several glyph outlines in an @FT_Face.
*
* @input:
* face ::
* The source @FT_Face handle.
*
* start ::
* The first glyph index.
*
* count ::
* The number of advance values you want to retrieve.
*
* load_flags ::
* A set of bit flags similar to those used when calling
* @FT_Load_Glyph.
*
* @output:
* padvance ::
* The advance values. This array, to be provided by the caller, must
* contain at least `count` elements.
*
* If scaling is performed (based on the value of `load_flags`), the
* advance values are in 16.16 format. Otherwise, they are in font
* units.
*
* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the vertical advances
* corresponding to a vertical layout. Otherwise, they are the
* horizontal advances in a horizontal layout.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if
* the corresponding font backend doesn't have a quick way to retrieve
* the advances.
*
* Scaled advances are returned in 16.16 format but aren't transformed by
* the affine transformation specified by @FT_Set_Transform.
*/
FT_EXPORT( FT_Error )
FT_Get_Advances( FT_Face face,
FT_UInt start,
FT_UInt count,
FT_Int32 load_flags,
FT_Fixed *padvances );
/* */
FT_END_HEADER
#endif /* FTADVANC_H_ */
/* END */
/****************************************************************************
*
* ftbbox.h
*
* FreeType exact bbox computation (specification).
*
* Copyright (C) 1996-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
/**************************************************************************
*
* This component has a _single_ role: to compute exact outline bounding
* boxes.
*
* It is separated from the rest of the engine for various technical
* reasons. It may well be integrated in 'ftoutln' later.
*
*/
#ifndef FTBBOX_H_
#define FTBBOX_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* outline_processing
*
*/
/**************************************************************************
*
* @function:
* FT_Outline_Get_BBox
*
* @description:
* Compute the exact bounding box of an outline. This is slower than
* computing the control box. However, it uses an advanced algorithm
* that returns _very_ quickly when the two boxes coincide. Otherwise,
* the outline Bezier arcs are traversed to extract their extrema.
*
* @input:
* outline ::
* A pointer to the source outline.
*
* @output:
* abbox ::
* The outline's exact bounding box.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If the font is tricky and the glyph has been loaded with
* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get
* reasonable values for the BBox it is necessary to load the glyph at a
* large ppem value (so that the hinting instructions can properly shift
* and scale the subglyphs), then extracting the BBox, which can be
* eventually converted back to font units.
*/
FT_EXPORT( FT_Error )
FT_Outline_Get_BBox( FT_Outline* outline,
FT_BBox *abbox );
/* */
FT_END_HEADER
#endif /* FTBBOX_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
/****************************************************************************
*
* ftbdf.h
*
* FreeType API for accessing BDF-specific strings (specification).
*
* Copyright (C) 2002-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTBDF_H_
#define FTBDF_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* bdf_fonts
*
* @title:
* BDF and PCF Files
*
* @abstract:
* BDF and PCF specific API.
*
* @description:
* This section contains the declaration of functions specific to BDF and
* PCF fonts.
*
*/
/**************************************************************************
*
* @enum:
* BDF_PropertyType
*
* @description:
* A list of BDF property types.
*
* @values:
* BDF_PROPERTY_TYPE_NONE ::
* Value~0 is used to indicate a missing property.
*
* BDF_PROPERTY_TYPE_ATOM ::
* Property is a string atom.
*
* BDF_PROPERTY_TYPE_INTEGER ::
* Property is a 32-bit signed integer.
*
* BDF_PROPERTY_TYPE_CARDINAL ::
* Property is a 32-bit unsigned integer.
*/
typedef enum BDF_PropertyType_
{
BDF_PROPERTY_TYPE_NONE = 0,
BDF_PROPERTY_TYPE_ATOM = 1,
BDF_PROPERTY_TYPE_INTEGER = 2,
BDF_PROPERTY_TYPE_CARDINAL = 3
} BDF_PropertyType;
/**************************************************************************
*
* @type:
* BDF_Property
*
* @description:
* A handle to a @BDF_PropertyRec structure to model a given BDF/PCF
* property.
*/
typedef struct BDF_PropertyRec_* BDF_Property;
/**************************************************************************
*
* @struct:
* BDF_PropertyRec
*
* @description:
* This structure models a given BDF/PCF property.
*
* @fields:
* type ::
* The property type.
*
* u.atom ::
* The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be
* `NULL`, indicating an empty string.
*
* u.integer ::
* A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.
*
* u.cardinal ::
* An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.
*/
typedef struct BDF_PropertyRec_
{
BDF_PropertyType type;
union {
const char* atom;
FT_Int32 integer;
FT_UInt32 cardinal;
} u;
} BDF_PropertyRec;
/**************************************************************************
*
* @function:
* FT_Get_BDF_Charset_ID
*
* @description:
* Retrieve a BDF font character set identity, according to the BDF
* specification.
*
* @input:
* face ::
* A handle to the input face.
*
* @output:
* acharset_encoding ::
* Charset encoding, as a C~string, owned by the face.
*
* acharset_registry ::
* Charset registry, as a C~string, owned by the face.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with BDF faces, returning an error otherwise.
*/
FT_EXPORT( FT_Error )
FT_Get_BDF_Charset_ID( FT_Face face,
const char* *acharset_encoding,
const char* *acharset_registry );
/**************************************************************************
*
* @function:
* FT_Get_BDF_Property
*
* @description:
* Retrieve a BDF property from a BDF or PCF font file.
*
* @input:
* face ::
* A handle to the input face.
*
* name ::
* The property name.
*
* @output:
* aproperty ::
* The property.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function works with BDF _and_ PCF fonts. It returns an error
* otherwise. It also returns an error if the property is not in the
* font.
*
* A 'property' is a either key-value pair within the STARTPROPERTIES
* ... ENDPROPERTIES block of a BDF font or a key-value pair from the
* `info->props` array within a `FontRec` structure of a PCF font.
*
* Integer properties are always stored as 'signed' within PCF fonts;
* consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value
* for BDF fonts only.
*
* In case of error, `aproperty->type` is always set to
* @BDF_PROPERTY_TYPE_NONE.
*/
FT_EXPORT( FT_Error )
FT_Get_BDF_Property( FT_Face face,
const char* prop_name,
BDF_PropertyRec *aproperty );
/* */
FT_END_HEADER
#endif /* FTBDF_H_ */
/* END */
/****************************************************************************
*
* ftbitmap.h
*
* FreeType utility functions for bitmaps (specification).
*
* Copyright (C) 2004-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTBITMAP_H_
#define FTBITMAP_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_COLOR_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* bitmap_handling
*
* @title:
* Bitmap Handling
*
* @abstract:
* Handling FT_Bitmap objects.
*
* @description:
* This section contains functions for handling @FT_Bitmap objects,
* automatically adjusting the target's bitmap buffer size as needed.
*
* Note that none of the functions changes the bitmap's 'flow' (as
* indicated by the sign of the `pitch` field in @FT_Bitmap).
*
* To set the flow, assign an appropriate positive or negative value to
* the `pitch` field of the target @FT_Bitmap object after calling
* @FT_Bitmap_Init but before calling any of the other functions
* described here.
*/
/**************************************************************************
*
* @function:
* FT_Bitmap_Init
*
* @description:
* Initialize a pointer to an @FT_Bitmap structure.
*
* @inout:
* abitmap ::
* A pointer to the bitmap structure.
*
* @note:
* A deprecated name for the same function is `FT_Bitmap_New`.
*/
FT_EXPORT( void )
FT_Bitmap_Init( FT_Bitmap *abitmap );
/* deprecated */
FT_EXPORT( void )
FT_Bitmap_New( FT_Bitmap *abitmap );
/**************************************************************************
*
* @function:
* FT_Bitmap_Copy
*
* @description:
* Copy a bitmap into another one.
*
* @input:
* library ::
* A handle to a library object.
*
* source ::
* A handle to the source bitmap.
*
* @output:
* target ::
* A handle to the target bitmap.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* `source->buffer` and `target->buffer` must neither be equal nor
* overlap.
*/
FT_EXPORT( FT_Error )
FT_Bitmap_Copy( FT_Library library,
const FT_Bitmap *source,
FT_Bitmap *target );
/**************************************************************************
*
* @function:
* FT_Bitmap_Embolden
*
* @description:
* Embolden a bitmap. The new bitmap will be about `xStrength` pixels
* wider and `yStrength` pixels higher. The left and bottom borders are
* kept unchanged.
*
* @input:
* library ::
* A handle to a library object.
*
* xStrength ::
* How strong the glyph is emboldened horizontally. Expressed in 26.6
* pixel format.
*
* yStrength ::
* How strong the glyph is emboldened vertically. Expressed in 26.6
* pixel format.
*
* @inout:
* bitmap ::
* A handle to the target bitmap.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The current implementation restricts `xStrength` to be less than or
* equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.
*
* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, you
* should call @FT_GlyphSlot_Own_Bitmap on the slot first.
*
* Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format are
* converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp).
*/
FT_EXPORT( FT_Error )
FT_Bitmap_Embolden( FT_Library library,
FT_Bitmap* bitmap,
FT_Pos xStrength,
FT_Pos yStrength );
/**************************************************************************
*
* @function:
* FT_Bitmap_Convert
*
* @description:
* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to
* a bitmap object with depth 8bpp, making the number of used bytes per
* line (a.k.a. the 'pitch') a multiple of `alignment`.
*
* @input:
* library ::
* A handle to a library object.
*
* source ::
* The source bitmap.
*
* alignment ::
* The pitch of the bitmap is a multiple of this argument. Common
* values are 1, 2, or 4.
*
* @output:
* target ::
* The target bitmap.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* It is possible to call @FT_Bitmap_Convert multiple times without
* calling @FT_Bitmap_Done (the memory is simply reallocated).
*
* Use @FT_Bitmap_Done to finally remove the bitmap object.
*
* The `library` argument is taken to have access to FreeType's memory
* handling functions.
*
* `source->buffer` and `target->buffer` must neither be equal nor
* overlap.
*/
FT_EXPORT( FT_Error )
FT_Bitmap_Convert( FT_Library library,
const FT_Bitmap *source,
FT_Bitmap *target,
FT_Int alignment );
/**************************************************************************
*
* @function:
* FT_Bitmap_Blend
*
* @description:
* Blend a bitmap onto another bitmap, using a given color.
*
* @input:
* library ::
* A handle to a library object.
*
* source ::
* The source bitmap, which can have any @FT_Pixel_Mode format.
*
* source_offset ::
* The offset vector to the upper left corner of the source bitmap in
* 26.6 pixel format. It should represent an integer offset; the
* function will set the lowest six bits to zero to enforce that.
*
* color ::
* The color used to draw `source` onto `target`.
*
* @inout:
* target ::
* A handle to an `FT_Bitmap` object. It should be either initialized
* as empty with a call to @FT_Bitmap_Init, or it should be of type
* @FT_PIXEL_MODE_BGRA.
*
* atarget_offset ::
* The offset vector to the upper left corner of the target bitmap in
* 26.6 pixel format. It should represent an integer offset; the
* function will set the lowest six bits to zero to enforce that.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function doesn't perform clipping.
*
* The bitmap in `target` gets allocated or reallocated as needed; the
* vector `atarget_offset` is updated accordingly.
*
* In case of allocation or reallocation, the bitmap's pitch is set to
* `4 * width`. Both `source` and `target` must have the same bitmap
* flow (as indicated by the sign of the `pitch` field).
*
* `source->buffer` and `target->buffer` must neither be equal nor
* overlap.
*
* @since:
* 2.10
*/
FT_EXPORT( FT_Error )
FT_Bitmap_Blend( FT_Library library,
const FT_Bitmap* source,
const FT_Vector source_offset,
FT_Bitmap* target,
FT_Vector *atarget_offset,
FT_Color color );
/**************************************************************************
*
* @function:
* FT_GlyphSlot_Own_Bitmap
*
* @description:
* Make sure that a glyph slot owns `slot->bitmap`.
*
* @input:
* slot ::
* The glyph slot.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function is to be used in combination with @FT_Bitmap_Embolden.
*/
FT_EXPORT( FT_Error )
FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
/**************************************************************************
*
* @function:
* FT_Bitmap_Done
*
* @description:
* Destroy a bitmap object initialized with @FT_Bitmap_Init.
*
* @input:
* library ::
* A handle to a library object.
*
* bitmap ::
* The bitmap object to be freed.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The `library` argument is taken to have access to FreeType's memory
* handling functions.
*/
FT_EXPORT( FT_Error )
FT_Bitmap_Done( FT_Library library,
FT_Bitmap *bitmap );
/* */
FT_END_HEADER
#endif /* FTBITMAP_H_ */
/* END */
/****************************************************************************
*
* ftbzip2.h
*
* Bzip2-compressed stream support.
*
* Copyright (C) 2010-2019 by
* Joel Klinghed.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTBZIP2_H_
#define FTBZIP2_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* bzip2
*
* @title:
* BZIP2 Streams
*
* @abstract:
* Using bzip2-compressed font files.
*
* @description:
* This section contains the declaration of Bzip2-specific functions.
*
*/
/**************************************************************************
*
* @function:
* FT_Stream_OpenBzip2
*
* @description:
* Open a new stream to parse bzip2-compressed font files. This is
* mainly used to support the compressed `*.pcf.bz2` fonts that come with
* XFree86.
*
* @input:
* stream ::
* The target embedding stream.
*
* source ::
* The source stream.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
*
* Calling the internal function `FT_Stream_Close` on the new stream will
* **not** call `FT_Stream_Close` on the source stream. None of the
* stream objects will be released to the heap.
*
* The stream implementation is very basic and resets the decompression
* process each time seeking backwards is needed within the stream.
*
* In certain builds of the library, bzip2 compression recognition is
* automatically handled when calling @FT_New_Face or @FT_Open_Face.
* This means that if no font driver is capable of handling the raw
* compressed file, the library will try to open a bzip2 compressed
* stream from it and re-open the face with it.
*
* This function may return `FT_Err_Unimplemented_Feature` if your build
* of FreeType was not compiled with bzip2 support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenBzip2( FT_Stream stream,
FT_Stream source );
/* */
FT_END_HEADER
#endif /* FTBZIP2_H_ */
/* END */
/****************************************************************************
*
* ftcache.h
*
* FreeType Cache subsystem (specification).
*
* Copyright (C) 1996-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTCACHE_H_
#define FTCACHE_H_
#include <ft2build.h>
#include FT_GLYPH_H
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* cache_subsystem
*
* @title:
* Cache Sub-System
*
* @abstract:
* How to cache face, size, and glyph data with FreeType~2.
*
* @description:
* This section describes the FreeType~2 cache sub-system, which is used
* to limit the number of concurrently opened @FT_Face and @FT_Size
* objects, as well as caching information like character maps and glyph
* images while limiting their maximum memory usage.
*
* Note that all types and functions begin with the `FTC_` prefix.
*
* The cache is highly portable and thus doesn't know anything about the
* fonts installed on your system, or how to access them. This implies
* the following scheme:
*
* First, available or installed font faces are uniquely identified by
* @FTC_FaceID values, provided to the cache by the client. Note that
* the cache only stores and compares these values, and doesn't try to
* interpret them in any way.
*
* Second, the cache calls, only when needed, a client-provided function
* to convert an @FTC_FaceID into a new @FT_Face object. The latter is
* then completely managed by the cache, including its termination
* through @FT_Done_Face. To monitor termination of face objects, the
* finalizer callback in the `generic` field of the @FT_Face object can
* be used, which might also be used to store the @FTC_FaceID of the
* face.
*
* Clients are free to map face IDs to anything else. The most simple
* usage is to associate them to a (pathname,face_index) pair that is
* used to call @FT_New_Face. However, more complex schemes are also
* possible.
*
* Note that for the cache to work correctly, the face ID values must be
* **persistent**, which means that the contents they point to should not
* change at runtime, or that their value should not become invalid.
*
* If this is unavoidable (e.g., when a font is uninstalled at runtime),
* you should call @FTC_Manager_RemoveFaceID as soon as possible, to let
* the cache get rid of any references to the old @FTC_FaceID it may keep
* internally. Failure to do so will lead to incorrect behaviour or even
* crashes.
*
* To use the cache, start with calling @FTC_Manager_New to create a new
* @FTC_Manager object, which models a single cache instance. You can
* then look up @FT_Face and @FT_Size objects with
* @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.
*
* If you want to use the charmap caching, call @FTC_CMapCache_New, then
* later use @FTC_CMapCache_Lookup to perform the equivalent of
* @FT_Get_Char_Index, only much faster.
*
* If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then
* later use @FTC_ImageCache_Lookup to retrieve the corresponding
* @FT_Glyph objects from the cache.
*
* If you need lots of small bitmaps, it is much more memory efficient to
* call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This
* returns @FTC_SBitRec structures, which are used to store small bitmaps
* directly. (A small bitmap is one whose metrics and dimensions all fit
* into 8-bit integers).
*
* We hope to also provide a kerning cache in the near future.
*
*
* @order:
* FTC_Manager
* FTC_FaceID
* FTC_Face_Requester
*
* FTC_Manager_New
* FTC_Manager_Reset
* FTC_Manager_Done
* FTC_Manager_LookupFace
* FTC_Manager_LookupSize
* FTC_Manager_RemoveFaceID
*
* FTC_Node
* FTC_Node_Unref
*
* FTC_ImageCache
* FTC_ImageCache_New
* FTC_ImageCache_Lookup
*
* FTC_SBit
* FTC_SBitCache
* FTC_SBitCache_New
* FTC_SBitCache_Lookup
*
* FTC_CMapCache
* FTC_CMapCache_New
* FTC_CMapCache_Lookup
*
*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** BASIC TYPE DEFINITIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @type:
* FTC_FaceID
*
* @description:
* An opaque pointer type that is used to identity face objects. The
* contents of such objects is application-dependent.
*
* These pointers are typically used to point to a user-defined structure
* containing a font file path, and face index.
*
* @note:
* Never use `NULL` as a valid @FTC_FaceID.
*
* Face IDs are passed by the client to the cache manager that calls,
* when needed, the @FTC_Face_Requester to translate them into new
* @FT_Face objects.
*
* If the content of a given face ID changes at runtime, or if the value
* becomes invalid (e.g., when uninstalling a font), you should
* immediately call @FTC_Manager_RemoveFaceID before any other cache
* function.
*
* Failure to do so will result in incorrect behaviour or even memory
* leaks and crashes.
*/
typedef FT_Pointer FTC_FaceID;
/**************************************************************************
*
* @functype:
* FTC_Face_Requester
*
* @description:
* A callback function provided by client applications. It is used by
* the cache manager to translate a given @FTC_FaceID into a new valid
* @FT_Face object, on demand.
*
* @input:
* face_id ::
* The face ID to resolve.
*
* library ::
* A handle to a FreeType library object.
*
* req_data ::
* Application-provided request data (see note below).
*
* @output:
* aface ::
* A new @FT_Face handle.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The third parameter `req_data` is the same as the one passed by the
* client when @FTC_Manager_New is called.
*
* The face requester should not perform funny things on the returned
* face object, like creating a new @FT_Size for it, or setting a
* transformation through @FT_Set_Transform!
*/
typedef FT_Error
(*FTC_Face_Requester)( FTC_FaceID face_id,
FT_Library library,
FT_Pointer req_data,
FT_Face* aface );
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CACHE MANAGER OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @type:
* FTC_Manager
*
* @description:
* This object corresponds to one instance of the cache-subsystem. It is
* used to cache one or more @FT_Face objects, along with corresponding
* @FT_Size objects.
*
* The manager intentionally limits the total number of opened @FT_Face
* and @FT_Size objects to control memory usage. See the `max_faces` and
* `max_sizes` parameters of @FTC_Manager_New.
*
* The manager is also used to cache 'nodes' of various types while
* limiting their total memory usage.
*
* All limitations are enforced by keeping lists of managed objects in
* most-recently-used order, and flushing old nodes to make room for new
* ones.
*/
typedef struct FTC_ManagerRec_* FTC_Manager;
/**************************************************************************
*
* @type:
* FTC_Node
*
* @description:
* An opaque handle to a cache node object. Each cache node is
* reference-counted. A node with a count of~0 might be flushed out of a
* full cache whenever a lookup request is performed.
*
* If you look up nodes, you have the ability to 'acquire' them, i.e., to
* increment their reference count. This will prevent the node from
* being flushed out of the cache until you explicitly 'release' it (see
* @FTC_Node_Unref).
*
* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup.
*/
typedef struct FTC_NodeRec_* FTC_Node;
/**************************************************************************
*
* @function:
* FTC_Manager_New
*
* @description:
* Create a new cache manager.
*
* @input:
* library ::
* The parent FreeType library handle to use.
*
* max_faces ::
* Maximum number of opened @FT_Face objects managed by this cache
* instance. Use~0 for defaults.
*
* max_sizes ::
* Maximum number of opened @FT_Size objects managed by this cache
* instance. Use~0 for defaults.
*
* max_bytes ::
* Maximum number of bytes to use for cached data nodes. Use~0 for
* defaults. Note that this value does not account for managed
* @FT_Face and @FT_Size objects.
*
* requester ::
* An application-provided callback used to translate face IDs into
* real @FT_Face objects.
*
* req_data ::
* A generic pointer that is passed to the requester each time it is
* called (see @FTC_Face_Requester).
*
* @output:
* amanager ::
* A handle to a new manager object. 0~in case of failure.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FTC_Manager_New( FT_Library library,
FT_UInt max_faces,
FT_UInt max_sizes,
FT_ULong max_bytes,
FTC_Face_Requester requester,
FT_Pointer req_data,
FTC_Manager *amanager );
/**************************************************************************
*
* @function:
* FTC_Manager_Reset
*
* @description:
* Empty a given cache manager. This simply gets rid of all the
* currently cached @FT_Face and @FT_Size objects within the manager.
*
* @inout:
* manager ::
* A handle to the manager.
*/
FT_EXPORT( void )
FTC_Manager_Reset( FTC_Manager manager );
/**************************************************************************
*
* @function:
* FTC_Manager_Done
*
* @description:
* Destroy a given manager after emptying it.
*
* @input:
* manager ::
* A handle to the target cache manager object.
*/
FT_EXPORT( void )
FTC_Manager_Done( FTC_Manager manager );
/**************************************************************************
*
* @function:
* FTC_Manager_LookupFace
*
* @description:
* Retrieve the @FT_Face object that corresponds to a given face ID
* through a cache manager.
*
* @input:
* manager ::
* A handle to the cache manager.
*
* face_id ::
* The ID of the face object.
*
* @output:
* aface ::
* A handle to the face object.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The returned @FT_Face object is always owned by the manager. You
* should never try to discard it yourself.
*
* The @FT_Face object doesn't necessarily have a current size object
* (i.e., face->size can be~0). If you need a specific 'font size', use
* @FTC_Manager_LookupSize instead.
*
* Never change the face's transformation matrix (i.e., never call the
* @FT_Set_Transform function) on a returned face! If you need to
* transform glyphs, do it yourself after glyph loading.
*
* When you perform a lookup, out-of-memory errors are detected _within_
* the lookup and force incremental flushes of the cache until enough
* memory is released for the lookup to succeed.
*
* If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already
* been completely flushed, and still no memory was available for the
* operation.
*/
FT_EXPORT( FT_Error )
FTC_Manager_LookupFace( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
/**************************************************************************
*
* @struct:
* FTC_ScalerRec
*
* @description:
* A structure used to describe a given character size in either pixels
* or points to the cache manager. See @FTC_Manager_LookupSize.
*
* @fields:
* face_id ::
* The source face ID.
*
* width ::
* The character width.
*
* height ::
* The character height.
*
* pixel ::
* A Boolean. If 1, the `width` and `height` fields are interpreted as
* integer pixel character sizes. Otherwise, they are expressed as
* 1/64th of points.
*
* x_res ::
* Only used when `pixel` is value~0 to indicate the horizontal
* resolution in dpi.
*
* y_res ::
* Only used when `pixel` is value~0 to indicate the vertical
* resolution in dpi.
*
* @note:
* This type is mainly used to retrieve @FT_Size objects through the
* cache manager.
*/
typedef struct FTC_ScalerRec_
{
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int pixel;
FT_UInt x_res;
FT_UInt y_res;
} FTC_ScalerRec;
/**************************************************************************
*
* @struct:
* FTC_Scaler
*
* @description:
* A handle to an @FTC_ScalerRec structure.
*/
typedef struct FTC_ScalerRec_* FTC_Scaler;
/**************************************************************************
*
* @function:
* FTC_Manager_LookupSize
*
* @description:
* Retrieve the @FT_Size object that corresponds to a given
* @FTC_ScalerRec pointer through a cache manager.
*
* @input:
* manager ::
* A handle to the cache manager.
*
* scaler ::
* A scaler handle.
*
* @output:
* asize ::
* A handle to the size object.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The returned @FT_Size object is always owned by the manager. You
* should never try to discard it by yourself.
*
* You can access the parent @FT_Face object simply as `size->face` if
* you need it. Note that this object is also owned by the manager.
*
* @note:
* When you perform a lookup, out-of-memory errors are detected _within_
* the lookup and force incremental flushes of the cache until enough
* memory is released for the lookup to succeed.
*
* If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already
* been completely flushed, and still no memory is available for the
* operation.
*/
FT_EXPORT( FT_Error )
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize );
/**************************************************************************
*
* @function:
* FTC_Node_Unref
*
* @description:
* Decrement a cache node's internal reference count. When the count
* reaches 0, it is not destroyed but becomes eligible for subsequent
* cache flushes.
*
* @input:
* node ::
* The cache node handle.
*
* manager ::
* The cache manager handle.
*/
FT_EXPORT( void )
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager );
/**************************************************************************
*
* @function:
* FTC_Manager_RemoveFaceID
*
* @description:
* A special function used to indicate to the cache manager that a given
* @FTC_FaceID is no longer valid, either because its content changed, or
* because it was deallocated or uninstalled.
*
* @input:
* manager ::
* The cache manager handle.
*
* face_id ::
* The @FTC_FaceID to be removed.
*
* @note:
* This function flushes all nodes from the cache corresponding to this
* `face_id`, with the exception of nodes with a non-null reference
* count.
*
* Such nodes are however modified internally so as to never appear in
* later lookups with the same `face_id` value, and to be immediately
* destroyed when released by all their users.
*
*/
FT_EXPORT( void )
FTC_Manager_RemoveFaceID( FTC_Manager manager,
FTC_FaceID face_id );
/**************************************************************************
*
* @type:
* FTC_CMapCache
*
* @description:
* An opaque handle used to model a charmap cache. This cache is to hold
* character codes -> glyph indices mappings.
*
*/
typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
/**************************************************************************
*
* @function:
* FTC_CMapCache_New
*
* @description:
* Create a new charmap cache.
*
* @input:
* manager ::
* A handle to the cache manager.
*
* @output:
* acache ::
* A new cache handle. `NULL` in case of error.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Like all other caches, this one will be destroyed with the cache
* manager.
*
*/
FT_EXPORT( FT_Error )
FTC_CMapCache_New( FTC_Manager manager,
FTC_CMapCache *acache );
/**************************************************************************
*
* @function:
* FTC_CMapCache_Lookup
*
* @description:
* Translate a character code into a glyph index, using the charmap
* cache.
*
* @input:
* cache ::
* A charmap cache handle.
*
* face_id ::
* The source face ID.
*
* cmap_index ::
* The index of the charmap in the source face. Any negative value
* means to use the cache @FT_Face's default charmap.
*
* char_code ::
* The character code (in the corresponding charmap).
*
* @return:
* Glyph index. 0~means 'no glyph'.
*
*/
FT_EXPORT( FT_UInt )
FTC_CMapCache_Lookup( FTC_CMapCache cache,
FTC_FaceID face_id,
FT_Int cmap_index,
FT_UInt32 char_code );
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** IMAGE CACHE OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @struct:
* FTC_ImageTypeRec
*
* @description:
* A structure used to model the type of images in a glyph cache.
*
* @fields:
* face_id ::
* The face ID.
*
* width ::
* The width in pixels.
*
* height ::
* The height in pixels.
*
* flags ::
* The load flags, as in @FT_Load_Glyph.
*
*/
typedef struct FTC_ImageTypeRec_
{
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int32 flags;
} FTC_ImageTypeRec;
/**************************************************************************
*
* @type:
* FTC_ImageType
*
* @description:
* A handle to an @FTC_ImageTypeRec structure.
*
*/
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
/* */
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( (d1)->face_id == (d2)->face_id && \
(d1)->width == (d2)->width && \
(d1)->flags == (d2)->flags )
/**************************************************************************
*
* @type:
* FTC_ImageCache
*
* @description:
* A handle to a glyph image cache object. They are designed to hold
* many distinct glyph images while not exceeding a certain memory
* threshold.
*/
typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
/**************************************************************************
*
* @function:
* FTC_ImageCache_New
*
* @description:
* Create a new glyph image cache.
*
* @input:
* manager ::
* The parent manager for the image cache.
*
* @output:
* acache ::
* A handle to the new glyph image cache object.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FTC_ImageCache_New( FTC_Manager manager,
FTC_ImageCache *acache );
/**************************************************************************
*
* @function:
* FTC_ImageCache_Lookup
*
* @description:
* Retrieve a given glyph image from a glyph image cache.
*
* @input:
* cache ::
* A handle to the source glyph image cache.
*
* type ::
* A pointer to a glyph image type descriptor.
*
* gindex ::
* The glyph index to retrieve.
*
* @output:
* aglyph ::
* The corresponding @FT_Glyph object. 0~in case of failure.
*
* anode ::
* Used to return the address of the corresponding cache node after
* incrementing its reference count (see note below).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The returned glyph is owned and managed by the glyph image cache.
* Never try to transform or discard it manually! You can however create
* a copy with @FT_Glyph_Copy and modify the new one.
*
* If `anode` is _not_ `NULL`, it receives the address of the cache node
* containing the glyph image, after increasing its reference count.
* This ensures that the node (as well as the @FT_Glyph) will always be
* kept in the cache until you call @FTC_Node_Unref to 'release' it.
*
* If `anode` is `NULL`, the cache node is left unchanged, which means
* that the @FT_Glyph could be flushed out of the cache on the next call
* to one of the caching sub-system APIs. Don't assume that it is
* persistent!
*/
FT_EXPORT( FT_Error )
FTC_ImageCache_Lookup( FTC_ImageCache cache,
FTC_ImageType type,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/**************************************************************************
*
* @function:
* FTC_ImageCache_LookupScaler
*
* @description:
* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec to
* specify the face ID and its size.
*
* @input:
* cache ::
* A handle to the source glyph image cache.
*
* scaler ::
* A pointer to a scaler descriptor.
*
* load_flags ::
* The corresponding load flags.
*
* gindex ::
* The glyph index to retrieve.
*
* @output:
* aglyph ::
* The corresponding @FT_Glyph object. 0~in case of failure.
*
* anode ::
* Used to return the address of the corresponding cache node after
* incrementing its reference count (see note below).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The returned glyph is owned and managed by the glyph image cache.
* Never try to transform or discard it manually! You can however create
* a copy with @FT_Glyph_Copy and modify the new one.
*
* If `anode` is _not_ `NULL`, it receives the address of the cache node
* containing the glyph image, after increasing its reference count.
* This ensures that the node (as well as the @FT_Glyph) will always be
* kept in the cache until you call @FTC_Node_Unref to 'release' it.
*
* If `anode` is `NULL`, the cache node is left unchanged, which means
* that the @FT_Glyph could be flushed out of the cache on the next call
* to one of the caching sub-system APIs. Don't assume that it is
* persistent!
*
* Calls to @FT_Set_Char_Size and friends have no effect on cached
* glyphs; you should always use the FreeType cache API instead.
*/
FT_EXPORT( FT_Error )
FTC_ImageCache_LookupScaler( FTC_ImageCache cache,
FTC_Scaler scaler,
FT_ULong load_flags,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/**************************************************************************
*
* @type:
* FTC_SBit
*
* @description:
* A handle to a small bitmap descriptor. See the @FTC_SBitRec structure
* for details.
*/
typedef struct FTC_SBitRec_* FTC_SBit;
/**************************************************************************
*
* @struct:
* FTC_SBitRec
*
* @description:
* A very compact structure used to describe a small glyph bitmap.
*
* @fields:
* width ::
* The bitmap width in pixels.
*
* height ::
* The bitmap height in pixels.
*
* left ::
* The horizontal distance from the pen position to the left bitmap
* border (a.k.a. 'left side bearing', or 'lsb').
*
* top ::
* The vertical distance from the pen position (on the baseline) to the
* upper bitmap border (a.k.a. 'top side bearing'). The distance is
* positive for upwards y~coordinates.
*
* format ::
* The format of the glyph bitmap (monochrome or gray).
*
* max_grays ::
* Maximum gray level value (in the range 1 to~255).
*
* pitch ::
* The number of bytes per bitmap line. May be positive or negative.
*
* xadvance ::
* The horizontal advance width in pixels.
*
* yadvance ::
* The vertical advance height in pixels.
*
* buffer ::
* A pointer to the bitmap pixels.
*/
typedef struct FTC_SBitRec_
{
FT_Byte width;
FT_Byte height;
FT_Char left;
FT_Char top;
FT_Byte format;
FT_Byte max_grays;
FT_Short pitch;
FT_Char xadvance;
FT_Char yadvance;
FT_Byte* buffer;
} FTC_SBitRec;
/**************************************************************************
*
* @type:
* FTC_SBitCache
*
* @description:
* A handle to a small bitmap cache. These are special cache objects
* used to store small glyph bitmaps (and anti-aliased pixmaps) in a much
* more efficient way than the traditional glyph image cache implemented
* by @FTC_ImageCache.
*/
typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
/**************************************************************************
*
* @function:
* FTC_SBitCache_New
*
* @description:
* Create a new cache to store small glyph bitmaps.
*
* @input:
* manager ::
* A handle to the source cache manager.
*
* @output:
* acache ::
* A handle to the new sbit cache. `NULL` in case of error.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache );
/**************************************************************************
*
* @function:
* FTC_SBitCache_Lookup
*
* @description:
* Look up a given small glyph bitmap in a given sbit cache and 'lock' it
* to prevent its flushing from the cache until needed.
*
* @input:
* cache ::
* A handle to the source sbit cache.
*
* type ::
* A pointer to the glyph image type descriptor.
*
* gindex ::
* The glyph index.
*
* @output:
* sbit ::
* A handle to a small bitmap descriptor.
*
* anode ::
* Used to return the address of the corresponding cache node after
* incrementing its reference count (see note below).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The small bitmap descriptor and its bit buffer are owned by the cache
* and should never be freed by the application. They might as well
* disappear from memory on the next cache lookup, so don't treat them as
* persistent data.
*
* The descriptor's `buffer` field is set to~0 to indicate a missing
* glyph bitmap.
*
* If `anode` is _not_ `NULL`, it receives the address of the cache node
* containing the bitmap, after increasing its reference count. This
* ensures that the node (as well as the image) will always be kept in
* the cache until you call @FTC_Node_Unref to 'release' it.
*
* If `anode` is `NULL`, the cache node is left unchanged, which means
* that the bitmap could be flushed out of the cache on the next call to
* one of the caching sub-system APIs. Don't assume that it is
* persistent!
*/
FT_EXPORT( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
/**************************************************************************
*
* @function:
* FTC_SBitCache_LookupScaler
*
* @description:
* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec to
* specify the face ID and its size.
*
* @input:
* cache ::
* A handle to the source sbit cache.
*
* scaler ::
* A pointer to the scaler descriptor.
*
* load_flags ::
* The corresponding load flags.
*
* gindex ::
* The glyph index.
*
* @output:
* sbit ::
* A handle to a small bitmap descriptor.
*
* anode ::
* Used to return the address of the corresponding cache node after
* incrementing its reference count (see note below).
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The small bitmap descriptor and its bit buffer are owned by the cache
* and should never be freed by the application. They might as well
* disappear from memory on the next cache lookup, so don't treat them as
* persistent data.
*
* The descriptor's `buffer` field is set to~0 to indicate a missing
* glyph bitmap.
*
* If `anode` is _not_ `NULL`, it receives the address of the cache node
* containing the bitmap, after increasing its reference count. This
* ensures that the node (as well as the image) will always be kept in
* the cache until you call @FTC_Node_Unref to 'release' it.
*
* If `anode` is `NULL`, the cache node is left unchanged, which means
* that the bitmap could be flushed out of the cache on the next call to
* one of the caching sub-system APIs. Don't assume that it is
* persistent!
*/
FT_EXPORT( FT_Error )
FTC_SBitCache_LookupScaler( FTC_SBitCache cache,
FTC_Scaler scaler,
FT_ULong load_flags,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
/* */
FT_END_HEADER
#endif /* FTCACHE_H_ */
/* END */
/****************************************************************************
*
* This file defines the structure of the FreeType reference.
* It is used by the python script that generates the HTML files.
*
*/
/**************************************************************************
*
* @chapter:
* general_remarks
*
* @title:
* General Remarks
*
* @sections:
* header_inclusion
* user_allocation
*
*/
/**************************************************************************
*
* @chapter:
* core_api
*
* @title:
* Core API
*
* @sections:
* version
* basic_types
* base_interface
* glyph_variants
* color_management
* layer_management
* glyph_management
* mac_specific
* sizes_management
* header_file_macros
*
*/
/**************************************************************************
*
* @chapter:
* format_specific
*
* @title:
* Format-Specific API
*
* @sections:
* multiple_masters
* truetype_tables
* type1_tables
* sfnt_names
* bdf_fonts
* cid_fonts
* pfr_fonts
* winfnt_fonts
* font_formats
* gasp_table
*
*/
/**************************************************************************
*
* @chapter:
* module_specific
*
* @title:
* Controlling FreeType Modules
*
* @sections:
* auto_hinter
* cff_driver
* t1_cid_driver
* tt_driver
* pcf_driver
* properties
* parameter_tags
* lcd_rendering
*
*/
/**************************************************************************
*
* @chapter:
* cache_subsystem
*
* @title:
* Cache Sub-System
*
* @sections:
* cache_subsystem
*
*/
/**************************************************************************
*
* @chapter:
* support_api
*
* @title:
* Support API
*
* @sections:
* computations
* list_processing
* outline_processing
* quick_advance
* bitmap_handling
* raster
* glyph_stroker
* system_interface
* module_management
* gzip
* lzw
* bzip2
*
*/
/**************************************************************************
*
* @chapter:
* error_codes
*
* @title:
* Error Codes
*
* @sections:
* error_enumerations
* error_code_values
*
*/
/* END */
/****************************************************************************
*
* ftcid.h
*
* FreeType API for accessing CID font information (specification).
*
* Copyright (C) 2007-2019 by
* Dereg Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTCID_H_
#define FTCID_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* cid_fonts
*
* @title:
* CID Fonts
*
* @abstract:
* CID-keyed font-specific API.
*
* @description:
* This section contains the declaration of CID-keyed font-specific
* functions.
*
*/
/**************************************************************************
*
* @function:
* FT_Get_CID_Registry_Ordering_Supplement
*
* @description:
* Retrieve the Registry/Ordering/Supplement triple (also known as the
* "R/O/S") from a CID-keyed font.
*
* @input:
* face ::
* A handle to the input face.
*
* @output:
* registry ::
* The registry, as a C~string, owned by the face.
*
* ordering ::
* The ordering, as a C~string, owned by the face.
*
* supplement ::
* The supplement.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces, returning an error
* otherwise.
*
* @since:
* 2.3.6
*/
FT_EXPORT( FT_Error )
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
const char* *registry,
const char* *ordering,
FT_Int *supplement );
/**************************************************************************
*
* @function:
* FT_Get_CID_Is_Internally_CID_Keyed
*
* @description:
* Retrieve the type of the input face, CID keyed or not. In contrast
* to the @FT_IS_CID_KEYED macro this function returns successfully also
* for CID-keyed fonts in an SFNT wrapper.
*
* @input:
* face ::
* A handle to the input face.
*
* @output:
* is_cid ::
* The type of the face as an @FT_Bool.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces and OpenType fonts, returning
* an error otherwise.
*
* @since:
* 2.3.9
*/
FT_EXPORT( FT_Error )
FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
FT_Bool *is_cid );
/**************************************************************************
*
* @function:
* FT_Get_CID_From_Glyph_Index
*
* @description:
* Retrieve the CID of the input glyph index.
*
* @input:
* face ::
* A handle to the input face.
*
* glyph_index ::
* The input glyph index.
*
* @output:
* cid ::
* The CID as an @FT_UInt.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function only works with CID faces and OpenType fonts, returning
* an error otherwise.
*
* @since:
* 2.3.9
*/
FT_EXPORT( FT_Error )
FT_Get_CID_From_Glyph_Index( FT_Face face,
FT_UInt glyph_index,
FT_UInt *cid );
/* */
FT_END_HEADER
#endif /* FTCID_H_ */
/* END */
/****************************************************************************
*
* ftcolor.h
*
* FreeType's glyph color management (specification).
*
* Copyright (C) 2018-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTCOLOR_H_
#define FTCOLOR_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* color_management
*
* @title:
* Glyph Color Management
*
* @abstract:
* Retrieving and manipulating OpenType's 'CPAL' table data.
*
* @description:
* The functions described here allow access and manipulation of color
* palette entries in OpenType's 'CPAL' tables.
*/
/**************************************************************************
*
* @struct:
* FT_Color
*
* @description:
* This structure models a BGRA color value of a 'CPAL' palette entry.
*
* The used color space is sRGB; the colors are not pre-multiplied, and
* alpha values must be explicitly set.
*
* @fields:
* blue ::
* Blue value.
*
* green ::
* Green value.
*
* red ::
* Red value.
*
* alpha ::
* Alpha value, giving the red, green, and blue color's opacity.
*
* @since:
* 2.10
*/
typedef struct FT_Color_
{
FT_Byte blue;
FT_Byte green;
FT_Byte red;
FT_Byte alpha;
} FT_Color;
/**************************************************************************
*
* @enum:
* FT_PALETTE_XXX
*
* @description:
* A list of bit field constants used in the `palette_flags` array of the
* @FT_Palette_Data structure to indicate for which background a palette
* with a given index is usable.
*
* @values:
* FT_PALETTE_FOR_LIGHT_BACKGROUND ::
* The palette is appropriate to use when displaying the font on a
* light background such as white.
*
* FT_PALETTE_FOR_DARK_BACKGROUND ::
* The palette is appropriate to use when displaying the font on a dark
* background such as black.
*
* @since:
* 2.10
*/
#define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01
#define FT_PALETTE_FOR_DARK_BACKGROUND 0x02
/**************************************************************************
*
* @struct:
* FT_Palette_Data
*
* @description:
* This structure holds the data of the 'CPAL' table.
*
* @fields:
* num_palettes ::
* The number of palettes.
*
* palette_name_ids ::
* A read-only array of palette name IDs with `num_palettes` elements,
* corresponding to entries like 'dark' or 'light' in the font's 'name'
* table.
*
* An empty name ID in the 'CPAL' table gets represented as value
* 0xFFFF.
*
* `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
*
* palette_flags ::
* A read-only array of palette flags with `num_palettes` elements.
* Possible values are an ORed combination of
* @FT_PALETTE_FOR_LIGHT_BACKGROUND and
* @FT_PALETTE_FOR_DARK_BACKGROUND.
*
* `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
*
* num_palette_entries ::
* The number of entries in a single palette. All palettes have the
* same size.
*
* palette_entry_name_ids ::
* A read-only array of palette entry name IDs with
* `num_palette_entries`. In each palette, entries with the same index
* have the same function. For example, index~0 might correspond to
* string 'outline' in the font's 'name' table to indicate that this
* palette entry is used for outlines, index~1 might correspond to
* 'fill' to indicate the filling color palette entry, etc.
*
* An empty entry name ID in the 'CPAL' table gets represented as value
* 0xFFFF.
*
* `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
*
* @note:
* Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to
* name strings.
*
* @since:
* 2.10
*/
typedef struct FT_Palette_Data_ {
FT_UShort num_palettes;
const FT_UShort* palette_name_ids;
const FT_UShort* palette_flags;
FT_UShort num_palette_entries;
const FT_UShort* palette_entry_name_ids;
} FT_Palette_Data;
/**************************************************************************
*
* @function:
* FT_Palette_Data_Get
*
* @description:
* Retrieve the face's color palette data.
*
* @input:
* face ::
* The source face handle.
*
* @output:
* apalette ::
* A pointer to an @FT_Palette_Data structure.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* All arrays in the returned @FT_Palette_Data structure are read-only.
*
* This function always returns an error if the config macro
* `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.
*
* @since:
* 2.10
*/
FT_EXPORT( FT_Error )
FT_Palette_Data_Get( FT_Face face,
FT_Palette_Data *apalette );
/**************************************************************************
*
* @function:
* FT_Palette_Select
*
* @description:
* This function has two purposes.
*
* (1) It activates a palette for rendering color glyphs, and
*
* (2) it retrieves all (unmodified) color entries of this palette. This
* function returns a read-write array, which means that a calling
* application can modify the palette entries on demand.
*
* A corollary of (2) is that calling the function, then modifying some
* values, then calling the function again with the same arguments resets
* all color entries to the original 'CPAL' values; all user modifications
* are lost.
*
* @input:
* face ::
* The source face handle.
*
* palette_index ::
* The palette index.
*
* @output:
* apalette ::
* An array of color entries for a palette with index `palette_index`,
* having `num_palette_entries` elements (as found in the
* `FT_Palette_Data` structure). If `apalette` is set to `NULL`, no
* array gets returned (and no color entries can be modified).
*
* In case the font doesn't support color palettes, `NULL` is returned.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The array pointed to by `apalette_entries` is owned and managed by
* FreeType.
*
* This function always returns an error if the config macro
* `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.
*
* @since:
* 2.10
*/
FT_EXPORT( FT_Error )
FT_Palette_Select( FT_Face face,
FT_UShort palette_index,
FT_Color* *apalette );
/**************************************************************************
*
* @function:
* FT_Palette_Set_Foreground_Color
*
* @description:
* 'COLR' uses palette index 0xFFFF to indicate a 'text foreground
* color'. This function sets this value.
*
* @input:
* face ::
* The source face handle.
*
* foreground_color ::
* An `FT_Color` structure to define the text foreground color.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* If this function isn't called, the text foreground color is set to
* white opaque (BGRA value 0xFFFFFFFF) if
* @FT_PALETTE_FOR_DARK_BACKGROUND is present for the current palette,
* and black opaque (BGRA value 0x000000FF) otherwise, including the case
* that no palette types are available in the 'CPAL' table.
*
* This function always returns an error if the config macro
* `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.
*
* @since:
* 2.10
*/
FT_EXPORT( FT_Error )
FT_Palette_Set_Foreground_Color( FT_Face face,
FT_Color foreground_color );
/* */
FT_END_HEADER
#endif /* FTCOLOR_H_ */
/* END */
/****************************************************************************
*
* ftdriver.h
*
* FreeType API for controlling driver modules (specification only).
*
* Copyright (C) 2017-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTDRIVER_H_
#define FTDRIVER_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_PARAMETER_TAGS_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* auto_hinter
*
* @title:
* The auto-hinter
*
* @abstract:
* Controlling the auto-hinting module.
*
* @description:
* While FreeType's auto-hinter doesn't expose API functions by itself,
* it is possible to control its behaviour with @FT_Property_Set and
* @FT_Property_Get. The following lists the available properties
* together with the necessary macros and structures.
*
* Note that the auto-hinter's module name is 'autofitter' for historical
* reasons.
*
* Available properties are @increase-x-height, @no-stem-darkening
* (experimental), @darkening-parameters (experimental), @warping
* (experimental), @glyph-to-script-map (experimental), @fallback-script
* (experimental), and @default-script (experimental), as documented in
* the @properties section.
*
*/
/**************************************************************************
*
* @section:
* cff_driver
*
* @title:
* The CFF driver
*
* @abstract:
* Controlling the CFF driver module.
*
* @description:
* While FreeType's CFF driver doesn't expose API functions by itself, it
* is possible to control its behaviour with @FT_Property_Set and
* @FT_Property_Get.
*
* The CFF driver's module name is 'cff'.
*
* Available properties are @hinting-engine, @no-stem-darkening,
* @darkening-parameters, and @random-seed, as documented in the
* @properties section.
*
*
* **Hinting and antialiasing principles of the new engine**
*
* The rasterizer is positioning horizontal features (e.g., ascender
* height & x-height, or crossbars) on the pixel grid and minimizing the
* amount of antialiasing applied to them, while placing vertical
* features (vertical stems) on the pixel grid without hinting, thus
* representing the stem position and weight accurately. Sometimes the
* vertical stems may be only partially black. In this context,
* 'antialiasing' means that stems are not positioned exactly on pixel
* borders, causing a fuzzy appearance.
*
* There are two principles behind this approach.
*
* 1) No hinting in the horizontal direction: Unlike 'superhinted'
* TrueType, which changes glyph widths to accommodate regular
* inter-glyph spacing, Adobe's approach is 'faithful to the design' in
* representing both the glyph width and the inter-glyph spacing designed
* for the font. This makes the screen display as close as it can be to
* the result one would get with infinite resolution, while preserving
* what is considered the key characteristics of each glyph. Note that
* the distances between unhinted and grid-fitted positions at small
* sizes are comparable to kerning values and thus would be noticeable
* (and distracting) while reading if hinting were applied.
*
* One of the reasons to not hint horizontally is antialiasing for LCD
* screens: The pixel geometry of modern displays supplies three vertical
* subpixels as the eye moves horizontally across each visible pixel. On
* devices where we can be certain this characteristic is present a
* rasterizer can take advantage of the subpixels to add increments of
* weight. In Western writing systems this turns out to be the more
* critical direction anyway; the weights and spacing of vertical stems
* (see above) are central to Armenian, Cyrillic, Greek, and Latin type
* designs. Even when the rasterizer uses greyscale antialiasing instead
* of color (a necessary compromise when one doesn't know the screen
* characteristics), the unhinted vertical features preserve the design's
* weight and spacing much better than aliased type would.
*
* 2) Alignment in the vertical direction: Weights and spacing along the
* y~axis are less critical; what is much more important is the visual
* alignment of related features (like cap-height and x-height). The
* sense of alignment for these is enhanced by the sharpness of grid-fit
* edges, while the cruder vertical resolution (full pixels instead of
* 1/3 pixels) is less of a problem.
*
* On the technical side, horizontal alignment zones for ascender,
* x-height, and other important height values (traditionally called
* 'blue zones') as defined in the font are positioned independently,
* each being rounded to the nearest pixel edge, taking care of overshoot
* suppression at small sizes, stem darkening, and scaling.
*
* Hstems (this is, hint values defined in the font to help align
* horizontal features) that fall within a blue zone are said to be
* 'captured' and are aligned to that zone. Uncaptured stems are moved
* in one of four ways, top edge up or down, bottom edge up or down.
* Unless there are conflicting hstems, the smallest movement is taken to
* minimize distortion.
*
*/
/**************************************************************************
*
* @section:
* pcf_driver
*
* @title:
* The PCF driver
*
* @abstract:
* Controlling the PCF driver module.
*
* @description:
* While FreeType's PCF driver doesn't expose API functions by itself, it
* is possible to control its behaviour with @FT_Property_Set and
* @FT_Property_Get. Right now, there is a single property
* @no-long-family-names available if FreeType is compiled with
* PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.
*
* The PCF driver's module name is 'pcf'.
*
*/
/**************************************************************************
*
* @section:
* t1_cid_driver
*
* @title:
* The Type 1 and CID drivers
*
* @abstract:
* Controlling the Type~1 and CID driver modules.
*
* @description:
* It is possible to control the behaviour of FreeType's Type~1 and
* Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get.
*
* Behind the scenes, both drivers use the Adobe CFF engine for hinting;
* however, the used properties must be specified separately.
*
* The Type~1 driver's module name is 'type1'; the CID driver's module
* name is 't1cid'.
*
* Available properties are @hinting-engine, @no-stem-darkening,
* @darkening-parameters, and @random-seed, as documented in the
* @properties section.
*
* Please see the @cff_driver section for more details on the new hinting
* engine.
*
*/
/**************************************************************************
*
* @section:
* tt_driver
*
* @title:
* The TrueType driver
*
* @abstract:
* Controlling the TrueType driver module.
*
* @description:
* While FreeType's TrueType driver doesn't expose API functions by
* itself, it is possible to control its behaviour with @FT_Property_Set
* and @FT_Property_Get. The following lists the available properties
* together with the necessary macros and structures.
*
* The TrueType driver's module name is 'truetype'.
*
* A single property @interpreter-version is available, as documented in
* the @properties section.
*
* We start with a list of definitions, kindly provided by Greg
* Hitchcock.
*
* _Bi-Level Rendering_
*
* Monochromatic rendering, exclusively used in the early days of
* TrueType by both Apple and Microsoft. Microsoft's GDI interface
* supported hinting of the right-side bearing point, such that the
* advance width could be non-linear. Most often this was done to
* achieve some level of glyph symmetry. To enable reasonable
* performance (e.g., not having to run hinting on all glyphs just to get
* the widths) there was a bit in the head table indicating if the side
* bearing was hinted, and additional tables, 'hdmx' and 'LTSH', to cache
* hinting widths across multiple sizes and device aspect ratios.
*
* _Font Smoothing_
*
* Microsoft's GDI implementation of anti-aliasing. Not traditional
* anti-aliasing as the outlines were hinted before the sampling. The
* widths matched the bi-level rendering.
*
* _ClearType Rendering_
*
* Technique that uses physical subpixels to improve rendering on LCD
* (and other) displays. Because of the higher resolution, many methods
* of improving symmetry in glyphs through hinting the right-side bearing
* were no longer necessary. This lead to what GDI calls 'natural
* widths' ClearType, see
* http://rastertragedy.com/RTRCh4.htm#Sec21. Since hinting
* has extra resolution, most non-linearity went away, but it is still
* possible for hints to change the advance widths in this mode.
*
* _ClearType Compatible Widths_
*
* One of the earliest challenges with ClearType was allowing the
* implementation in GDI to be selected without requiring all UI and
* documents to reflow. To address this, a compatible method of
* rendering ClearType was added where the font hints are executed once
* to determine the width in bi-level rendering, and then re-run in
* ClearType, with the difference in widths being absorbed in the font
* hints for ClearType (mostly in the white space of hints); see
* http://rastertragedy.com/RTRCh4.htm#Sec20. Somewhat by
* definition, compatible width ClearType allows for non-linear widths,
* but only when the bi-level version has non-linear widths.
*
* _ClearType Subpixel Positioning_
*
* One of the nice benefits of ClearType is the ability to more crisply
* display fractional widths; unfortunately, the GDI model of integer
* bitmaps did not support this. However, the WPF and Direct Write
* frameworks do support fractional widths. DWrite calls this 'natural
* mode', not to be confused with GDI's 'natural widths'. Subpixel
* positioning, in the current implementation of Direct Write,
* unfortunately does not support hinted advance widths, see
* http://rastertragedy.com/RTRCh4.htm#Sec22. Note that the
* TrueType interpreter fully allows the advance width to be adjusted in
* this mode, just the DWrite client will ignore those changes.
*
* _ClearType Backward Compatibility_
*
* This is a set of exceptions made in the TrueType interpreter to
* minimize hinting techniques that were problematic with the extra
* resolution of ClearType; see
* http://rastertragedy.com/RTRCh4.htm#Sec1 and
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx.
* This technique is not to be confused with ClearType compatible widths.
* ClearType backward compatibility has no direct impact on changing
* advance widths, but there might be an indirect impact on disabling
* some deltas. This could be worked around in backward compatibility
* mode.
*
* _Native ClearType Mode_
*
* (Not to be confused with 'natural widths'.) This mode removes all the
* exceptions in the TrueType interpreter when running with ClearType.
* Any issues on widths would still apply, though.
*
*/
/**************************************************************************
*
* @section:
* properties
*
* @title:
* Driver properties
*
* @abstract:
* Controlling driver modules.
*
* @description:
* Driver modules can be controlled by setting and unsetting properties,
* using the functions @FT_Property_Set and @FT_Property_Get. This
* section documents the available properties, together with auxiliary
* macros and structures.
*
*/
/**************************************************************************
*
* @enum:
* FT_HINTING_XXX
*
* @description:
* A list of constants used for the @hinting-engine property to select
* the hinting engine for CFF, Type~1, and CID fonts.
*
* @values:
* FT_HINTING_FREETYPE ::
* Use the old FreeType hinting engine.
*
* FT_HINTING_ADOBE ::
* Use the hinting engine contributed by Adobe.
*
* @since:
* 2.9
*
*/
#define FT_HINTING_FREETYPE 0
#define FT_HINTING_ADOBE 1
/* these constants (introduced in 2.4.12) are deprecated */
#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE
#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE
/**************************************************************************
*
* @property:
* hinting-engine
*
* @description:
* Thanks to Adobe, which contributed a new hinting (and parsing) engine,
* an application can select between 'freetype' and 'adobe' if compiled
* with `CFF_CONFIG_OPTION_OLD_ENGINE`. If this configuration macro
* isn't defined, 'hinting-engine' does nothing.
*
* The same holds for the Type~1 and CID modules if compiled with
* `T1_CONFIG_OPTION_OLD_ENGINE`.
*
* For the 'cff' module, the default engine is 'freetype' if
* `CFF_CONFIG_OPTION_OLD_ENGINE` is defined, and 'adobe' otherwise.
*
* For both the 'type1' and 't1cid' modules, the default engine is
* 'freetype' if `T1_CONFIG_OPTION_OLD_ENGINE` is defined, and 'adobe'
* otherwise.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable (using values 'adobe' or 'freetype').
*
* @example:
* The following example code demonstrates how to select Adobe's hinting
* engine for the 'cff' module (omitting the error handling).
*
* ```
* FT_Library library;
* FT_UInt hinting_engine = FT_HINTING_ADOBE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "cff",
* "hinting-engine", &hinting_engine );
* ```
*
* @since:
* 2.4.12 (for 'cff' module)
*
* 2.9 (for 'type1' and 't1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* no-stem-darkening
*
* @description:
* All glyphs that pass through the auto-hinter will be emboldened unless
* this property is set to TRUE. The same is true for the CFF, Type~1,
* and CID font modules if the 'Adobe' engine is selected (which is the
* default).
*
* Stem darkening emboldens glyphs at smaller sizes to make them more
* readable on common low-DPI screens when using linear alpha blending
* and gamma correction, see @FT_Render_Glyph. When not using linear
* alpha blending and gamma correction, glyphs will appear heavy and
* fuzzy!
*
* Gamma correction essentially lightens fonts since shades of grey are
* shifted to higher pixel values (=~higher brightness) to match the
* original intention to the reality of our screens. The side-effect is
* that glyphs 'thin out'. Mac OS~X and Adobe's proprietary font
* rendering library implement a counter-measure: stem darkening at
* smaller sizes where shades of gray dominate. By emboldening a glyph
* slightly in relation to its pixel size, individual pixels get higher
* coverage of filled-in outlines and are therefore 'blacker'. This
* counteracts the 'thinning out' of glyphs, making text remain readable
* at smaller sizes.
*
* By default, the Adobe engines for CFF, Type~1, and CID fonts darken
* stems at smaller sizes, regardless of hinting, to enhance contrast.
* Setting this property, stem darkening gets switched off.
*
* For the auto-hinter, stem-darkening is experimental currently and thus
* switched off by default (this is, `no-stem-darkening` is set to TRUE
* by default). Total consistency with the CFF driver is not achieved
* right now because the emboldening method differs and glyphs must be
* scaled down on the Y-axis to keep outline points inside their
* precomputed blue zones. The smaller the size (especially 9ppem and
* down), the higher the loss of emboldening versus the CFF driver.
*
* Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable (using values 1 and 0 for 'on' and 'off', respectively). It
* can also be set per face using @FT_Face_Properties with
* @FT_PARAM_TAG_STEM_DARKENING.
*
* @example:
* ```
* FT_Library library;
* FT_Bool no_stem_darkening = TRUE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "cff",
* "no-stem-darkening", &no_stem_darkening );
* ```
*
* @since:
* 2.4.12 (for 'cff' module)
*
* 2.6.2 (for 'autofitter' module)
*
* 2.9 (for 'type1' and 't1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* darkening-parameters
*
* @description:
* By default, the Adobe hinting engine, as used by the CFF, Type~1, and
* CID font drivers, darkens stems as follows (if the `no-stem-darkening`
* property isn't set):
*
* ```
* stem width <= 0.5px: darkening amount = 0.4px
* stem width = 1px: darkening amount = 0.275px
* stem width = 1.667px: darkening amount = 0.275px
* stem width >= 2.333px: darkening amount = 0px
* ```
*
* and piecewise linear in-between. At configuration time, these four
* control points can be set with the macro
* `CFF_CONFIG_OPTION_DARKENING_PARAMETERS`; the CFF, Type~1, and CID
* drivers share these values. At runtime, the control points can be
* changed using the `darkening-parameters` property (see the example
* below that demonstrates this for the Type~1 driver).
*
* The x~values give the stem width, and the y~values the darkening
* amount. The unit is 1000th of pixels. All coordinate values must be
* positive; the x~values must be monotonically increasing; the y~values
* must be monotonically decreasing and smaller than or equal to 500
* (corresponding to half a pixel); the slope of each linear piece must
* be shallower than -1 (e.g., -.4).
*
* The auto-hinter provides this property, too, as an experimental
* feature. See @no-stem-darkening for more.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable, using eight comma-separated integers without spaces. Here
* the above example, using `\` to break the line for readability.
*
* ```
* FREETYPE_PROPERTIES=\
* type1:darkening-parameters=500,300,1000,200,1500,100,2000,0
* ```
*
* @example:
* ```
* FT_Library library;
* FT_Int darken_params[8] = { 500, 300, // x1, y1
* 1000, 200, // x2, y2
* 1500, 100, // x3, y3
* 2000, 0 }; // x4, y4
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "type1",
* "darkening-parameters", darken_params );
* ```
*
* @since:
* 2.5.1 (for 'cff' module)
*
* 2.6.2 (for 'autofitter' module)
*
* 2.9 (for 'type1' and 't1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* random-seed
*
* @description:
* By default, the seed value for the CFF 'random' operator and the
* similar '0 28 callothersubr pop' command for the Type~1 and CID
* drivers is set to a random value. However, mainly for debugging
* purposes, it is often necessary to use a known value as a seed so that
* the pseudo-random number sequences generated by 'random' are
* repeatable.
*
* The `random-seed` property does that. Its argument is a signed 32bit
* integer; if the value is zero or negative, the seed given by the
* `intitialRandomSeed` private DICT operator in a CFF file gets used (or
* a default value if there is no such operator). If the value is
* positive, use it instead of `initialRandomSeed`, which is consequently
* ignored.
*
* @note:
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable. It can also be set per face using @FT_Face_Properties with
* @FT_PARAM_TAG_RANDOM_SEED.
*
* @since:
* 2.8 (for 'cff' module)
*
* 2.9 (for 'type1' and 't1cid' modules)
*
*/
/**************************************************************************
*
* @property:
* no-long-family-names
*
* @description:
* If `PCF_CONFIG_OPTION_LONG_FAMILY_NAMES` is active while compiling
* FreeType, the PCF driver constructs long family names.
*
* There are many PCF fonts just called 'Fixed' which look completely
* different, and which have nothing to do with each other. When
* selecting 'Fixed' in KDE or Gnome one gets results that appear rather
* random, the style changes often if one changes the size and one cannot
* select some fonts at all. The improve this situation, the PCF module
* prepends the foundry name (plus a space) to the family name. It also
* checks whether there are 'wide' characters; all put together, family
* names like 'Sony Fixed' or 'Misc Fixed Wide' are constructed.
*
* If `no-long-family-names` is set, this feature gets switched off.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable (using values 1 and 0 for 'on' and 'off', respectively).
*
* @example:
* ```
* FT_Library library;
* FT_Bool no_long_family_names = TRUE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "pcf",
* "no-long-family-names",
* &no_long_family_names );
* ```
*
* @since:
* 2.8
*/
/**************************************************************************
*
* @enum:
* TT_INTERPRETER_VERSION_XXX
*
* @description:
* A list of constants used for the @interpreter-version property to
* select the hinting engine for Truetype fonts.
*
* The numeric value in the constant names represents the version number
* as returned by the 'GETINFO' bytecode instruction.
*
* @values:
* TT_INTERPRETER_VERSION_35 ::
* Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in
* Windows~98; only grayscale and B/W rasterizing is supported.
*
* TT_INTERPRETER_VERSION_38 ::
* Version~38 corresponds to MS rasterizer v.1.9; it is roughly
* equivalent to the hinting provided by DirectWrite ClearType (as can
* be found, for example, in the Internet Explorer~9 running on
* Windows~7). It is used in FreeType to select the 'Infinality'
* subpixel hinting code. The code may be removed in a future version.
*
* TT_INTERPRETER_VERSION_40 ::
* Version~40 corresponds to MS rasterizer v.2.1; it is roughly
* equivalent to the hinting provided by DirectWrite ClearType (as can
* be found, for example, in Microsoft's Edge Browser on Windows~10).
* It is used in FreeType to select the 'minimal' subpixel hinting
* code, a stripped-down and higher performance version of the
* 'Infinality' code.
*
* @note:
* This property controls the behaviour of the bytecode interpreter and
* thus how outlines get hinted. It does **not** control how glyph get
* rasterized! In particular, it does not control subpixel color
* filtering.
*
* If FreeType has not been compiled with the configuration option
* `TT_CONFIG_OPTION_SUBPIXEL_HINTING`, selecting version~38 or~40 causes
* an `FT_Err_Unimplemented_Feature` error.
*
* Depending on the graphics framework, Microsoft uses different bytecode
* and rendering engines. As a consequence, the version numbers returned
* by a call to the 'GETINFO' bytecode instruction are more convoluted
* than desired.
*
* Here are two tables that try to shed some light on the possible values
* for the MS rasterizer engine, together with the additional features
* introduced by it.
*
* ```
* GETINFO framework version feature
* -------------------------------------------------------------------
* 3 GDI (Win 3.1), v1.0 16-bit, first version
* TrueImage
* 33 GDI (Win NT 3.1), v1.5 32-bit
* HP Laserjet
* 34 GDI (Win 95) v1.6 font smoothing,
* new SCANTYPE opcode
* 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET
* bits in composite glyphs
* 36 MGDI (Win CE 2) v1.6+ classic ClearType
* 37 GDI (XP and later), v1.8 ClearType
* GDI+ old (before Vista)
* 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType,
* WPF Y-direction ClearType,
* additional error checking
* 39 DWrite (before Win 8) v2.0 subpixel ClearType flags
* in GETINFO opcode,
* bug fixes
* 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag
* DWrite (Win 8) in GETINFO opcode,
* Gray ClearType
* ```
*
* The 'version' field gives a rough orientation only, since some
* applications provided certain features much earlier (as an example,
* Microsoft Reader used subpixel and Y-direction ClearType already in
* Windows 2000). Similarly, updates to a given framework might include
* improved hinting support.
*
* ```
* version sampling rendering comment
* x y x y
* --------------------------------------------------------------
* v1.0 normal normal B/W B/W bi-level
* v1.6 high high gray gray grayscale
* v1.8 high normal color-filter B/W (GDI) ClearType
* v1.9 high high color-filter gray Color ClearType
* v2.1 high normal gray B/W Gray ClearType
* v2.1 high high gray gray Gray ClearType
* ```
*
* Color and Gray ClearType are the two available variants of
* 'Y-direction ClearType', meaning grayscale rasterization along the
* Y-direction; the name used in the TrueType specification for this
* feature is 'symmetric smoothing'. 'Classic ClearType' is the original
* algorithm used before introducing a modified version in Win~XP.
* Another name for v1.6's grayscale rendering is 'font smoothing', and
* 'Color ClearType' is sometimes also called 'DWrite ClearType'. To
* differentiate between today's Color ClearType and the earlier
* ClearType variant with B/W rendering along the vertical axis, the
* latter is sometimes called 'GDI ClearType'.
*
* 'Normal' and 'high' sampling describe the (virtual) resolution to
* access the rasterized outline after the hinting process. 'Normal'
* means 1 sample per grid line (i.e., B/W). In the current Microsoft
* implementation, 'high' means an extra virtual resolution of 16x16 (or
* 16x1) grid lines per pixel for bytecode instructions like 'MIRP'.
* After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid
* lines for color filtering if Color ClearType is activated.
*
* Note that 'Gray ClearType' is essentially the same as v1.6's grayscale
* rendering. However, the GETINFO instruction handles it differently:
* v1.6 returns bit~12 (hinting for grayscale), while v2.1 returns
* bits~13 (hinting for ClearType), 18 (symmetrical smoothing), and~19
* (Gray ClearType). Also, this mode respects bits 2 and~3 for the
* version~1 gasp table exclusively (like Color ClearType), while v1.6
* only respects the values of version~0 (bits 0 and~1).
*
* Keep in mind that the features of the above interpreter versions might
* not map exactly to FreeType features or behavior because it is a
* fundamentally different library with different internals.
*
*/
#define TT_INTERPRETER_VERSION_35 35
#define TT_INTERPRETER_VERSION_38 38
#define TT_INTERPRETER_VERSION_40 40
/**************************************************************************
*
* @property:
* interpreter-version
*
* @description:
* Currently, three versions are available, two representing the bytecode
* interpreter with subpixel hinting support (old 'Infinality' code and
* new stripped-down and higher performance 'minimal' code) and one
* without, respectively. The default is subpixel support if
* `TT_CONFIG_OPTION_SUBPIXEL_HINTING` is defined, and no subpixel
* support otherwise (since it isn't available then).
*
* If subpixel hinting is on, many TrueType bytecode instructions behave
* differently compared to B/W or grayscale rendering (except if 'native
* ClearType' is selected by the font). Microsoft's main idea is to
* render at a much increased horizontal resolution, then sampling down
* the created output to subpixel precision. However, many older fonts
* are not suited to this and must be specially taken care of by applying
* (hardcoded) tweaks in Microsoft's interpreter.
*
* Details on subpixel hinting and some of the necessary tweaks can be
* found in Greg Hitchcock's whitepaper at
* 'https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.
* Note that FreeType currently doesn't really 'subpixel hint' (6x1, 6x2,
* or 6x5 supersampling) like discussed in the paper. Depending on the
* chosen interpreter, it simply ignores instructions on vertical stems
* to arrive at very similar results.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable (using values '35', '38', or '40').
*
* @example:
* The following example code demonstrates how to deactivate subpixel
* hinting (omitting the error handling).
*
* ```
* FT_Library library;
* FT_Face face;
* FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "truetype",
* "interpreter-version",
* &interpreter_version );
* ```
*
* @since:
* 2.5
*/
/**************************************************************************
*
* @property:
* glyph-to-script-map
*
* @description:
* **Experimental only**
*
* The auto-hinter provides various script modules to hint glyphs.
* Examples of supported scripts are Latin or CJK. Before a glyph is
* auto-hinted, the Unicode character map of the font gets examined, and
* the script is then determined based on Unicode character ranges, see
* below.
*
* OpenType fonts, however, often provide much more glyphs than character
* codes (small caps, superscripts, ligatures, swashes, etc.), to be
* controlled by so-called 'features'. Handling OpenType features can be
* quite complicated and thus needs a separate library on top of
* FreeType.
*
* The mapping between glyph indices and scripts (in the auto-hinter
* sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an array
* with `num_glyphs` elements, as found in the font's @FT_Face structure.
* The `glyph-to-script-map` property returns a pointer to this array,
* which can be modified as needed. Note that the modification should
* happen before the first glyph gets processed by the auto-hinter so
* that the global analysis of the font shapes actually uses the modified
* mapping.
*
* @example:
* The following example code demonstrates how to access it (omitting the
* error handling).
*
* ```
* FT_Library library;
* FT_Face face;
* FT_Prop_GlyphToScriptMap prop;
*
*
* FT_Init_FreeType( &library );
* FT_New_Face( library, "foo.ttf", 0, &face );
*
* prop.face = face;
*
* FT_Property_Get( library, "autofitter",
* "glyph-to-script-map", &prop );
*
* // adjust `prop.map' as needed right here
*
* FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );
* ```
*
* @since:
* 2.4.11
*
*/
/**************************************************************************
*
* @enum:
* FT_AUTOHINTER_SCRIPT_XXX
*
* @description:
* **Experimental only**
*
* A list of constants used for the @glyph-to-script-map property to
* specify the script submodule the auto-hinter should use for hinting a
* particular glyph.
*
* @values:
* FT_AUTOHINTER_SCRIPT_NONE ::
* Don't auto-hint this glyph.
*
* FT_AUTOHINTER_SCRIPT_LATIN ::
* Apply the latin auto-hinter. For the auto-hinter, 'latin' is a very
* broad term, including Cyrillic and Greek also since characters from
* those scripts share the same design constraints.
*
* By default, characters from the following Unicode ranges are
* assigned to this submodule.
*
* ```
* U+0020 - U+007F // Basic Latin (no control characters)
* U+00A0 - U+00FF // Latin-1 Supplement (no control characters)
* U+0100 - U+017F // Latin Extended-A
* U+0180 - U+024F // Latin Extended-B
* U+0250 - U+02AF // IPA Extensions
* U+02B0 - U+02FF // Spacing Modifier Letters
* U+0300 - U+036F // Combining Diacritical Marks
* U+0370 - U+03FF // Greek and Coptic
* U+0400 - U+04FF // Cyrillic
* U+0500 - U+052F // Cyrillic Supplement
* U+1D00 - U+1D7F // Phonetic Extensions
* U+1D80 - U+1DBF // Phonetic Extensions Supplement
* U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement
* U+1E00 - U+1EFF // Latin Extended Additional
* U+1F00 - U+1FFF // Greek Extended
* U+2000 - U+206F // General Punctuation
* U+2070 - U+209F // Superscripts and Subscripts
* U+20A0 - U+20CF // Currency Symbols
* U+2150 - U+218F // Number Forms
* U+2460 - U+24FF // Enclosed Alphanumerics
* U+2C60 - U+2C7F // Latin Extended-C
* U+2DE0 - U+2DFF // Cyrillic Extended-A
* U+2E00 - U+2E7F // Supplemental Punctuation
* U+A640 - U+A69F // Cyrillic Extended-B
* U+A720 - U+A7FF // Latin Extended-D
* U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures)
* U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols
* U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement
* ```
*
* FT_AUTOHINTER_SCRIPT_CJK ::
* Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old
* Vietnamese, and some other scripts.
*
* By default, characters from the following Unicode ranges are
* assigned to this submodule.
*
* ```
* U+1100 - U+11FF // Hangul Jamo
* U+2E80 - U+2EFF // CJK Radicals Supplement
* U+2F00 - U+2FDF // Kangxi Radicals
* U+2FF0 - U+2FFF // Ideographic Description Characters
* U+3000 - U+303F // CJK Symbols and Punctuation
* U+3040 - U+309F // Hiragana
* U+30A0 - U+30FF // Katakana
* U+3100 - U+312F // Bopomofo
* U+3130 - U+318F // Hangul Compatibility Jamo
* U+3190 - U+319F // Kanbun
* U+31A0 - U+31BF // Bopomofo Extended
* U+31C0 - U+31EF // CJK Strokes
* U+31F0 - U+31FF // Katakana Phonetic Extensions
* U+3200 - U+32FF // Enclosed CJK Letters and Months
* U+3300 - U+33FF // CJK Compatibility
* U+3400 - U+4DBF // CJK Unified Ideographs Extension A
* U+4DC0 - U+4DFF // Yijing Hexagram Symbols
* U+4E00 - U+9FFF // CJK Unified Ideographs
* U+A960 - U+A97F // Hangul Jamo Extended-A
* U+AC00 - U+D7AF // Hangul Syllables
* U+D7B0 - U+D7FF // Hangul Jamo Extended-B
* U+F900 - U+FAFF // CJK Compatibility Ideographs
* U+FE10 - U+FE1F // Vertical forms
* U+FE30 - U+FE4F // CJK Compatibility Forms
* U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms
* U+1B000 - U+1B0FF // Kana Supplement
* U+1D300 - U+1D35F // Tai Xuan Hing Symbols
* U+1F200 - U+1F2FF // Enclosed Ideographic Supplement
* U+20000 - U+2A6DF // CJK Unified Ideographs Extension B
* U+2A700 - U+2B73F // CJK Unified Ideographs Extension C
* U+2B740 - U+2B81F // CJK Unified Ideographs Extension D
* U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement
* ```
*
* FT_AUTOHINTER_SCRIPT_INDIC ::
* Apply the indic auto-hinter, covering all major scripts from the
* Indian sub-continent and some other related scripts like Thai, Lao,
* or Tibetan.
*
* By default, characters from the following Unicode ranges are
* assigned to this submodule.
*
* ```
* U+0900 - U+0DFF // Indic Range
* U+0F00 - U+0FFF // Tibetan
* U+1900 - U+194F // Limbu
* U+1B80 - U+1BBF // Sundanese
* U+A800 - U+A82F // Syloti Nagri
* U+ABC0 - U+ABFF // Meetei Mayek
* U+11800 - U+118DF // Sharada
* ```
*
* Note that currently Indic support is rudimentary only, missing blue
* zone support.
*
* @since:
* 2.4.11
*
*/
#define FT_AUTOHINTER_SCRIPT_NONE 0
#define FT_AUTOHINTER_SCRIPT_LATIN 1
#define FT_AUTOHINTER_SCRIPT_CJK 2
#define FT_AUTOHINTER_SCRIPT_INDIC 3
/**************************************************************************
*
* @struct:
* FT_Prop_GlyphToScriptMap
*
* @description:
* **Experimental only**
*
* The data exchange structure for the @glyph-to-script-map property.
*
* @since:
* 2.4.11
*
*/
typedef struct FT_Prop_GlyphToScriptMap_
{
FT_Face face;
FT_UShort* map;
} FT_Prop_GlyphToScriptMap;
/**************************************************************************
*
* @property:
* fallback-script
*
* @description:
* **Experimental only**
*
* If no auto-hinter script module can be assigned to a glyph, a fallback
* script gets assigned to it (see also the @glyph-to-script-map
* property). By default, this is @FT_AUTOHINTER_SCRIPT_CJK. Using the
* `fallback-script` property, this fallback value can be changed.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* It's important to use the right timing for changing this value: The
* creation of the glyph-to-script map that eventually uses the fallback
* script value gets triggered either by setting or reading a
* face-specific property like @glyph-to-script-map, or by auto-hinting
* any glyph from that face. In particular, if you have already created
* an @FT_Face structure but not loaded any glyph (using the
* auto-hinter), a change of the fallback script will affect this face.
*
* @example:
* ```
* FT_Library library;
* FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "autofitter",
* "fallback-script", &fallback_script );
* ```
*
* @since:
* 2.4.11
*
*/
/**************************************************************************
*
* @property:
* default-script
*
* @description:
* **Experimental only**
*
* If FreeType gets compiled with `FT_CONFIG_OPTION_USE_HARFBUZZ` to make
* the HarfBuzz library access OpenType features for getting better glyph
* coverages, this property sets the (auto-fitter) script to be used for
* the default (OpenType) script data of a font's GSUB table. Features
* for the default script are intended for all scripts not explicitly
* handled in GSUB; an example is a 'dlig' feature, containing the
* combination of the characters 'T', 'E', and 'L' to form a 'TEL'
* ligature.
*
* By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the
* `default-script` property, this default value can be changed.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* It's important to use the right timing for changing this value: The
* creation of the glyph-to-script map that eventually uses the default
* script value gets triggered either by setting or reading a
* face-specific property like @glyph-to-script-map, or by auto-hinting
* any glyph from that face. In particular, if you have already created
* an @FT_Face structure but not loaded any glyph (using the
* auto-hinter), a change of the default script will affect this face.
*
* @example:
* ```
* FT_Library library;
* FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "autofitter",
* "default-script", &default_script );
* ```
*
* @since:
* 2.5.3
*
*/
/**************************************************************************
*
* @property:
* increase-x-height
*
* @description:
* For ppem values in the range 6~<= ppem <= `increase-x-height`, round
* up the font's x~height much more often than normally. If the value is
* set to~0, which is the default, this feature is switched off. Use
* this property to improve the legibility of small font sizes if
* necessary.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* Set this value right after calling @FT_Set_Char_Size, but before
* loading any glyph (using the auto-hinter).
*
* @example:
* ```
* FT_Library library;
* FT_Face face;
* FT_Prop_IncreaseXHeight prop;
*
*
* FT_Init_FreeType( &library );
* FT_New_Face( library, "foo.ttf", 0, &face );
* FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );
*
* prop.face = face;
* prop.limit = 14;
*
* FT_Property_Set( library, "autofitter",
* "increase-x-height", &prop );
* ```
*
* @since:
* 2.4.11
*
*/
/**************************************************************************
*
* @struct:
* FT_Prop_IncreaseXHeight
*
* @description:
* The data exchange structure for the @increase-x-height property.
*
*/
typedef struct FT_Prop_IncreaseXHeight_
{
FT_Face face;
FT_UInt limit;
} FT_Prop_IncreaseXHeight;
/**************************************************************************
*
* @property:
* warping
*
* @description:
* **Experimental only**
*
* If FreeType gets compiled with option `AF_CONFIG_OPTION_USE_WARPER` to
* activate the warp hinting code in the auto-hinter, this property
* switches warping on and off.
*
* Warping only works in 'normal' auto-hinting mode replacing it. The
* idea of the code is to slightly scale and shift a glyph along the
* non-hinted dimension (which is usually the horizontal axis) so that as
* much of its segments are aligned (more or less) to the grid. To find
* out a glyph's optimal scaling and shifting value, various parameter
* combinations are tried and scored.
*
* By default, warping is off.
*
* @note:
* This property can be used with @FT_Property_Get also.
*
* This property can be set via the `FREETYPE_PROPERTIES` environment
* variable (using values 1 and 0 for 'on' and 'off', respectively).
*
* The warping code can also change advance widths. Have a look at the
* `lsb_delta` and `rsb_delta` fields in the @FT_GlyphSlotRec structure
* for details on improving inter-glyph distances while rendering.
*
* Since warping is a global property of the auto-hinter it is best to
* change its value before rendering any face. Otherwise, you should
* reload all faces that get auto-hinted in 'normal' hinting mode.
*
* @example:
* This example shows how to switch on warping (omitting the error
* handling).
*
* ```
* FT_Library library;
* FT_Bool warping = 1;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "autofitter", "warping", &warping );
* ```
*
* @since:
* 2.6
*
*/
/* */
FT_END_HEADER
#endif /* FTDRIVER_H_ */
/* END */
/***************************************************************************/ /****************************************************************************
/* */ *
/* fterrdef.h */ * fterrdef.h
/* */ *
/* FreeType error codes (specification). */ * FreeType error codes (specification).
/* */ *
/* Copyright 2002, 2004, 2006, 2007 by */ * Copyright (C) 2002-2019 by
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ * David Turner, Robert Wilhelm, and Werner Lemberg.
/* */ *
/* This file is part of the FreeType project, and may only be used, */ * This file is part of the FreeType project, and may only be used,
/* modified, and distributed under the terms of the FreeType project */ * modified, and distributed under the terms of the FreeType project
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ * license, LICENSE.TXT. By continuing to use, modify, or distribute
/* this file you indicate that you have read the license and */ * this file you indicate that you have read the license and
/* understand and accept it fully. */ * understand and accept it fully.
/* */ *
/***************************************************************************/ */
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST OF ERROR CODES/MESSAGES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
/* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */
/* including this file. */
/**************************************************************************
*
* @section:
* error_code_values
*
* @title:
* Error Code Values
*
* @abstract:
* All possible error codes returned by FreeType functions.
*
* @description:
* The list below is taken verbatim from the file `fterrdef.h` (loaded
* automatically by including `FT_FREETYPE_H`). The first argument of the
* `FT_ERROR_DEF_` macro is the error label; by default, the prefix
* `FT_Err_` gets added so that you get error names like
* `FT_Err_Cannot_Open_Resource`. The second argument is the error code,
* and the last argument an error string, which is not used by FreeType.
*
* Within your application you should **only** use error names and
* **never** its numeric values! The latter might (and actually do)
* change in forthcoming FreeType versions.
*
* Macro `FT_NOERRORDEF_` defines `FT_Err_Ok`, which is always zero. See
* the 'Error Enumerations' subsection how to automatically generate a
* list of error strings.
*
*/
/**************************************************************************
*
* @enum:
* FT_Err_XXX
*
*/
/* generic errors */ /* generic errors */
FT_NOERRORDEF_( Ok, 0x00, \ FT_NOERRORDEF_( Ok, 0x00,
"no error" ) "no error" )
FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \ FT_ERRORDEF_( Cannot_Open_Resource, 0x01,
"cannot open resource" ) "cannot open resource" )
FT_ERRORDEF_( Unknown_File_Format, 0x02, \ FT_ERRORDEF_( Unknown_File_Format, 0x02,
"unknown file format" ) "unknown file format" )
FT_ERRORDEF_( Invalid_File_Format, 0x03, \ FT_ERRORDEF_( Invalid_File_Format, 0x03,
"broken file" ) "broken file" )
FT_ERRORDEF_( Invalid_Version, 0x04, \ FT_ERRORDEF_( Invalid_Version, 0x04,
"invalid FreeType version" ) "invalid FreeType version" )
FT_ERRORDEF_( Lower_Module_Version, 0x05, \ FT_ERRORDEF_( Lower_Module_Version, 0x05,
"module version is too low" ) "module version is too low" )
FT_ERRORDEF_( Invalid_Argument, 0x06, \ FT_ERRORDEF_( Invalid_Argument, 0x06,
"invalid argument" ) "invalid argument" )
FT_ERRORDEF_( Unimplemented_Feature, 0x07, \ FT_ERRORDEF_( Unimplemented_Feature, 0x07,
"unimplemented feature" ) "unimplemented feature" )
FT_ERRORDEF_( Invalid_Table, 0x08, \ FT_ERRORDEF_( Invalid_Table, 0x08,
"broken table" ) "broken table" )
FT_ERRORDEF_( Invalid_Offset, 0x09, \ FT_ERRORDEF_( Invalid_Offset, 0x09,
"broken offset within table" ) "broken offset within table" )
FT_ERRORDEF_( Array_Too_Large, 0x0A, \ FT_ERRORDEF_( Array_Too_Large, 0x0A,
"array allocation size too large" ) "array allocation size too large" )
FT_ERRORDEF_( Missing_Module, 0x0B,
"missing module" )
FT_ERRORDEF_( Missing_Property, 0x0C,
"missing property" )
/* glyph/character errors */ /* glyph/character errors */
FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \ FT_ERRORDEF_( Invalid_Glyph_Index, 0x10,
"invalid glyph index" ) "invalid glyph index" )
FT_ERRORDEF_( Invalid_Character_Code, 0x11, \ FT_ERRORDEF_( Invalid_Character_Code, 0x11,
"invalid character code" ) "invalid character code" )
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \ FT_ERRORDEF_( Invalid_Glyph_Format, 0x12,
"unsupported glyph image format" ) "unsupported glyph image format" )
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \ FT_ERRORDEF_( Cannot_Render_Glyph, 0x13,
"cannot render this glyph format" ) "cannot render this glyph format" )
FT_ERRORDEF_( Invalid_Outline, 0x14, \ FT_ERRORDEF_( Invalid_Outline, 0x14,
"invalid outline" ) "invalid outline" )
FT_ERRORDEF_( Invalid_Composite, 0x15, \ FT_ERRORDEF_( Invalid_Composite, 0x15,
"invalid composite glyph" ) "invalid composite glyph" )
FT_ERRORDEF_( Too_Many_Hints, 0x16, \ FT_ERRORDEF_( Too_Many_Hints, 0x16,
"too many hints" ) "too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \ FT_ERRORDEF_( Invalid_Pixel_Size, 0x17,
"invalid pixel size" ) "invalid pixel size" )
/* handle errors */ /* handle errors */
FT_ERRORDEF_( Invalid_Handle, 0x20, \ FT_ERRORDEF_( Invalid_Handle, 0x20,
"invalid object handle" ) "invalid object handle" )
FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \ FT_ERRORDEF_( Invalid_Library_Handle, 0x21,
"invalid library handle" ) "invalid library handle" )
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \ FT_ERRORDEF_( Invalid_Driver_Handle, 0x22,
"invalid module handle" ) "invalid module handle" )
FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \ FT_ERRORDEF_( Invalid_Face_Handle, 0x23,
"invalid face handle" ) "invalid face handle" )
FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \ FT_ERRORDEF_( Invalid_Size_Handle, 0x24,
"invalid size handle" ) "invalid size handle" )
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \ FT_ERRORDEF_( Invalid_Slot_Handle, 0x25,
"invalid glyph slot handle" ) "invalid glyph slot handle" )
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \ FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26,
"invalid charmap handle" ) "invalid charmap handle" )
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \ FT_ERRORDEF_( Invalid_Cache_Handle, 0x27,
"invalid cache manager handle" ) "invalid cache manager handle" )
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \ FT_ERRORDEF_( Invalid_Stream_Handle, 0x28,
"invalid stream handle" ) "invalid stream handle" )
/* driver errors */ /* driver errors */
FT_ERRORDEF_( Too_Many_Drivers, 0x30, \ FT_ERRORDEF_( Too_Many_Drivers, 0x30,
"too many modules" ) "too many modules" )
FT_ERRORDEF_( Too_Many_Extensions, 0x31, \ FT_ERRORDEF_( Too_Many_Extensions, 0x31,
"too many extensions" ) "too many extensions" )
/* memory errors */ /* memory errors */
FT_ERRORDEF_( Out_Of_Memory, 0x40, \ FT_ERRORDEF_( Out_Of_Memory, 0x40,
"out of memory" ) "out of memory" )
FT_ERRORDEF_( Unlisted_Object, 0x41, \ FT_ERRORDEF_( Unlisted_Object, 0x41,
"unlisted object" ) "unlisted object" )
/* stream errors */ /* stream errors */
FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \ FT_ERRORDEF_( Cannot_Open_Stream, 0x51,
"cannot open stream" ) "cannot open stream" )
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \ FT_ERRORDEF_( Invalid_Stream_Seek, 0x52,
"invalid stream seek" ) "invalid stream seek" )
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \ FT_ERRORDEF_( Invalid_Stream_Skip, 0x53,
"invalid stream skip" ) "invalid stream skip" )
FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \ FT_ERRORDEF_( Invalid_Stream_Read, 0x54,
"invalid stream read" ) "invalid stream read" )
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \ FT_ERRORDEF_( Invalid_Stream_Operation, 0x55,
"invalid stream operation" ) "invalid stream operation" )
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \ FT_ERRORDEF_( Invalid_Frame_Operation, 0x56,
"invalid frame operation" ) "invalid frame operation" )
FT_ERRORDEF_( Nested_Frame_Access, 0x57, \ FT_ERRORDEF_( Nested_Frame_Access, 0x57,
"nested frame access" ) "nested frame access" )
FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \ FT_ERRORDEF_( Invalid_Frame_Read, 0x58,
"invalid frame read" ) "invalid frame read" )
/* raster errors */ /* raster errors */
FT_ERRORDEF_( Raster_Uninitialized, 0x60, \ FT_ERRORDEF_( Raster_Uninitialized, 0x60,
"raster uninitialized" ) "raster uninitialized" )
FT_ERRORDEF_( Raster_Corrupted, 0x61, \ FT_ERRORDEF_( Raster_Corrupted, 0x61,
"raster corrupted" ) "raster corrupted" )
FT_ERRORDEF_( Raster_Overflow, 0x62, \ FT_ERRORDEF_( Raster_Overflow, 0x62,
"raster overflow" ) "raster overflow" )
FT_ERRORDEF_( Raster_Negative_Height, 0x63, \ FT_ERRORDEF_( Raster_Negative_Height, 0x63,
"negative height while rastering" ) "negative height while rastering" )
/* cache errors */ /* cache errors */
FT_ERRORDEF_( Too_Many_Caches, 0x70, \ FT_ERRORDEF_( Too_Many_Caches, 0x70,
"too many registered caches" ) "too many registered caches" )
/* TrueType and SFNT errors */ /* TrueType and SFNT errors */
FT_ERRORDEF_( Invalid_Opcode, 0x80, \ FT_ERRORDEF_( Invalid_Opcode, 0x80,
"invalid opcode" ) "invalid opcode" )
FT_ERRORDEF_( Too_Few_Arguments, 0x81, \ FT_ERRORDEF_( Too_Few_Arguments, 0x81,
"too few arguments" ) "too few arguments" )
FT_ERRORDEF_( Stack_Overflow, 0x82, \ FT_ERRORDEF_( Stack_Overflow, 0x82,
"stack overflow" ) "stack overflow" )
FT_ERRORDEF_( Code_Overflow, 0x83, \ FT_ERRORDEF_( Code_Overflow, 0x83,
"code overflow" ) "code overflow" )
FT_ERRORDEF_( Bad_Argument, 0x84, \ FT_ERRORDEF_( Bad_Argument, 0x84,
"bad argument" ) "bad argument" )
FT_ERRORDEF_( Divide_By_Zero, 0x85, \ FT_ERRORDEF_( Divide_By_Zero, 0x85,
"division by zero" ) "division by zero" )
FT_ERRORDEF_( Invalid_Reference, 0x86, \ FT_ERRORDEF_( Invalid_Reference, 0x86,
"invalid reference" ) "invalid reference" )
FT_ERRORDEF_( Debug_OpCode, 0x87, \ FT_ERRORDEF_( Debug_OpCode, 0x87,
"found debug opcode" ) "found debug opcode" )
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \ FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88,
"found ENDF opcode in execution stream" ) "found ENDF opcode in execution stream" )
FT_ERRORDEF_( Nested_DEFS, 0x89, \ FT_ERRORDEF_( Nested_DEFS, 0x89,
"nested DEFS" ) "nested DEFS" )
FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \ FT_ERRORDEF_( Invalid_CodeRange, 0x8A,
"invalid code range" ) "invalid code range" )
FT_ERRORDEF_( Execution_Too_Long, 0x8B, \ FT_ERRORDEF_( Execution_Too_Long, 0x8B,
"execution context too long" ) "execution context too long" )
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \ FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C,
"too many function definitions" ) "too many function definitions" )
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \ FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D,
"too many instruction definitions" ) "too many instruction definitions" )
FT_ERRORDEF_( Table_Missing, 0x8E, \ FT_ERRORDEF_( Table_Missing, 0x8E,
"SFNT font table missing" ) "SFNT font table missing" )
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \ FT_ERRORDEF_( Horiz_Header_Missing, 0x8F,
"horizontal header (hhea) table missing" ) "horizontal header (hhea) table missing" )
FT_ERRORDEF_( Locations_Missing, 0x90, \ FT_ERRORDEF_( Locations_Missing, 0x90,
"locations (loca) table missing" ) "locations (loca) table missing" )
FT_ERRORDEF_( Name_Table_Missing, 0x91, \ FT_ERRORDEF_( Name_Table_Missing, 0x91,
"name table missing" ) "name table missing" )
FT_ERRORDEF_( CMap_Table_Missing, 0x92, \ FT_ERRORDEF_( CMap_Table_Missing, 0x92,
"character map (cmap) table missing" ) "character map (cmap) table missing" )
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \ FT_ERRORDEF_( Hmtx_Table_Missing, 0x93,
"horizontal metrics (hmtx) table missing" ) "horizontal metrics (hmtx) table missing" )
FT_ERRORDEF_( Post_Table_Missing, 0x94, \ FT_ERRORDEF_( Post_Table_Missing, 0x94,
"PostScript (post) table missing" ) "PostScript (post) table missing" )
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \ FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95,
"invalid horizontal metrics" ) "invalid horizontal metrics" )
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \ FT_ERRORDEF_( Invalid_CharMap_Format, 0x96,
"invalid character map (cmap) format" ) "invalid character map (cmap) format" )
FT_ERRORDEF_( Invalid_PPem, 0x97, \ FT_ERRORDEF_( Invalid_PPem, 0x97,
"invalid ppem value" ) "invalid ppem value" )
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \ FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98,
"invalid vertical metrics" ) "invalid vertical metrics" )
FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \ FT_ERRORDEF_( Could_Not_Find_Context, 0x99,
"could not find context" ) "could not find context" )
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \ FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A,
"invalid PostScript (post) table format" ) "invalid PostScript (post) table format" )
FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \ FT_ERRORDEF_( Invalid_Post_Table, 0x9B,
"invalid PostScript (post) table" ) "invalid PostScript (post) table" )
FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C,
"found FDEF or IDEF opcode in glyf bytecode" )
FT_ERRORDEF_( Missing_Bitmap, 0x9D,
"missing bitmap in strike" )
/* CFF, CID, and Type 1 errors */ /* CFF, CID, and Type 1 errors */
FT_ERRORDEF_( Syntax_Error, 0xA0, \ FT_ERRORDEF_( Syntax_Error, 0xA0,
"opcode syntax error" ) "opcode syntax error" )
FT_ERRORDEF_( Stack_Underflow, 0xA1, \ FT_ERRORDEF_( Stack_Underflow, 0xA1,
"argument stack underflow" ) "argument stack underflow" )
FT_ERRORDEF_( Ignore, 0xA2, \ FT_ERRORDEF_( Ignore, 0xA2,
"ignore" ) "ignore" )
FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3,
"no Unicode glyph name found" )
FT_ERRORDEF_( Glyph_Too_Big, 0xA4,
"glyph too big for hinting" )
/* BDF errors */ /* BDF errors */
FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \ FT_ERRORDEF_( Missing_Startfont_Field, 0xB0,
"`STARTFONT' field missing" ) "`STARTFONT' field missing" )
FT_ERRORDEF_( Missing_Font_Field, 0xB1, \ FT_ERRORDEF_( Missing_Font_Field, 0xB1,
"`FONT' field missing" ) "`FONT' field missing" )
FT_ERRORDEF_( Missing_Size_Field, 0xB2, \ FT_ERRORDEF_( Missing_Size_Field, 0xB2,
"`SIZE' field missing" ) "`SIZE' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB3, \ FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3,
"`FONTBOUNDINGBOX' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB4,
"`CHARS' field missing" ) "`CHARS' field missing" )
FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, \ FT_ERRORDEF_( Missing_Startchar_Field, 0xB5,
"`STARTCHAR' field missing" ) "`STARTCHAR' field missing" )
FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, \ FT_ERRORDEF_( Missing_Encoding_Field, 0xB6,
"`ENCODING' field missing" ) "`ENCODING' field missing" )
FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, \ FT_ERRORDEF_( Missing_Bbx_Field, 0xB7,
"`BBX' field missing" ) "`BBX' field missing" )
FT_ERRORDEF_( Bbx_Too_Big, 0xB7, \ FT_ERRORDEF_( Bbx_Too_Big, 0xB8,
"`BBX' too big" ) "`BBX' too big" )
FT_ERRORDEF_( Corrupted_Font_Header, 0xB8, \ FT_ERRORDEF_( Corrupted_Font_Header, 0xB9,
"Font header corrupted or missing fields" ) "Font header corrupted or missing fields" )
FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xB9, \ FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA,
"Font glyphs corrupted or missing fields" ) "Font glyphs corrupted or missing fields" )
/* */
/* END */ /* END */
/***************************************************************************/ /****************************************************************************
/* */ *
/* fterrors.h */ * fterrors.h
/* */ *
/* FreeType error code handling (specification). */ * FreeType error code handling (specification).
/* */ *
/* Copyright 1996-2001, 2002, 2004, 2007 by */ * Copyright (C) 1996-2019 by
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ * David Turner, Robert Wilhelm, and Werner Lemberg.
/* */ *
/* This file is part of the FreeType project, and may only be used, */ * This file is part of the FreeType project, and may only be used,
/* modified, and distributed under the terms of the FreeType project */ * modified, and distributed under the terms of the FreeType project
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ * license, LICENSE.TXT. By continuing to use, modify, or distribute
/* this file you indicate that you have read the license and */ * this file you indicate that you have read the license and
/* understand and accept it fully. */ * understand and accept it fully.
/* */ *
/***************************************************************************/ */
/*************************************************************************/ /**************************************************************************
/* */ *
/* This special header file is used to define the handling of FT2 */ * @section:
/* enumeration constants. It can also be used to generate error message */ * error_enumerations
/* strings with a small macro trick explained below. */ *
/* */ * @title:
/* I - Error Formats */ * Error Enumerations
/* ----------------- */ *
/* */ * @abstract:
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ * How to handle errors and error strings.
/* defined in ftoption.h in order to make the higher byte indicate */ *
/* the module where the error has happened (this is not compatible */ * @description:
/* with standard builds of FreeType 2). You can then use the macro */ * The header file `fterrors.h` (which is automatically included by
/* FT_ERROR_BASE macro to extract the generic error code from an */ * `freetype.h` defines the handling of FreeType's enumeration
/* FT_Error value. */ * constants. It can also be used to generate error message strings
/* */ * with a small macro trick explained below.
/* */ *
/* II - Error Message strings */ * **Error Formats**
/* -------------------------- */ *
/* */ * The configuration macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` can be
/* The error definitions below are made through special macros that */ * defined in `ftoption.h` in order to make the higher byte indicate the
/* allow client applications to build a table of error message strings */ * module where the error has happened (this is not compatible with
/* if they need it. The strings are not included in a normal build of */ * standard builds of FreeType~2, however). See the file `ftmoderr.h`
/* FreeType 2 to save space (most client applications do not use */ * for more details.
/* them). */ *
/* */ * **Error Message Strings**
/* To do so, you have to define the following macros before including */ *
/* this file: */ * Error definitions are set up with special macros that allow client
/* */ * applications to build a table of error message strings. The strings
/* FT_ERROR_START_LIST :: */ * are not included in a normal build of FreeType~2 to save space (most
/* This macro is called before anything else to define the start of */ * client applications do not use them).
/* the error list. It is followed by several FT_ERROR_DEF calls */ *
/* (see below). */ * To do so, you have to define the following macros before including
/* */ * this file.
/* FT_ERROR_DEF( e, v, s ) :: */ *
/* This macro is called to define one single error. */ * ```
/* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ * FT_ERROR_START_LIST
/* `v' is the error numerical value. */ * ```
/* `s' is the corresponding error string. */ *
/* */ * This macro is called before anything else to define the start of the
/* FT_ERROR_END_LIST :: */ * error list. It is followed by several `FT_ERROR_DEF` calls.
/* This macro ends the list. */ *
/* */ * ```
/* Additionally, you have to undefine __FTERRORS_H__ before #including */ * FT_ERROR_DEF( e, v, s )
/* this file. */ * ```
/* */ *
/* Here is a simple example: */ * This macro is called to define one single error. 'e' is the error
/* */ * code identifier (e.g., `Invalid_Argument`), 'v' is the error's
/* { */ * numerical value, and 's' is the corresponding error string.
/* #undef __FTERRORS_H__ */ *
/* #define FT_ERRORDEF( e, v, s ) { e, s }, */ * ```
/* #define FT_ERROR_START_LIST { */ * FT_ERROR_END_LIST
/* #define FT_ERROR_END_LIST { 0, 0 } }; */ * ```
/* */ *
/* const struct */ * This macro ends the list.
/* { */ *
/* int err_code; */ * Additionally, you have to undefine `FTERRORS_H_` before #including
/* const char* err_msg; */ * this file.
/* } ft_errors[] = */ *
/* */ * Here is a simple example.
/* #include FT_ERRORS_H */ *
/* } */ * ```
/* */ * #undef FTERRORS_H_
/*************************************************************************/ * #define FT_ERRORDEF( e, v, s ) { e, s },
* #define FT_ERROR_START_LIST {
* #define FT_ERROR_END_LIST { 0, NULL } };
#ifndef __FTERRORS_H__ *
* const struct
* {
* int err_code;
* const char* err_msg;
* } ft_errors[] =
*
* #include FT_ERRORS_H
* ```
*
* An alternative to using an array is a switch statement.
*
* ```
* #undef FTERRORS_H_
* #define FT_ERROR_START_LIST switch ( error_code ) {
* #define FT_ERRORDEF( e, v, s ) case v: return s;
* #define FT_ERROR_END_LIST }
* ```
*
* If you use `FT_CONFIG_OPTION_USE_MODULE_ERRORS`, `error_code` should
* be replaced with `FT_ERROR_BASE(error_code)` in the last example.
*/
/* */
/* In previous FreeType versions we used `__FTERRORS_H__`. However, */
/* using two successive underscores in a non-system symbol name */
/* violates the C (and C++) standard, so it was changed to the */
/* current form. In spite of this, we have to make */
/* */
/* ``` */
/* #undefine __FTERRORS_H__ */
/* ``` */
/* */
/* work for backward compatibility. */
/* */
#if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) )
#define FTERRORS_H_
#define __FTERRORS_H__ #define __FTERRORS_H__
...@@ -101,15 +138,9 @@ ...@@ -101,15 +138,9 @@
#undef FT_NEED_EXTERN_C #undef FT_NEED_EXTERN_C
#undef FT_ERR_XCAT
#undef FT_ERR_CAT
#define FT_ERR_XCAT( x, y ) x ## y
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
/* FT_ERR_PREFIX is used as a prefix for error identifiers. */ /* FT_ERR_PREFIX is used as a prefix for error identifiers. */
/* By default, we use `FT_Err_'. */ /* By default, we use `FT_Err_`. */
/* */ /* */
#ifndef FT_ERR_PREFIX #ifndef FT_ERR_PREFIX
#define FT_ERR_PREFIX FT_Err_ #define FT_ERR_PREFIX FT_Err_
...@@ -137,6 +168,8 @@ ...@@ -137,6 +168,8 @@
/* */ /* */
#ifndef FT_ERRORDEF #ifndef FT_ERRORDEF
#define FT_INCLUDE_ERR_PROTOS
#define FT_ERRORDEF( e, v, s ) e = v, #define FT_ERRORDEF( e, v, s ) e = v,
#define FT_ERROR_START_LIST enum { #define FT_ERROR_START_LIST enum {
#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; #define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
...@@ -150,11 +183,11 @@ ...@@ -150,11 +183,11 @@
/* this macro is used to define an error */ /* this macro is used to define an error */
#define FT_ERRORDEF_( e, v, s ) \ #define FT_ERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
/* this is only used for <module>_Err_Ok, which must be 0! */ /* this is only used for <module>_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) \ #define FT_NOERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
...@@ -192,15 +225,65 @@ ...@@ -192,15 +225,65 @@
#undef FT_NOERRORDEF_ #undef FT_NOERRORDEF_
#undef FT_NEED_EXTERN_C #undef FT_NEED_EXTERN_C
#undef FT_ERR_CONCAT
#undef FT_ERR_BASE #undef FT_ERR_BASE
/* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ /* FT_ERR_PREFIX is needed internally */
#ifndef FT_KEEP_ERR_PREFIX #ifndef FT2_BUILD_LIBRARY
#undef FT_ERR_PREFIX #undef FT_ERR_PREFIX
#endif #endif
#endif /* __FTERRORS_H__ */ /* FT_INCLUDE_ERR_PROTOS: Control if function prototypes should be */
/* included with `#include FT_ERRORS_H'. This is */
/* only true where `FT_ERRORDEF` is undefined. */
/* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of */
/* `fterrors.h`. */
#ifdef FT_INCLUDE_ERR_PROTOS
#undef FT_INCLUDE_ERR_PROTOS
#ifndef FT_ERR_PROTOS_DEFINED
#define FT_ERR_PROTOS_DEFINED
FT_BEGIN_HEADER
/**************************************************************************
*
* @function:
* FT_Error_String
*
* @description:
* Retrieve the description of a valid FreeType error code.
*
* @input:
* error_code ::
* A valid FreeType error code.
*
* @return:
* A C~string or `NULL`, if any error occurred.
*
* @note:
* FreeType has to be compiled with `FT_CONFIG_OPTION_ERROR_STRINGS` or
* `FT_DEBUG_LEVEL_ERROR` to get meaningful descriptions.
* 'error_string' will be `NULL` otherwise.
*
* Module identification will be ignored:
*
* ```c
* strcmp( FT_Error_String( FT_Err_Unknown_File_Format ),
* FT_Error_String( BDF_Err_Unknown_File_Format ) ) == 0;
* ```
*/
FT_EXPORT( const char* )
FT_Error_String( FT_Error error_code );
FT_END_HEADER
#endif /* FT_ERR_PROTOS_DEFINED */
#endif /* FT_INCLUDE_ERR_PROTOS */
#endif /* !(FTERRORS_H_ && __FTERRORS_H__) */
/* END */ /* END */
/****************************************************************************
*
* ftfntfmt.h
*
* Support functions for font formats.
*
* Copyright (C) 2002-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FTFNTFMT_H_
#define FTFNTFMT_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* font_formats
*
* @title:
* Font Formats
*
* @abstract:
* Getting the font format.
*
* @description:
* The single function in this section can be used to get the font format.
* Note that this information is not needed normally; however, there are
* special cases (like in PDF devices) where it is important to
* differentiate, in spite of FreeType's uniform API.
*
*/
/**************************************************************************
*
* @function:
* FT_Get_Font_Format
*
* @description:
* Return a string describing the format of a given face. Possible values
* are 'TrueType', 'Type~1', 'BDF', 'PCF', 'Type~42', 'CID~Type~1', 'CFF',
* 'PFR', and 'Windows~FNT'.
*
* The return value is suitable to be used as an X11 FONT_PROPERTY.
*
* @input:
* face ::
* Input face handle.
*
* @return:
* Font format string. `NULL` in case of error.
*
* @note:
* A deprecated name for the same function is `FT_Get_X11_Font_Format`.
*/
FT_EXPORT( const char* )
FT_Get_Font_Format( FT_Face face );
/* deprecated */
FT_EXPORT( const char* )
FT_Get_X11_Font_Format( FT_Face face );
/* */
FT_END_HEADER
#endif /* FTFNTFMT_H_ */
/* END */
/***************************************************************************/ /****************************************************************************
/* */ *
/* ftgasp.h */ * ftgasp.h
/* */ *
/* Access of TrueType's `gasp' table (specification). */ * Access of TrueType's 'gasp' table (specification).
/* */ *
/* Copyright 2007 by */ * Copyright (C) 2007-2019 by
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ * David Turner, Robert Wilhelm, and Werner Lemberg.
/* */ *
/* This file is part of the FreeType project, and may only be used, */ * This file is part of the FreeType project, and may only be used,
/* modified, and distributed under the terms of the FreeType project */ * modified, and distributed under the terms of the FreeType project
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ * license, LICENSE.TXT. By continuing to use, modify, or distribute
/* this file you indicate that you have read the license and */ * this file you indicate that you have read the license and
/* understand and accept it fully. */ * understand and accept it fully.
/* */ *
/***************************************************************************/ */
#ifndef _FT_GASP_H_ #ifndef FTGASP_H_
#define _FT_GASP_H_ #define FTGASP_H_
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
/*************************************************************************** #ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
* *
* @section: * @section:
* gasp_table * gasp_table
...@@ -31,16 +41,16 @@ ...@@ -31,16 +41,16 @@
* Gasp Table * Gasp Table
* *
* @abstract: * @abstract:
* Retrieving TrueType `gasp' table entries * Retrieving TrueType 'gasp' table entries.
* *
* @description: * @description:
* The function @FT_Get_Gasp can be used to query a TrueType or OpenType * The function @FT_Get_Gasp can be used to query a TrueType or OpenType
* font for specific entries in their `gasp' table, if any. This is * font for specific entries in its 'gasp' table, if any. This is mainly
* mainly useful when implementing native TrueType hinting with the * useful when implementing native TrueType hinting with the bytecode
* bytecode interpreter to duplicate the Windows text rendering results. * interpreter to duplicate the Windows text rendering results.
*/ */
/************************************************************************* /**************************************************************************
* *
* @enum: * @enum:
* FT_GASP_XXX * FT_GASP_XXX
...@@ -56,19 +66,27 @@ ...@@ -56,19 +66,27 @@
* *
* FT_GASP_DO_GRIDFIT :: * FT_GASP_DO_GRIDFIT ::
* Grid-fitting and hinting should be performed at the specified ppem. * Grid-fitting and hinting should be performed at the specified ppem.
* This *really* means TrueType bytecode interpretation. * This **really** means TrueType bytecode interpretation. If this bit
* is not set, no hinting gets applied.
* *
* FT_GASP_DO_GRAY :: * FT_GASP_DO_GRAY ::
* Anti-aliased rendering should be performed at the specified ppem. * Anti-aliased rendering should be performed at the specified ppem.
* If not set, do monochrome rendering.
* *
* FT_GASP_SYMMETRIC_SMOOTHING :: * FT_GASP_SYMMETRIC_SMOOTHING ::
* Smoothing along multiple axes must be used with ClearType. * If set, smoothing along multiple axes must be used with ClearType.
* *
* FT_GASP_SYMMETRIC_GRIDFIT :: * FT_GASP_SYMMETRIC_GRIDFIT ::
* Grid-fitting must be used with ClearType's symmetric smoothing. * Grid-fitting must be used with ClearType's symmetric smoothing.
* *
* @note: * @note:
* `ClearType' is Microsoft's implementation of LCD rendering, partly * The bit-flags `FT_GASP_DO_GRIDFIT` and `FT_GASP_DO_GRAY` are to be
* used for standard font rasterization only. Independently of that,
* `FT_GASP_SYMMETRIC_SMOOTHING` and `FT_GASP_SYMMETRIC_GRIDFIT` are to
* be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT` and
* `FT_GASP_DO_GRAY` are consequently ignored).
*
* 'ClearType' is Microsoft's implementation of LCD rendering, partly
* protected by patents. * protected by patents.
* *
* @since: * @since:
...@@ -77,26 +95,36 @@ ...@@ -77,26 +95,36 @@
#define FT_GASP_NO_TABLE -1 #define FT_GASP_NO_TABLE -1
#define FT_GASP_DO_GRIDFIT 0x01 #define FT_GASP_DO_GRIDFIT 0x01
#define FT_GASP_DO_GRAY 0x02 #define FT_GASP_DO_GRAY 0x02
#define FT_GASP_SYMMETRIC_GRIDFIT 0x04
#define FT_GASP_SYMMETRIC_SMOOTHING 0x08 #define FT_GASP_SYMMETRIC_SMOOTHING 0x08
#define FT_GASP_SYMMETRIC_GRIDFIT 0x10
/************************************************************************* /**************************************************************************
* *
* @func: * @function:
* FT_Get_Gasp * FT_Get_Gasp
* *
* @description: * @description:
* Read the `gasp' table from a TrueType or OpenType font file and * For a TrueType or OpenType font file, return the rasterizer behaviour
* return the entry corresponding to a given character pixel size. * flags from the font's 'gasp' table corresponding to a given character
* pixel size.
* *
* @input: * @input:
* face :: The source face handle. * face ::
* ppem :: The vertical character pixel size. * The source face handle.
*
* ppem ::
* The vertical character pixel size.
* *
* @return: * @return:
* Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE is there is no * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
* `gasp' table in the face. * 'gasp' table in the face.
*
* @note:
* If you want to use the MM functionality of OpenType variation fonts
* (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this
* function **after** setting an instance since the return values can
* change.
* *
* @since: * @since:
* 2.3.0 * 2.3.0
...@@ -105,9 +133,12 @@ ...@@ -105,9 +133,12 @@
FT_Get_Gasp( FT_Face face, FT_Get_Gasp( FT_Face face,
FT_UInt ppem ); FT_UInt ppem );
/* */ /* */
FT_END_HEADER
#endif /* _FT_GASP_H_ */ #endif /* FTGASP_H_ */
/* END */ /* END */
/****************************************************************************
*
* ftglyph.h
*
* FreeType convenience functions to handle glyphs (specification).
*
* Copyright (C) 1996-2019 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
/**************************************************************************
*
* This file contains the definition of several convenience functions that
* can be used by client applications to easily retrieve glyph bitmaps and
* outlines from a given face.
*
* These functions should be optional if you are writing a font server or
* text layout engine on top of FreeType. However, they are pretty handy
* for many other simple uses of the library.
*
*/
#ifndef FTGLYPH_H_
#define FTGLYPH_H_
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* glyph_management
*
* @title:
* Glyph Management
*
* @abstract:
* Generic interface to manage individual glyph data.
*
* @description:
* This section contains definitions used to manage glyph data through
* generic @FT_Glyph objects. Each of them can contain a bitmap,
* a vector outline, or even images in other formats. These objects are
* detached from @FT_Face, contrary to @FT_GlyphSlot.
*
*/
/* forward declaration to a private type */
typedef struct FT_Glyph_Class_ FT_Glyph_Class;
/**************************************************************************
*
* @type:
* FT_Glyph
*
* @description:
* Handle to an object used to model generic glyph images. It is a
* pointer to the @FT_GlyphRec structure and can contain a glyph bitmap
* or pointer.
*
* @note:
* Glyph objects are not owned by the library. You must thus release
* them manually (through @FT_Done_Glyph) _before_ calling
* @FT_Done_FreeType.
*/
typedef struct FT_GlyphRec_* FT_Glyph;
/**************************************************************************
*
* @struct:
* FT_GlyphRec
*
* @description:
* The root glyph structure contains a given glyph image plus its advance
* width in 16.16 fixed-point format.
*
* @fields:
* library ::
* A handle to the FreeType library object.
*
* clazz ::
* A pointer to the glyph's class. Private.
*
* format ::
* The format of the glyph's image.
*
* advance ::
* A 16.16 vector that gives the glyph's advance width.
*/
typedef struct FT_GlyphRec_
{
FT_Library library;
const FT_Glyph_Class* clazz;
FT_Glyph_Format format;
FT_Vector advance;
} FT_GlyphRec;
/**************************************************************************
*
* @type:
* FT_BitmapGlyph
*
* @description:
* A handle to an object used to model a bitmap glyph image. This is a
* sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.
*/
typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;
/**************************************************************************
*
* @struct:
* FT_BitmapGlyphRec
*
* @description:
* A structure used for bitmap glyph images. This really is a
* 'sub-class' of @FT_GlyphRec.
*
* @fields:
* root ::
* The root @FT_Glyph fields.
*
* left ::
* The left-side bearing, i.e., the horizontal distance from the
* current pen position to the left border of the glyph bitmap.
*
* top ::
* The top-side bearing, i.e., the vertical distance from the current
* pen position to the top border of the glyph bitmap. This distance
* is positive for upwards~y!
*
* bitmap ::
* A descriptor for the bitmap.
*
* @note:
* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have
* `glyph->format == FT_GLYPH_FORMAT_BITMAP`. This lets you access the
* bitmap's contents easily.
*
* The corresponding pixel buffer is always owned by @FT_BitmapGlyph and
* is thus created and destroyed with it.
*/
typedef struct FT_BitmapGlyphRec_
{
FT_GlyphRec root;
FT_Int left;
FT_Int top;
FT_Bitmap bitmap;
} FT_BitmapGlyphRec;
/**************************************************************************
*
* @type:
* FT_OutlineGlyph
*
* @description:
* A handle to an object used to model an outline glyph image. This is a
* sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.
*/
typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;
/**************************************************************************
*
* @struct:
* FT_OutlineGlyphRec
*
* @description:
* A structure used for outline (vectorial) glyph images. This really is
* a 'sub-class' of @FT_GlyphRec.
*
* @fields:
* root ::
* The root @FT_Glyph fields.
*
* outline ::
* A descriptor for the outline.
*
* @note:
* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have
* `glyph->format == FT_GLYPH_FORMAT_OUTLINE`. This lets you access the
* outline's content easily.
*
* As the outline is extracted from a glyph slot, its coordinates are
* expressed normally in 26.6 pixels, unless the flag @FT_LOAD_NO_SCALE
* was used in @FT_Load_Glyph or @FT_Load_Char.
*
* The outline's tables are always owned by the object and are destroyed
* with it.
*/
typedef struct FT_OutlineGlyphRec_
{
FT_GlyphRec root;
FT_Outline outline;
} FT_OutlineGlyphRec;
/**************************************************************************
*
* @function:
* FT_New_Glyph
*
* @description:
* A function used to create a new empty glyph image. Note that the
* created @FT_Glyph object must be released with @FT_Done_Glyph.
*
* @input:
* library ::
* A handle to the FreeType library object.
*
* format ::
* The format of the glyph's image.
*
* @output:
* aglyph ::
* A handle to the glyph object.
*
* @return:
* FreeType error code. 0~means success.
*
* @since:
* 2.10
*/
FT_EXPORT( FT_Error )
FT_New_Glyph( FT_Library library,
FT_Glyph_Format format,
FT_Glyph *aglyph );
/**************************************************************************
*
* @function:
* FT_Get_Glyph
*
* @description:
* A function used to extract a glyph image from a slot. Note that the
* created @FT_Glyph object must be released with @FT_Done_Glyph.
*
* @input:
* slot ::
* A handle to the source glyph slot.
*
* @output:
* aglyph ::
* A handle to the glyph object.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* Because `*aglyph->advance.x` and `*aglyph->advance.y` are 16.16
* fixed-point numbers, `slot->advance.x` and `slot->advance.y` (which
* are in 26.6 fixed-point format) must be in the range ]-32768;32768[.
*/
FT_EXPORT( FT_Error )
FT_Get_Glyph( FT_GlyphSlot slot,
FT_Glyph *aglyph );
/**************************************************************************
*
* @function:
* FT_Glyph_Copy
*
* @description:
* A function used to copy a glyph image. Note that the created
* @FT_Glyph object must be released with @FT_Done_Glyph.
*
* @input:
* source ::
* A handle to the source glyph object.
*
* @output:
* target ::
* A handle to the target glyph object. 0~in case of error.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Glyph_Copy( FT_Glyph source,
FT_Glyph *target );
/**************************************************************************
*
* @function:
* FT_Glyph_Transform
*
* @description:
* Transform a glyph image if its format is scalable.
*
* @inout:
* glyph ::
* A handle to the target glyph object.
*
* @input:
* matrix ::
* A pointer to a 2x2 matrix to apply.
*
* delta ::
* A pointer to a 2d vector to apply. Coordinates are expressed in
* 1/64th of a pixel.
*
* @return:
* FreeType error code (if not 0, the glyph format is not scalable).
*
* @note:
* The 2x2 transformation matrix is also applied to the glyph's advance
* vector.
*/
FT_EXPORT( FT_Error )
FT_Glyph_Transform( FT_Glyph glyph,
FT_Matrix* matrix,
FT_Vector* delta );
/**************************************************************************
*
* @enum:
* FT_Glyph_BBox_Mode
*
* @description:
* The mode how the values of @FT_Glyph_Get_CBox are returned.
*
* @values:
* FT_GLYPH_BBOX_UNSCALED ::
* Return unscaled font units.
*
* FT_GLYPH_BBOX_SUBPIXELS ::
* Return unfitted 26.6 coordinates.
*
* FT_GLYPH_BBOX_GRIDFIT ::
* Return grid-fitted 26.6 coordinates.
*
* FT_GLYPH_BBOX_TRUNCATE ::
* Return coordinates in integer pixels.
*
* FT_GLYPH_BBOX_PIXELS ::
* Return grid-fitted pixel coordinates.
*/
typedef enum FT_Glyph_BBox_Mode_
{
FT_GLYPH_BBOX_UNSCALED = 0,
FT_GLYPH_BBOX_SUBPIXELS = 0,
FT_GLYPH_BBOX_GRIDFIT = 1,
FT_GLYPH_BBOX_TRUNCATE = 2,
FT_GLYPH_BBOX_PIXELS = 3
} FT_Glyph_BBox_Mode;
/* these constants are deprecated; use the corresponding */
/* `FT_Glyph_BBox_Mode` values instead */
#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED
#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS
#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT
#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE
#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS
/**************************************************************************
*
* @function:
* FT_Glyph_Get_CBox
*
* @description:
* Return a glyph's 'control box'. The control box encloses all the
* outline's points, including Bezier control points. Though it
* coincides with the exact bounding box for most glyphs, it can be
* slightly larger in some situations (like when rotating an outline that
* contains Bezier outside arcs).
*
* Computing the control box is very fast, while getting the bounding box
* can take much more time as it needs to walk over all segments and arcs
* in the outline. To get the latter, you can use the 'ftbbox'
* component, which is dedicated to this single task.
*
* @input:
* glyph ::
* A handle to the source glyph object.
*
* mode ::
* The mode that indicates how to interpret the returned bounding box
* values.
*
* @output:
* acbox ::
* The glyph coordinate bounding box. Coordinates are expressed in
* 1/64th of pixels if it is grid-fitted.
*
* @note:
* Coordinates are relative to the glyph origin, using the y~upwards
* convention.
*
* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode` must
* be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font units in 26.6
* pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS is another name for
* this constant.
*
* If the font is tricky and the glyph has been loaded with
* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get
* reasonable values for the CBox it is necessary to load the glyph at a
* large ppem value (so that the hinting instructions can properly shift
* and scale the subglyphs), then extracting the CBox, which can be
* eventually converted back to font units.
*
* Note that the maximum coordinates are exclusive, which means that one
* can compute the width and height of the glyph image (be it in integer
* or 26.6 pixels) as:
*
* ```
* width = bbox.xMax - bbox.xMin;
* height = bbox.yMax - bbox.yMin;
* ```
*
* Note also that for 26.6 coordinates, if `bbox_mode` is set to
* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted,
* which corresponds to:
*
* ```
* bbox.xMin = FLOOR(bbox.xMin);
* bbox.yMin = FLOOR(bbox.yMin);
* bbox.xMax = CEILING(bbox.xMax);
* bbox.yMax = CEILING(bbox.yMax);
* ```
*
* To get the bbox in pixel coordinates, set `bbox_mode` to
* @FT_GLYPH_BBOX_TRUNCATE.
*
* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode` to
* @FT_GLYPH_BBOX_PIXELS.
*/
FT_EXPORT( void )
FT_Glyph_Get_CBox( FT_Glyph glyph,
FT_UInt bbox_mode,
FT_BBox *acbox );
/**************************************************************************
*
* @function:
* FT_Glyph_To_Bitmap
*
* @description:
* Convert a given glyph object to a bitmap glyph object.
*
* @inout:
* the_glyph ::
* A pointer to a handle to the target glyph.
*
* @input:
* render_mode ::
* An enumeration that describes how the data is rendered.
*
* origin ::
* A pointer to a vector used to translate the glyph image before
* rendering. Can be~0 (if no translation). The origin is expressed
* in 26.6 pixels.
*
* destroy ::
* A boolean that indicates that the original glyph image should be
* destroyed by this function. It is never destroyed in case of error.
*
* @return:
* FreeType error code. 0~means success.
*
* @note:
* This function does nothing if the glyph format isn't scalable.
*
* The glyph image is translated with the `origin` vector before
* rendering.
*
* The first parameter is a pointer to an @FT_Glyph handle, that will be
* _replaced_ by this function (with newly allocated data). Typically,
* you would use (omitting error handling):
*
* ```
* FT_Glyph glyph;
* FT_BitmapGlyph glyph_bitmap;
*
*
* // load glyph
* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT );
*
* // extract glyph image
* error = FT_Get_Glyph( face->glyph, &glyph );
*
* // convert to a bitmap (default render mode + destroying old)
* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
* {
* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,
* 0, 1 );
* if ( error ) // `glyph' unchanged
* ...
* }
*
* // access bitmap content by typecasting
* glyph_bitmap = (FT_BitmapGlyph)glyph;
*
* // do funny stuff with it, like blitting/drawing
* ...
*
* // discard glyph image (bitmap or not)
* FT_Done_Glyph( glyph );
* ```
*
* Here is another example, again without error handling:
*
* ```
* FT_Glyph glyphs[MAX_GLYPHS]
*
*
* ...
*
* for ( idx = 0; i < MAX_GLYPHS; i++ )
* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||
* FT_Get_Glyph ( face->glyph, &glyphs[idx] );
*
* ...
*
* for ( idx = 0; i < MAX_GLYPHS; i++ )
* {
* FT_Glyph bitmap = glyphs[idx];
*
*
* ...
*
* // after this call, `bitmap' no longer points into
* // the `glyphs' array (and the old value isn't destroyed)
* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );
*
* ...
*
* FT_Done_Glyph( bitmap );
* }
*
* ...
*
* for ( idx = 0; i < MAX_GLYPHS; i++ )
* FT_Done_Glyph( glyphs[idx] );
* ```
*/
FT_EXPORT( FT_Error )
FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
FT_Render_Mode render_mode,
FT_Vector* origin,
FT_Bool destroy );
/**************************************************************************
*
* @function:
* FT_Done_Glyph
*
* @description:
* Destroy a given glyph.
*
* @input:
* glyph ::
* A handle to the target glyph object.
*/
FT_EXPORT( void )
FT_Done_Glyph( FT_Glyph glyph );
/* */
/* other helpful functions */
/**************************************************************************
*
* @section:
* computations
*
*/
/**************************************************************************
*
* @function:
* FT_Matrix_Multiply
*
* @description:
* Perform the matrix operation `b = a*b`.
*
* @input:
* a ::
* A pointer to matrix `a`.
*
* @inout:
* b ::
* A pointer to matrix `b`.
*
* @note:
* The result is undefined if either `a` or `b` is zero.
*
* Since the function uses wrap-around arithmetic, results become
* meaningless if the arguments are very large.
*/
FT_EXPORT( void )
FT_Matrix_Multiply( const FT_Matrix* a,
FT_Matrix* b );
/**************************************************************************
*
* @function:
* FT_Matrix_Invert
*
* @description:
* Invert a 2x2 matrix. Return an error if it can't be inverted.
*
* @inout:
* matrix ::
* A pointer to the target matrix. Remains untouched in case of error.
*
* @return:
* FreeType error code. 0~means success.
*/
FT_EXPORT( FT_Error )
FT_Matrix_Invert( FT_Matrix* matrix );
/* */
FT_END_HEADER
#endif /* FTGLYPH_H_ */
/* END */
/* Local Variables: */
/* coding: utf-8 */
/* End: */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment