📄 ahtypes.h
字号:
/***************************************************************************//* *//* ahtypes.h *//* *//* General types and definitions for the auto-hint module *//* (specification only). *//* *//* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. *//* Author: David Turner *//* *//* This file is part of the Catharon Typography Project and shall only *//* be used, modified, and distributed under the terms of the Catharon *//* Open Source License that should come with this file under the name *//* `CatharonLicense.txt'. By continuing to use, modify, or distribute *//* this file you indicate that you have read the license and *//* understand and accept it fully. *//* *//* Note that this license is compatible with the FreeType license. *//* *//***************************************************************************/#ifndef __AHTYPES_H__#define __AHTYPES_H__#include <ft2build.h>#include FT_INTERNAL_OBJECTS_H#ifdef DEBUG_HINTER#include <../src/autohint/ahloader.h>#else#include "ahloader.h"#endif#define xxAH_DEBUG#ifdef AH_DEBUG#include <stdio.h>#define AH_LOG( x ) printf ## x#else#define AH_LOG( x ) do ; while ( 0 ) /* nothing */#endif /* AH_DEBUG */FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** COMPILE-TIME BUILD OPTIONS ****/ /**** ****/ /**** Toggle these configuration macros to experiment with `features' ****/ /**** of the auto-hinter. ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* If this option is defined, only strong interpolation will be used to */ /* place the points between edges. Otherwise, `smooth' points are */ /* detected and later hinted through weak interpolation to correct some */ /* unpleasant artefacts. */ /* */#undef AH_OPTION_NO_WEAK_INTERPOLATION /*************************************************************************/ /* */ /* Undefine this macro if you don't want to hint the metrics. There is */ /* no reason to do this (at least for non-CJK scripts), except for */ /* experimentation. */ /* */#undef AH_HINT_METRICS /*************************************************************************/ /* */ /* Define this macro if you do not want to insert extra edges at a */ /* glyph's x and y extremum (if there isn't one already available). */ /* This helps to reduce a number of artefacts and allows hinting of */ /* metrics. */ /* */#undef AH_OPTION_NO_EXTREMUM_EDGES /* don't touch for now */#define AH_MAX_WIDTHS 12#define AH_MAX_HEIGHTS 12 /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** TYPE DEFINITIONS ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* see ahangles.h */ typedef FT_Int AH_Angle; /* hint flags */#define AH_FLAG_NONE 0 /* bezier control points flags */#define AH_FLAG_CONIC 1#define AH_FLAG_CUBIC 2#define AH_FLAG_CONTROL ( AH_FLAG_CONIC | AH_FLAG_CUBIC ) /* extrema flags */#define AH_FLAG_EXTREMA_X 4#define AH_FLAG_EXTREMA_Y 8 /* roundness */#define AH_FLAG_ROUND_X 16#define AH_FLAG_ROUND_Y 32 /* touched */#define AH_FLAG_TOUCH_X 64#define AH_FLAG_TOUCH_Y 128 /* weak interpolation */#define AH_FLAG_WEAK_INTERPOLATION 256#define AH_FLAG_INFLECTION 512 typedef FT_Int AH_Flags; /* edge hint flags */#define AH_EDGE_NORMAL 0#define AH_EDGE_ROUND 1#define AH_EDGE_SERIF 2#define AH_EDGE_DONE 4 typedef FT_Int AH_Edge_Flags; /* hint directions -- the values are computed so that two vectors are */ /* in opposite directions iff `dir1+dir2 == 0' */#define AH_DIR_NONE 4#define AH_DIR_RIGHT 1#define AH_DIR_LEFT -1#define AH_DIR_UP 2#define AH_DIR_DOWN -2 typedef FT_Int AH_Direction; typedef struct AH_PointRec_* AH_Point; typedef struct AH_SegmentRec_* AH_Segment; typedef struct AH_EdgeRec_* AH_Edge; /*************************************************************************/ /* */ /* <Struct> */ /* AH_PointRec */ /* */ /* <Description> */ /* A structure used to model an outline point to the AH_OutlineRec */ /* type. */ /* */ /* <Fields> */ /* flags :: The current point hint flags. */ /* */ /* ox, oy :: The current original scaled coordinates. */ /* */ /* fx, fy :: The current coordinates in font units. */ /* */ /* x, y :: The current hinted coordinates. */ /* */ /* u, v :: Point coordinates -- meaning varies with context. */ /* */ /* in_dir :: The direction of the inwards vector (prev->point). */ /* */ /* out_dir :: The direction of the outwards vector (point->next). */ /* */ /* next :: The next point in same contour. */ /* */ /* prev :: The previous point in same contour. */ /* */ typedef struct AH_PointRec_ { AH_Flags flags; /* point flags used by hinter */ FT_Pos ox, oy; FT_Pos fx, fy; FT_Pos x, y; FT_Pos u, v; AH_Direction in_dir; /* direction of inwards vector */ AH_Direction out_dir; /* direction of outwards vector */ AH_Point next; /* next point in contour */ AH_Point prev; /* previous point in contour */ } AH_PointRec; /*************************************************************************/ /* */ /* <Struct> */ /* AH_SegmentRec */ /* */ /* <Description> */ /* A structure used to describe an edge segment to the auto-hinter. */ /* A segment is simply a sequence of successive points located on the */ /* same horizontal or vertical `position', in a given direction. */ /* */ /* <Fields> */ /* flags :: The segment edge flags (straight, rounded, etc.). */ /* */ /* dir :: The segment direction. */ /* */ /* min_coord :: The minimum coordinate of the segment. */ /* */ /* max_coord :: The maximum coordinate of the segment. */ /* */ /* edge :: The edge of the current segment. */ /* */ /* edge_next :: The next segment on the same edge. */ /* */ /* link :: The pairing segment for this edge. */ /* */ /* serif :: The primary segment for serifs. */ /* */ /* num_linked :: The number of other segments that link to this one. */ /* */ /* score :: Used to score the segment when selecting them. */ /* */ /* first :: The first point in the segment. */ /* */ /* last :: The last point in the segment. */ /* */ /* contour :: A pointer to the first point of the segment's */ /* contour. */ /* */ typedef struct AH_SegmentRec_ { AH_Edge_Flags flags; AH_Direction dir; FT_Pos pos; /* position of segment */ FT_Pos min_coord; /* minimum coordinate of segment */ FT_Pos max_coord; /* maximum coordinate of segment */ AH_Edge edge; AH_Segment edge_next; AH_Segment link; /* link segment */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -