freetype2/include/internal/t1types.h

256 lines
9.6 KiB
C
Raw Normal View History

2000-07-19 04:59:31 +02:00
/***************************************************************************/
/* */
/* t1types.h */
/* */
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 by */
2000-07-19 04:59:31 +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. */
/* */
/***************************************************************************/
1999-12-17 00:11:37 +01:00
#ifndef __T1TYPES_H__
#define __T1TYPES_H__
1999-12-17 00:11:37 +01:00
* src/type42/t42drivr.c: s/T42_ENCODING_TYPE_/T1_ENCODING_TYPE_/. (parse_font_matrix): Remove unnecessary code. (parse_sfnts): Initialize some variables. (t42_driver_class) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Use ft_module_driver_has_hinter conditionally. Moved some type 42 specific structure definitions to... * include/freetype/internal/t42types.h: New file. * include/freetype/internal/internal.h (FT_INTERNAL_T42_TYPES_H): New macro. * include/freetype/cache/ftcsbits.h (FTC_SBit): Added a new field `num_grays' for specifying the number of used gray levels. * src/cache/ftcsbits.c (ftc_sbit_node_load): Initialize it. Adding a driver for BDF fonts written by Francesco Zappa Nardelli <Francesco.Zappa.Nardelli@ens.fr>. Heavily modified by me to better adapt it to FreeType, removing unneeded stuff. Additionally, it now supports Mark Leisher's BDF extension for anti-aliased bitmap glyphs with 2 and 4 bpp. * src/bdf/*: New driver. * include/freetype/internal/bdftypes.h: New file. * include/freetype/internal/fttrace.h: Added BDF driver components. * include/freetype/fterrdef.h: Added error codes for BDF driver. * include/freetype/config/ftmodule.h, src/Jamfile: Updated. * include/freetype/internal/internal.h (FT_INTERNAL_BDF_TYPES_H): New macro. * include/freetype/config/ftstdlib.h (ft_sprintf): New alias for sprintf. * include/freetype/internal/fttrace.h: Added Type 42 driver component. * src/type42/t42drivr.c: Use it. * include/freetype/internal/internal.h (FT_INTERNAL_PCF_TYPES_H): New macro.
2002-05-21 16:13:01 +02:00
#include <ft2build.h>
#include FT_TYPE1_TABLES_H
2001-10-18 13:49:26 +02:00
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include FT_INTERNAL_SERVICE_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
2000-07-19 04:59:31 +02:00
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* T1_EncodingRec */
2000-07-19 04:59:31 +02:00
/* */
/* <Description> */
/* A structure modeling a custom encoding. */
2000-07-19 04:59:31 +02:00
/* */
/* <Fields> */
/* num_chars :: The number of character codes in the encoding. */
/* Usually 256. */
/* */
/* code_first :: The lowest valid character code in the encoding. */
/* */
/* code_last :: The highest valid character code in the encoding */
/* + 1. When equal to code_first there are no valid */
/* character codes. */
2000-07-19 04:59:31 +02:00
/* */
/* char_index :: An array of corresponding glyph indices. */
/* */
/* char_name :: An array of corresponding glyph names. */
/* */
typedef struct T1_EncodingRecRec_
{
2000-07-19 04:59:31 +02:00
FT_Int num_chars;
FT_Int code_first;
FT_Int code_last;
2000-07-19 04:59:31 +02:00
FT_UShort* char_index;
FT_String** char_name;
} T1_EncodingRec, *T1_Encoding;
/* used to hold extra data of PS_FontInfoRec that
* cannot be stored in the publicly defined structure.
*
* Note these can't be blended with multiple-masters.
*/
2009-03-03 22:35:32 +01:00
typedef struct PS_FontExtraRec_
{
2009-03-03 22:35:32 +01:00
FT_UShort fs_type;
} PS_FontExtraRec;
2009-03-03 22:35:32 +01:00
typedef struct T1_FontRec_
1999-12-17 00:11:37 +01:00
{
2009-03-03 22:35:32 +01:00
PS_FontInfoRec font_info; /* font info dictionary */
PS_FontExtraRec font_extra; /* font info extra fields */
2009-03-03 22:35:32 +01:00
PS_PrivateRec private_dict; /* private dictionary */
FT_String* font_name; /* top-level dictionary */
1999-12-17 00:11:37 +01:00
T1_EncodingType encoding_type;
T1_EncodingRec encoding;
1999-12-17 00:11:37 +01:00
2000-07-19 04:59:31 +02:00
FT_Byte* subrs_block;
FT_Byte* charstrings_block;
FT_Byte* glyph_names_block;
1999-12-17 00:11:37 +01:00
2000-07-19 04:59:31 +02:00
FT_Int num_subrs;
FT_Byte** subrs;
FT_PtrDist* subrs_len;
1999-12-17 00:11:37 +01:00
2000-07-19 04:59:31 +02:00
FT_Int num_glyphs;
FT_String** glyph_names; /* array of glyph names */
FT_Byte** charstrings; /* array of glyph charstrings */
FT_PtrDist* charstrings_len;
1999-12-17 00:11:37 +01:00
FT_Byte paint_type;
2000-07-19 04:59:31 +02:00
FT_Byte font_type;
FT_Matrix font_matrix;
FT_Vector font_offset;
2000-07-19 04:59:31 +02:00
FT_BBox font_bbox;
FT_Long font_id;
1999-12-17 00:11:37 +01:00
FT_Fixed stroke_width;
2000-05-17 01:44:38 +02:00
} T1_FontRec, *T1_Font;
2000-05-17 01:44:38 +02:00
1999-12-17 00:11:37 +01:00
typedef struct CID_SubrsRec_
{
FT_UInt num_subrs;
FT_Byte** code;
2000-10-31 21:42:18 +01:00
} CID_SubrsRec, *CID_Subrs;
1999-12-17 00:11:37 +01:00
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** AFM FONT INFORMATION STRUCTURES ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
typedef struct AFM_TrackKernRec_
{
FT_Int degree;
FT_Fixed min_ptsize;
FT_Fixed min_kern;
FT_Fixed max_ptsize;
FT_Fixed max_kern;
} AFM_TrackKernRec, *AFM_TrackKern;
typedef struct AFM_KernPairRec_
{
FT_Int index1;
FT_Int index2;
FT_Int x;
FT_Int y;
} AFM_KernPairRec, *AFM_KernPair;
typedef struct AFM_FontInfoRec_
{
FT_Bool IsCIDFont;
FT_BBox FontBBox;
FT_Fixed Ascender;
FT_Fixed Descender;
AFM_TrackKern TrackKerns; /* free if non-NULL */
FT_Int NumTrackKern;
AFM_KernPair KernPairs; /* free if non-NULL */
FT_Int NumKernPair;
} AFM_FontInfoRec, *AFM_FontInfo;
2000-07-19 04:59:31 +02:00
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** ORIGINAL T1_FACE CLASS DEFINITION ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
1999-12-17 00:11:37 +01:00
typedef struct T1_FaceRec_* T1_Face;
typedef struct CID_FaceRec_* CID_Face;
1999-12-17 00:11:37 +01:00
2000-07-19 04:59:31 +02:00
typedef struct T1_FaceRec_
1999-12-17 00:11:37 +01:00
{
FT_FaceRec root;
T1_FontRec type1;
const void* psnames;
const void* psaux;
const void* afm_data;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];
2000-07-19 04:59:31 +02:00
/* support for Multiple Masters fonts */
PS_Blend blend;
* freetype2/include/freetype/internal/psaux.h: New macros IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h). (T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER, T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND. (T1_DecoderRec): New fields `buildchar' and `face'. (IS_PS_TOKEN): New macro. * freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New fields `ndv_idx', `cdv_idx', and `len_buildchar'. * freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields `default_design_vector' and `num_default_design_vector'. * freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h. * freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow `token' argument to be NULL if we want only to count the number of tokens. (ps_tocoordarray): Allow `coords' argument to be NULL if we just want to skip the array. (ps_tofixedarray): Allow `values' argument to be NULL if we just want to skip the array. * freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add support for (partially commented out) othersubrs 19-25, 27, and 28. (t1_decoder_init): Initialize new fields `face' and `buildchar'. (t1_decoder_done): Release new field `buildchar'. * freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New functions. (t1_keywords): Register them. (t1_allocate_blend): Updated. (t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER, T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND. (parse_dict): Remove `keyword_flags' argument. Use new macro IS_PS_TOKEN. Changed function so that later PostScript definitions override earlier ones. (t1_init_loader): Initialize new field `keywords_encountered'. (T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and `len_buildchar'. Remove `keywords_flags'. * freetype2/src/type1/t1load.h (T1_LoaderRect): New field `keywords_encountered'. (T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros. * freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]: New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
/* undocumented, optional: indices of subroutines that express */
/* the NormalizeDesignVector and the ConvertDesignVector procedure, */
/* respectively, as Type 2 charstrings; -1 if keywords not present */
FT_Int ndv_idx;
FT_Int cdv_idx;
/* undocumented, optional: has the same meaning as len_buildchar */
/* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */
FT_UInt len_buildchar;
FT_Long* buildchar;
* freetype2/include/freetype/internal/psaux.h: New macros IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h). (T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER, T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND. (T1_DecoderRec): New fields `buildchar' and `face'. (IS_PS_TOKEN): New macro. * freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New fields `ndv_idx', `cdv_idx', and `len_buildchar'. * freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields `default_design_vector' and `num_default_design_vector'. * freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h. * freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow `token' argument to be NULL if we want only to count the number of tokens. (ps_tocoordarray): Allow `coords' argument to be NULL if we just want to skip the array. (ps_tofixedarray): Allow `values' argument to be NULL if we just want to skip the array. * freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add support for (partially commented out) othersubrs 19-25, 27, and 28. (t1_decoder_init): Initialize new fields `face' and `buildchar'. (t1_decoder_done): Release new field `buildchar'. * freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New functions. (t1_keywords): Register them. (t1_allocate_blend): Updated. (t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER, T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND. (parse_dict): Remove `keyword_flags' argument. Use new macro IS_PS_TOKEN. Changed function so that later PostScript definitions override earlier ones. (t1_init_loader): Initialize new field `keywords_encountered'. (T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and `len_buildchar'. Remove `keywords_flags'. * freetype2/src/type1/t1load.h (T1_LoaderRect): New field `keywords_encountered'. (T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros. * freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]: New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
/* since version 2.1 - interface to PostScript hinter */
const void* pshinter;
1999-12-17 00:11:37 +01:00
} T1_FaceRec;
2000-07-19 04:59:31 +02:00
typedef struct CID_FaceRec_
{
FT_FaceRec root;
void* psnames;
void* psaux;
CID_FaceInfoRec cid;
PS_FontExtraRec font_extra;
#if 0
void* afm_data;
#endif
CID_Subrs subrs;
/* since version 2.1 - interface to PostScript hinter */
void* pshinter;
2000-10-31 21:42:18 +01:00
/* since version 2.1.8, but was originally positioned after `afm_data' */
FT_Byte* binary_data; /* used if hex data has been converted */
FT_Stream cid_stream;
} CID_FaceRec;
2000-06-27 07:58:22 +02:00
FT_END_HEADER
#endif /* __T1TYPES_H__ */
2000-06-27 07:58:22 +02:00
/* END */