2005-03-03 18:09:08 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* aflatin.h */
|
|
|
|
/* */
|
|
|
|
/* Auto-fitter hinting routines for latin script (specification). */
|
|
|
|
/* */
|
2007-04-03 09:19:53 +02:00
|
|
|
/* Copyright 2003, 2004, 2005, 2006, 2007 by */
|
2005-03-03 18:09:08 +01: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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2003-10-02 23:07:10 +02:00
|
|
|
#ifndef __AFLATIN_H__
|
|
|
|
#define __AFLATIN_H__
|
|
|
|
|
|
|
|
#include "afhints.h"
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2003-10-02 23:07:10 +02:00
|
|
|
FT_BEGIN_HEADER
|
2004-01-16 10:51:00 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
|
|
|
/* the latin-specific script class */
|
|
|
|
|
|
|
|
FT_CALLBACK_TABLE const AF_ScriptClassRec
|
|
|
|
af_latin_script_class;
|
|
|
|
|
|
|
|
|
2006-02-11 13:12:02 +01:00
|
|
|
/* constants are given with units_per_em == 2048 in mind */
|
|
|
|
#define AF_LATIN_CONSTANT( metrics, c ) \
|
2006-02-12 22:49:21 +01:00
|
|
|
( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
|
|
|
|
|
2006-02-11 13:12:02 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** L A T I N G L O B A L M E T R I C S *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following declarations could be embedded in the file `aflatin.c';
|
|
|
|
* they have been made semi-public to allow alternate script hinters to
|
|
|
|
* re-use some of them.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Latin (global) metrics management */
|
2003-11-23 22:39:51 +01:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
AF_LATIN_BLUE_CAPITAL_TOP,
|
|
|
|
AF_LATIN_BLUE_CAPITAL_BOTTOM,
|
|
|
|
AF_LATIN_BLUE_SMALL_F_TOP,
|
|
|
|
AF_LATIN_BLUE_SMALL_TOP,
|
|
|
|
AF_LATIN_BLUE_SMALL_BOTTOM,
|
|
|
|
AF_LATIN_BLUE_SMALL_MINOR,
|
2004-01-16 10:51:00 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
AF_LATIN_BLUE_MAX
|
|
|
|
};
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
#define AF_LATIN_IS_TOP_BLUE( b ) ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \
|
|
|
|
(b) == AF_LATIN_BLUE_SMALL_F_TOP || \
|
|
|
|
(b) == AF_LATIN_BLUE_SMALL_TOP )
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
#define AF_LATIN_MAX_WIDTHS 16
|
|
|
|
#define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX
|
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2005-03-03 18:09:08 +01:00
|
|
|
AF_LATIN_BLUE_ACTIVE = 1 << 0,
|
|
|
|
AF_LATIN_BLUE_TOP = 1 << 1,
|
|
|
|
AF_LATIN_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */
|
|
|
|
/* optimization */
|
2003-12-24 19:42:04 +01:00
|
|
|
AF_LATIN_BLUE_FLAG_MAX
|
2003-11-23 22:39:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
typedef struct AF_LatinBlueRec_
|
2003-11-23 22:39:51 +01:00
|
|
|
{
|
2005-03-02 12:24:23 +01:00
|
|
|
AF_WidthRec ref;
|
|
|
|
AF_WidthRec shoot;
|
|
|
|
FT_UInt flags;
|
2004-01-16 10:51:00 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
} AF_LatinBlueRec, *AF_LatinBlue;
|
|
|
|
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
typedef struct AF_LatinAxisRec_
|
2003-10-02 23:07:10 +02:00
|
|
|
{
|
2003-11-23 22:39:51 +01:00
|
|
|
FT_Fixed scale;
|
|
|
|
FT_Pos delta;
|
2004-01-16 10:51:00 +01:00
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
FT_UInt width_count;
|
2005-03-02 12:24:23 +01:00
|
|
|
AF_WidthRec widths[AF_LATIN_MAX_WIDTHS];
|
2003-11-23 22:39:51 +01:00
|
|
|
FT_Pos edge_distance_threshold;
|
2007-04-02 15:13:54 +02:00
|
|
|
FT_Pos standard_width;
|
|
|
|
FT_Bool extra_light;
|
2004-01-16 10:51:00 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/* ignored for horizontal metrics */
|
2003-11-23 22:39:51 +01:00
|
|
|
FT_Bool control_overshoot;
|
|
|
|
FT_UInt blue_count;
|
2005-03-02 12:24:23 +01:00
|
|
|
AF_LatinBlueRec blues[AF_LATIN_BLUE_MAX];
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2004-02-01 17:59:06 +01:00
|
|
|
FT_Fixed org_scale;
|
|
|
|
FT_Pos org_delta;
|
|
|
|
|
2003-10-02 23:07:10 +02:00
|
|
|
} AF_LatinAxisRec, *AF_LatinAxis;
|
2003-11-23 22:39:51 +01:00
|
|
|
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
typedef struct AF_LatinMetricsRec_
|
2003-10-02 23:07:10 +02:00
|
|
|
{
|
2005-03-02 12:24:23 +01:00
|
|
|
AF_ScriptMetricsRec root;
|
|
|
|
FT_UInt units_per_em;
|
|
|
|
AF_LatinAxisRec axis[AF_DIMENSION_MAX];
|
2004-01-16 10:51:00 +01:00
|
|
|
|
2003-10-02 23:07:10 +02:00
|
|
|
} AF_LatinMetricsRec, *AF_LatinMetrics;
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
af_latin_metrics_init( AF_LatinMetrics metrics,
|
|
|
|
FT_Face face );
|
|
|
|
|
|
|
|
FT_LOCAL( void )
|
|
|
|
af_latin_metrics_scale( AF_LatinMetrics metrics,
|
|
|
|
AF_Scaler scaler );
|
|
|
|
|
2006-02-09 15:17:04 +01:00
|
|
|
FT_LOCAL( void )
|
|
|
|
af_latin_metrics_init_widths( AF_LatinMetrics metrics,
|
|
|
|
FT_Face face,
|
|
|
|
FT_ULong charcode );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** L A T I N G L Y P H A N A L Y S I S *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2003-12-24 19:42:04 +01:00
|
|
|
enum
|
|
|
|
{
|
2005-03-03 18:09:08 +01:00
|
|
|
AF_LATIN_HINTS_HORZ_SNAP = 1 << 0, /* enable stem width snapping */
|
|
|
|
AF_LATIN_HINTS_VERT_SNAP = 1 << 1, /* enable stem height snapping */
|
|
|
|
AF_LATIN_HINTS_STEM_ADJUST = 1 << 2, /* enable stem width/height */
|
|
|
|
/* adjustment */
|
|
|
|
AF_LATIN_HINTS_MONO = 1 << 3 /* indicate monochrome */
|
|
|
|
/* rendering */
|
2003-12-24 19:42:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
#define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \
|
|
|
|
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
|
2003-12-24 19:42:04 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
#define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \
|
|
|
|
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
|
2003-12-24 19:42:04 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
#define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \
|
|
|
|
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
|
2003-12-24 19:42:04 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
#define AF_LATIN_HINTS_DO_MONO( h ) \
|
|
|
|
AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This shouldn't normally be exported. However, other scripts might
|
|
|
|
* like to use this function as-is.
|
|
|
|
*/
|
2005-03-01 16:48:29 +01:00
|
|
|
FT_LOCAL( FT_Error )
|
2003-11-23 22:39:51 +01:00
|
|
|
af_latin_hints_compute_segments( AF_GlyphHints hints,
|
|
|
|
AF_Dimension dim );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/*
|
|
|
|
* This shouldn't normally be exported. However, other scripts might
|
|
|
|
* want to use this function as-is.
|
|
|
|
*/
|
2003-10-02 23:07:10 +02:00
|
|
|
FT_LOCAL( void )
|
2003-11-23 22:39:51 +01:00
|
|
|
af_latin_hints_link_segments( AF_GlyphHints hints,
|
|
|
|
AF_Dimension dim );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
/*
|
|
|
|
* This shouldn't normally be exported. However, other scripts might
|
|
|
|
* want to use this function as-is.
|
|
|
|
*/
|
2005-03-01 16:48:29 +01:00
|
|
|
FT_LOCAL( FT_Error )
|
2003-11-23 22:39:51 +01:00
|
|
|
af_latin_hints_compute_edges( AF_GlyphHints hints,
|
|
|
|
AF_Dimension dim );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2005-03-01 16:48:29 +01:00
|
|
|
FT_LOCAL( FT_Error )
|
2003-11-23 22:39:51 +01:00
|
|
|
af_latin_hints_detect_features( AF_GlyphHints hints,
|
|
|
|
AF_Dimension dim );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
|
|
|
#endif /* __AFLATIN_H__ */
|
2005-03-02 12:24:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|