freetype2/include/freetype/t1tables.h

392 lines
14 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* t1tables.h */
/* */
/* Basic Type 1/Type 2 tables definitions and interface (specification */
/* only). */
/* */
Avoid overwriting of numeric font dictionary entries for synthetic fonts. Additionally, some entries were handled as `integer' instead of `number'. * include/freetype/internal/psaux.h (T1_FieldType): Add T1_FIELD_TYPE_BOOL_P, T1_FIELD_TYPE_INTEGER_P, and T1_FIELD_TYPE_FIXED_P. (T1_FIELD_BOOL_P, T1_FIELD_NUM_P, T1_FIELD_FIXED_P): New macros. * src/psaux/psobjs.c (ps_parser_load_field): Handle new field types. * include/freetype/internal/cfftypes.h (CFF_FontRecDict), src/cff/cfftoken.h: Change type of underline_position and underline_thickness to FT_Fixed. * src/cff/cffload.c (cff_subfont_load): Fix default values of underline_position and underline_thickness. * src/cff/cffobjs.c (cff_face_init): Set underline_position and underline_thickness in `root'. * include/freetype/internal/t1types.h (T1_Font): Change point_type and stroke_width to pointers. * include/freetype/t1tables.h (PS_FontInfo): Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. * src/type1/t1tokens.h: Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. Change the type of the latter two to `fixed'. Change type of stroke_width to `fixed' and make it a pointer. Change paint_type to pointer. * src/type1/t1objs.c (T1_Face_Done): Updated. (T1_Face_Init): Updated. Fix assignment of underline_position and underline_thickness. * src/cid/cidtoken.h: Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. Change the type of the latter two to `fixed'. Change type of stroke_width to `fixed'. * src/cid/cidobjs.c (cid_face_done): Updated. (cid_face_init): Updated. Fix assignment of underline_position and underline_thickness. * src/type42/t42parse.c: Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. Change the type of the latter two to `fixed'. Change type of stroke_width to `fixed' and make it a pointer. Change paint_type to pointer. * src/type42/t42objs.c (T42_Face_Init): Updated. Fix assignment of underline_position and underline_thickness. (T42_Face_Done): Updated. * src/base/ftobjs.c (open_face_from_buffer): Fix compiler warning. * src/pshinter/pshglob.c, src/pshinter/pshglob.h (psh_globals_set_scale): Make it a local function. * test/gview.c: Fix remaming ps3->ps typo. Formatting.
2003-05-30 11:12:50 +02:00
/* Copyright 1996-2001, 2002, 2003 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 __T1TABLES_H__
#define __T1TABLES_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* type1_tables */
/* */
/* <Title> */
/* Type 1 Tables */
/* */
/* <Abstract> */
/* Type 1 (PostScript) specific font tables. */
/* */
/* <Description> */
/* This section contains the definition of Type 1-specific tables, */
/* including structures related to other PostScript font formats. */
/* */
/*************************************************************************/
/* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */
/* structures in order to support Multiple Master fonts. */
/*************************************************************************/
/* */
/* <Struct> */
/* PS_FontInfoRec */
/* */
/* <Description> */
/* A structure used to model a Type1/Type2 FontInfo dictionary. Note */
/* that for Multiple Master fonts, each instance has its own */
/* FontInfo. */
/* */
typedef struct PS_FontInfoRec
{
FT_String* version;
FT_String* notice;
FT_String* full_name;
FT_String* family_name;
FT_String* weight;
Avoid overwriting of numeric font dictionary entries for synthetic fonts. Additionally, some entries were handled as `integer' instead of `number'. * include/freetype/internal/psaux.h (T1_FieldType): Add T1_FIELD_TYPE_BOOL_P, T1_FIELD_TYPE_INTEGER_P, and T1_FIELD_TYPE_FIXED_P. (T1_FIELD_BOOL_P, T1_FIELD_NUM_P, T1_FIELD_FIXED_P): New macros. * src/psaux/psobjs.c (ps_parser_load_field): Handle new field types. * include/freetype/internal/cfftypes.h (CFF_FontRecDict), src/cff/cfftoken.h: Change type of underline_position and underline_thickness to FT_Fixed. * src/cff/cffload.c (cff_subfont_load): Fix default values of underline_position and underline_thickness. * src/cff/cffobjs.c (cff_face_init): Set underline_position and underline_thickness in `root'. * include/freetype/internal/t1types.h (T1_Font): Change point_type and stroke_width to pointers. * include/freetype/t1tables.h (PS_FontInfo): Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. * src/type1/t1tokens.h: Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. Change the type of the latter two to `fixed'. Change type of stroke_width to `fixed' and make it a pointer. Change paint_type to pointer. * src/type1/t1objs.c (T1_Face_Done): Updated. (T1_Face_Init): Updated. Fix assignment of underline_position and underline_thickness. * src/cid/cidtoken.h: Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. Change the type of the latter two to `fixed'. Change type of stroke_width to `fixed'. * src/cid/cidobjs.c (cid_face_done): Updated. (cid_face_init): Updated. Fix assignment of underline_position and underline_thickness. * src/type42/t42parse.c: Change italic_angle, is_fixed_pitch, underline_position, and underline_thickness to pointers. Change the type of the latter two to `fixed'. Change type of stroke_width to `fixed' and make it a pointer. Change paint_type to pointer. * src/type42/t42objs.c (T42_Face_Init): Updated. Fix assignment of underline_position and underline_thickness. (T42_Face_Done): Updated. * src/base/ftobjs.c (open_face_from_buffer): Fix compiler warning. * src/pshinter/pshglob.c, src/pshinter/pshglob.h (psh_globals_set_scale): Make it a local function. * test/gview.c: Fix remaming ps3->ps typo. Formatting.
2003-05-30 11:12:50 +02:00
FT_Fixed* italic_angle;
FT_Bool* is_fixed_pitch;
FT_Fixed* underline_position;
FT_Fixed* underline_thickness;
2000-05-17 01:44:38 +02:00
} PS_FontInfoRec, *PS_FontInfo;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_FontInfo */
/* */
/* <Description> */
/* This type is equivalent to @PS_FontInfoRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef PS_FontInfoRec T1_FontInfo;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_PrivateRec */
/* */
/* <Description> */
/* A structure used to model a Type1/Type2 private dictionary. Note */
/* that for Multiple Master fonts, each instance has its own Private */
/* dictionary. */
2000-07-11 08:50:03 +02:00
/* */
typedef struct PS_PrivateRec_
{
FT_Int unique_id;
FT_Int lenIV;
FT_Byte num_blue_values;
FT_Byte num_other_blues;
FT_Byte num_family_blues;
FT_Byte num_family_other_blues;
FT_Short blue_values[14];
FT_Short other_blues[10];
FT_Short family_blues [14];
FT_Short family_other_blues[10];
FT_Fixed blue_scale;
FT_Int blue_shift;
FT_Int blue_fuzz;
FT_UShort standard_width[1];
FT_UShort standard_height[1];
FT_Byte num_snap_widths;
FT_Byte num_snap_heights;
FT_Bool force_bold;
FT_Bool round_stem_up;
FT_Short snap_widths [13]; /* including std width */
FT_Short snap_heights[13]; /* including std height */
FT_Long language_group;
FT_Long password;
FT_Short min_feature[2];
2000-05-17 01:44:38 +02:00
} PS_PrivateRec, *PS_Private;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Private */
/* */
/* <Description> */
/* This type is equivalent to @PS_PrivateRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef PS_PrivateRec T1_Private;
2000-05-03 20:15:52 +02:00
/*************************************************************************/
/* */
/* <Enum> */
/* T1_Blend_Flags */
/* */
/* <Description> */
/* A set of flags used to indicate which fields are present in a */
/* given blen dictionary (font info or private). Used to support */
/* Multiple Masters fonts. */
/* */
typedef enum
{
/*# required fields in a FontInfo blend dictionary */
T1_BLEND_UNDERLINE_POSITION = 0,
T1_BLEND_UNDERLINE_THICKNESS,
T1_BLEND_ITALIC_ANGLE,
2000-05-17 01:44:38 +02:00
/*# required fields in a Private blend dictionary */
T1_BLEND_BLUE_VALUES,
T1_BLEND_OTHER_BLUES,
T1_BLEND_STANDARD_WIDTH,
T1_BLEND_STANDARD_HEIGHT,
T1_BLEND_STEM_SNAP_WIDTHS,
T1_BLEND_STEM_SNAP_HEIGHTS,
T1_BLEND_BLUE_SCALE,
T1_BLEND_BLUE_SHIFT,
T1_BLEND_FAMILY_BLUES,
T1_BLEND_FAMILY_OTHER_BLUES,
T1_BLEND_FORCE_BOLD,
/*# never remove */
T1_BLEND_MAX
2000-05-17 01:44:38 +02:00
} T1_Blend_Flags;
/*# backwards compatible definitions */
#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION
#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS
#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE
#define t1_blend_blue_values T1_BLEND_BLUE_VALUES
#define t1_blend_other_blues T1_BLEND_OTHER_BLUES
#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH
#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT
#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS
#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS
#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE
#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT
#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES
#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES
#define t1_blend_force_bold T1_BLEND_FORCE_BOLD
#define t1_blend_max T1_BLEND_MAX
/* maximum number of Multiple Masters designs, as defined in the spec */
#define T1_MAX_MM_DESIGNS 16
/* maximum number of Multiple Masters axes, as defined in the spec */
#define T1_MAX_MM_AXIS 4
/* maximum number of elements in a design map */
#define T1_MAX_MM_MAP_POINTS 20
/* this structure is used to store the BlendDesignMap entry for an axis */
typedef struct PS_DesignMap_
{
FT_Byte num_points;
FT_Fixed* design_points;
FT_Fixed* blend_points;
} PS_DesignMapRec, *PS_DesignMap;
/* backwards-compatible definition */
typedef PS_DesignMapRec T1_DesignMap;
typedef struct PS_BlendRec_
{
FT_UInt num_designs;
FT_UInt num_axis;
FT_String* axis_names[T1_MAX_MM_AXIS];
FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
PS_DesignMapRec design_map[T1_MAX_MM_AXIS];
FT_Fixed* weight_vector;
FT_Fixed* default_weight_vector;
PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];
PS_Private privates [T1_MAX_MM_DESIGNS + 1];
FT_ULong blend_bitflags;
FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];
} PS_BlendRec, *PS_Blend;
/* backwards-compatible definition */
typedef PS_BlendRec T1_Blend;
typedef struct CID_FaceDictRec_
2000-05-03 20:15:52 +02:00
{
PS_PrivateRec private_dict;
2000-05-03 20:15:52 +02:00
FT_UInt len_buildchar;
FT_Fixed forcebold_threshold;
FT_Pos stroke_width;
FT_Fixed expansion_factor;
FT_Byte paint_type;
FT_Byte font_type;
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_UInt num_subrs;
FT_ULong subrmap_offset;
FT_Int sd_bytes;
2000-05-17 01:44:38 +02:00
} CID_FaceDictRec, *CID_FaceDict;
2000-05-03 20:15:52 +02:00
2000-05-17 01:44:38 +02:00
/* backwards-compatible definition */
typedef CID_FaceDictRec CID_FontDict;
typedef struct CID_FaceInfoRec_
2000-05-03 20:15:52 +02:00
{
FT_String* cid_font_name;
FT_Fixed cid_version;
FT_Int cid_font_type;
2000-05-17 01:44:38 +02:00
FT_String* registry;
FT_String* ordering;
FT_Int supplement;
2000-05-03 20:15:52 +02:00
PS_FontInfoRec font_info;
FT_BBox font_bbox;
FT_ULong uid_base;
2000-05-03 20:15:52 +02:00
FT_Int num_xuid;
FT_ULong xuid[16];
2000-05-17 01:44:38 +02:00
FT_ULong cidmap_offset;
FT_Int fd_bytes;
FT_Int gd_bytes;
FT_ULong cid_count;
2000-05-17 01:44:38 +02:00
FT_Int num_dicts;
CID_FaceDict font_dicts;
2000-05-17 01:44:38 +02:00
FT_ULong data_offset;
} CID_FaceInfoRec, *CID_FaceInfo;
2000-05-03 20:15:52 +02:00
/*************************************************************************/
/* */
/* <Struct> */
/* CID_Info */
/* */
/* <Description> */
/* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
typedef CID_FaceInfoRec CID_Info;
/* */
/************************************************************************
*
* @function:
* FT_Has_PS_Glyph_Names
*
* @description:
* Return true if a given face provides reliable Postscript glyph
* names. This is similar to using the @FT_HAS_GLYPH_NAMES macro,
* except that certain fonts (mostly TrueType) contain incorrect
* glyph name tables.
*
* When this function returns true, the caller is sure that the glyph
* names returned by @FT_Get_Glyph_Name are reliable.
*
* @input:
* face ::
* face handle
*
* @return:
* Boolean. True if glyph names are reliable.
*/
FT_EXPORT( FT_Int )
FT_Has_PS_Glyph_Names( FT_Face face );
/************************************************************************
*
* @function:
* FT_Get_PS_Font_Info
*
* @description:
* Retrieve the @PS_FontInfoRec structure corresponding to a given
* Postscript font.
*
* @input:
* face ::
* Postscript face handle.
*
* @output:
* afont_info ::
* Output font info structure pointer.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The string pointers within the font info structure are owned by
* the face and don't need to be freed by the caller.
*
* If the font's format is not Postscript-based, this function will
* return the @FT_Err_Invalid_Argument error code.
*/
FT_EXPORT( FT_Error )
FT_Get_PS_Font_Info( FT_Face face,
PS_FontInfoRec *afont_info );
/* */
FT_END_HEADER
#endif /* __T1TABLES_H__ */
/* END */