2018-06-03 22:00:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftsnames.h
|
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* Simple interface to access SFNT 'name' tables (which are used
|
2018-06-03 22:00:42 +02:00
|
|
|
* to hold font names, copyright info, notices, etc.) (specification).
|
|
|
|
*
|
|
|
|
* This is _not_ used to retrieve glyph names!
|
|
|
|
*
|
2023-01-17 09:18:25 +01:00
|
|
|
* Copyright (C) 1996-2023 by
|
2018-06-03 22:00:42 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2000-07-19 19:13:03 +02:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef FTSNAMES_H_
|
|
|
|
#define FTSNAMES_H_
|
2000-07-19 19:13:03 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/freetype.h>
|
|
|
|
#include <freetype/ftparams.h>
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2003-11-04 08:44:19 +01:00
|
|
|
#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
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
2000-08-01 15:17:04 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @section:
|
2018-06-03 22:00:42 +02:00
|
|
|
* sfnt_names
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @title:
|
2018-06-03 22:00:42 +02:00
|
|
|
* SFNT Names
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @abstract:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Access the names embedded in TrueType and OpenType files.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* The TrueType and OpenType specifications allow the inclusion of a
|
2019-02-21 09:19:09 +01:00
|
|
|
* special names table ('name') in font files. This table contains
|
2018-08-24 18:52:30 +02:00
|
|
|
* textual (and internationalized) information regarding the font, like
|
|
|
|
* family name, copyright, version, etc.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* The definitions below are used to access them if available.
|
|
|
|
*
|
|
|
|
* Note that this has nothing to do with glyph names!
|
|
|
|
*
|
|
|
|
*/
|
2001-01-11 10:27:49 +01:00
|
|
|
|
2001-01-10 12:15:48 +01:00
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @struct:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_SfntName
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* A structure used to model an SFNT 'name' table entry.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @fields:
|
2018-06-03 22:00:42 +02:00
|
|
|
* platform_id ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* The platform ID for `string`. See @TT_PLATFORM_XXX for possible
|
2018-08-24 18:52:30 +02:00
|
|
|
* values.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* encoding_id ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* The encoding ID for `string`. See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX,
|
2018-08-24 18:52:30 +02:00
|
|
|
* @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX for possible
|
|
|
|
* values.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* language_id ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* The language ID for `string`. See @TT_MAC_LANGID_XXX and
|
2018-08-24 18:52:30 +02:00
|
|
|
* @TT_MS_LANGID_XXX for possible values.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-08-24 18:52:30 +02:00
|
|
|
* Registered OpenType values for `language_id` are always smaller than
|
|
|
|
* 0x8000; values equal or larger than 0x8000 usually indicate a
|
|
|
|
* language tag string (introduced in OpenType version 1.6). Use
|
|
|
|
* function @FT_Get_Sfnt_LangTag with `language_id` as its argument to
|
|
|
|
* retrieve the associated language tag.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* name_id ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* An identifier for `string`. See @TT_NAME_ID_XXX for possible
|
2018-08-24 18:52:30 +02:00
|
|
|
* values.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* string ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* The 'name' string. Note that its format differs depending on the
|
|
|
|
* (platform,encoding) pair, being either a string of bytes (without a
|
2019-02-20 16:18:40 +01:00
|
|
|
* terminating `NULL` byte) or containing UTF-16BE entities.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* string_len ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* The length of `string` in bytes.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @note:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Please refer to the TrueType or OpenType specification for more
|
|
|
|
* details.
|
|
|
|
*/
|
2000-07-20 08:57:41 +02:00
|
|
|
typedef struct FT_SfntName_
|
2000-07-19 19:13:03 +02:00
|
|
|
{
|
|
|
|
FT_UShort platform_id;
|
|
|
|
FT_UShort encoding_id;
|
|
|
|
FT_UShort language_id;
|
|
|
|
FT_UShort name_id;
|
2000-10-24 07:44:59 +02:00
|
|
|
|
2000-10-17 05:38:43 +02:00
|
|
|
FT_Byte* string; /* this string is *not* null-terminated! */
|
2017-01-17 12:39:53 +01:00
|
|
|
FT_UInt string_len; /* in bytes */
|
2000-10-24 07:44:59 +02:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
} FT_SfntName;
|
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_Get_Sfnt_Name_Count
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* Retrieve the number of name strings in the SFNT 'name' table.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* face ::
|
|
|
|
* A handle to the source face.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @return:
|
2019-02-21 09:19:09 +01:00
|
|
|
* The number of strings in the 'name' table.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @note:
|
2018-06-03 22:00:42 +02:00
|
|
|
* This function always returns an error if the config macro
|
2018-08-24 18:52:30 +02:00
|
|
|
* `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.
|
2018-06-03 22:00:42 +02:00
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_UInt )
|
|
|
|
FT_Get_Sfnt_Name_Count( FT_Face face );
|
2000-10-17 05:38:43 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_Get_Sfnt_Name
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* Retrieve a string of the SFNT 'name' table for a given index.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* face ::
|
|
|
|
* A handle to the source face.
|
|
|
|
*
|
|
|
|
* idx ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* The index of the 'name' string.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @output:
|
2018-06-03 22:00:42 +02:00
|
|
|
* aname ::
|
|
|
|
* The indexed @FT_SfntName structure.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @return:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @note:
|
2018-09-04 10:37:44 +02:00
|
|
|
* The `string` array returned in the `aname` structure is not
|
|
|
|
* null-terminated. Note that you don't have to deallocate `string` by
|
2018-08-24 18:52:30 +02:00
|
|
|
* yourself; FreeType takes care of it if you call @FT_Done_Face.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* Use @FT_Get_Sfnt_Name_Count to get the total number of available
|
2019-02-21 09:19:09 +01:00
|
|
|
* 'name' table entries, then do a loop until you get the right platform,
|
2018-08-24 18:52:30 +02:00
|
|
|
* encoding, and name ID.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* 'name' table format~1 entries can use language tags also, see
|
2018-06-03 22:00:42 +02:00
|
|
|
* @FT_Get_Sfnt_LangTag.
|
|
|
|
*
|
|
|
|
* This function always returns an error if the config macro
|
2018-08-24 18:52:30 +02:00
|
|
|
* `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.
|
2018-06-03 22:00:42 +02:00
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Get_Sfnt_Name( FT_Face face,
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt idx,
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_SfntName *aname );
|
2001-01-11 10:27:49 +01:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @struct:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_SfntLangTag
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2019-02-21 09:19:09 +01:00
|
|
|
* A structure to model a language tag entry from an SFNT 'name' table.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @fields:
|
2018-06-03 22:00:42 +02:00
|
|
|
* string ::
|
2019-02-20 16:18:40 +01:00
|
|
|
* The language tag string, encoded in UTF-16BE (without trailing
|
|
|
|
* `NULL` bytes).
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* string_len ::
|
2018-09-04 10:37:44 +02:00
|
|
|
* The length of `string` in **bytes**.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @note:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Please refer to the TrueType or OpenType specification for more
|
|
|
|
* details.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @since:
|
2018-06-03 22:00:42 +02:00
|
|
|
* 2.8
|
|
|
|
*/
|
2017-01-27 00:06:52 +01:00
|
|
|
typedef struct FT_SfntLangTag_
|
|
|
|
{
|
|
|
|
FT_Byte* string; /* this string is *not* null-terminated! */
|
|
|
|
FT_UInt string_len; /* in bytes */
|
|
|
|
|
|
|
|
} FT_SfntLangTag;
|
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_Get_Sfnt_LangTag
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Retrieve the language tag associated with a language ID of an SFNT
|
2019-02-21 09:19:09 +01:00
|
|
|
* 'name' table entry.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* face ::
|
|
|
|
* A handle to the source face.
|
|
|
|
*
|
|
|
|
* langID ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* The language ID, as returned by @FT_Get_Sfnt_Name. This is always a
|
|
|
|
* value larger than 0x8000.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @output:
|
2018-06-03 22:00:42 +02:00
|
|
|
* alangTag ::
|
2019-02-21 09:19:09 +01:00
|
|
|
* The language tag associated with the 'name' table entry's language
|
2018-08-24 18:52:30 +02:00
|
|
|
* ID.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @return:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FreeType error code. 0~means success.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @note:
|
2018-09-04 10:37:44 +02:00
|
|
|
* The `string` array returned in the `alangTag` structure is not
|
|
|
|
* null-terminated. Note that you don't have to deallocate `string` by
|
2018-08-24 18:52:30 +02:00
|
|
|
* yourself; FreeType takes care of it if you call @FT_Done_Face.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2019-02-21 09:19:09 +01:00
|
|
|
* Only 'name' table format~1 supports language tags. For format~0
|
2018-06-03 22:00:42 +02:00
|
|
|
* tables, this function always returns FT_Err_Invalid_Table. For
|
|
|
|
* invalid format~1 language ID values, FT_Err_Invalid_Argument is
|
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* This function always returns an error if the config macro
|
2018-08-24 18:52:30 +02:00
|
|
|
* `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @since:
|
2018-06-03 22:00:42 +02:00
|
|
|
* 2.8
|
|
|
|
*/
|
2017-01-27 00:06:52 +01:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_Get_Sfnt_LangTag( FT_Face face,
|
|
|
|
FT_UInt langID,
|
|
|
|
FT_SfntLangTag *alangTag );
|
|
|
|
|
|
|
|
|
2001-01-10 12:15:48 +01:00
|
|
|
/* */
|
2000-07-19 19:13:03 +02:00
|
|
|
|
2001-01-11 10:27:49 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
2000-08-01 15:17:04 +02:00
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* FTSNAMES_H_ */
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|