2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* aflatin.h
|
|
|
|
*
|
|
|
|
* Auto-fitter hinting routines for latin writing system
|
|
|
|
* (specification).
|
|
|
|
*
|
2024-01-27 17:11:22 +01:00
|
|
|
* Copyright (C) 2003-2024 by
|
2018-06-03 09:01:17 +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.
|
|
|
|
*
|
|
|
|
*/
|
2005-03-03 18:09:08 +01:00
|
|
|
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef AFLATIN_H_
|
|
|
|
#define AFLATIN_H_
|
2003-10-02 23:07:10 +02:00
|
|
|
|
|
|
|
#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
|
|
|
|
2013-07-31 22:49:29 +02:00
|
|
|
/* the `latin' writing system */
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2013-07-31 22:49:29 +02:00
|
|
|
AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class )
|
2005-03-02 12:24:23 +01:00
|
|
|
|
2013-07-31 22:49:29 +02:00
|
|
|
|
2011-02-26 17:32:38 +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 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* The following declarations could be embedded in the file `aflatin.c';
|
|
|
|
* they have been made semi-public to allow alternate writing system
|
|
|
|
* hinters to re-use some of them.
|
2005-03-02 12:24:23 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2013-08-25 08:37:47 +02:00
|
|
|
#define AF_LATIN_IS_TOP_BLUE( b ) \
|
|
|
|
( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP )
|
2015-12-09 20:04:18 +01:00
|
|
|
#define AF_LATIN_IS_SUB_TOP_BLUE( b ) \
|
|
|
|
( (b)->properties & AF_BLUE_PROPERTY_LATIN_SUB_TOP )
|
2014-04-28 21:13:14 +02:00
|
|
|
#define AF_LATIN_IS_NEUTRAL_BLUE( b ) \
|
|
|
|
( (b)->properties & AF_BLUE_PROPERTY_LATIN_NEUTRAL )
|
2013-10-19 21:46:03 +02:00
|
|
|
#define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \
|
|
|
|
( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT )
|
2013-09-11 23:08:31 +02:00
|
|
|
#define AF_LATIN_IS_LONG_BLUE( b ) \
|
|
|
|
( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG )
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2005-03-02 12:24:23 +01:00
|
|
|
#define AF_LATIN_MAX_WIDTHS 16
|
|
|
|
|
2003-11-23 22:39:51 +01:00
|
|
|
|
2015-02-19 09:46:48 +01:00
|
|
|
#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
|
|
|
|
#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */
|
2015-12-09 20:04:18 +01:00
|
|
|
#define AF_LATIN_BLUE_SUB_TOP ( 1U << 2 ) /* we have a subscript top */
|
|
|
|
/* blue zone */
|
|
|
|
#define AF_LATIN_BLUE_NEUTRAL ( 1U << 3 ) /* we have neutral blue zone */
|
|
|
|
#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 4 ) /* used for scale adjustment */
|
2015-02-19 09:46:48 +01:00
|
|
|
/* optimization */
|
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;
|
2015-11-08 08:37:51 +01:00
|
|
|
FT_Pos ascender;
|
|
|
|
FT_Pos descender;
|
2005-03-02 12:24:23 +01:00
|
|
|
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
|
|
|
|
2011-02-26 17:32:38 +01:00
|
|
|
FT_UInt width_count; /* number of used widths */
|
|
|
|
AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; /* widths array */
|
|
|
|
FT_Pos edge_distance_threshold; /* used for creating edges */
|
|
|
|
FT_Pos standard_width; /* the default stem thickness */
|
|
|
|
FT_Bool extra_light; /* is standard width very 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_UInt blue_count;
|
2023-09-04 19:22:43 +02:00
|
|
|
AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX_LEN];
|
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
|
|
|
{
|
2013-12-18 12:59:35 +01:00
|
|
|
AF_StyleMetricsRec 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 )
|
2023-05-07 19:54:46 +02:00
|
|
|
af_latin_metrics_init( AF_StyleMetrics metrics,
|
2003-10-02 23:07:10 +02:00
|
|
|
FT_Face face );
|
|
|
|
|
|
|
|
FT_LOCAL( void )
|
2023-05-07 19:54:46 +02:00
|
|
|
af_latin_metrics_scale( AF_StyleMetrics metrics,
|
2003-10-02 23:07:10 +02:00
|
|
|
AF_Scaler scaler );
|
|
|
|
|
2006-02-09 15:17:04 +01:00
|
|
|
FT_LOCAL( void )
|
|
|
|
af_latin_metrics_init_widths( AF_LatinMetrics metrics,
|
2012-10-24 14:22:14 +02:00
|
|
|
FT_Face face );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
2009-04-27 19:40:35 +02:00
|
|
|
FT_LOCAL( void )
|
|
|
|
af_latin_metrics_check_digits( AF_LatinMetrics metrics,
|
|
|
|
FT_Face face );
|
|
|
|
|
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
|
|
|
|
2015-02-19 09:46:48 +01:00
|
|
|
#define AF_LATIN_HINTS_HORZ_SNAP ( 1U << 0 ) /* stem width snapping */
|
|
|
|
#define AF_LATIN_HINTS_VERT_SNAP ( 1U << 1 ) /* stem height snapping */
|
|
|
|
#define AF_LATIN_HINTS_STEM_ADJUST ( 1U << 2 ) /* stem width/height */
|
|
|
|
/* adjustment */
|
|
|
|
#define AF_LATIN_HINTS_MONO ( 1U << 3 ) /* 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
|
|
|
|
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* The next functions shouldn't normally be exported. However, other
|
|
|
|
* writing systems might like to use these functions as-is.
|
2005-03-02 12:24:23 +01:00
|
|
|
*/
|
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
|
|
|
|
|
|
|
FT_LOCAL( void )
|
2003-11-23 22:39:51 +01:00
|
|
|
af_latin_hints_link_segments( AF_GlyphHints hints,
|
2014-04-05 16:27:19 +02:00
|
|
|
FT_UInt width_count,
|
|
|
|
AF_WidthRec* widths,
|
2003-11-23 22:39:51 +01:00
|
|
|
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_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,
|
2014-04-05 16:27:19 +02:00
|
|
|
FT_UInt width_count,
|
|
|
|
AF_WidthRec* widths,
|
2003-11-23 22:39:51 +01:00
|
|
|
AF_Dimension dim );
|
2003-10-02 23:07:10 +02:00
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
FT_END_HEADER
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* AFLATIN_H_ */
|
2005-03-02 12:24:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|