Al-Qurtas-Islamic-bank-The-.../src/autofit/afcjk.h

139 lines
3.9 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* afcjk.h */
/* */
/* Auto-fitter hinting routines for CJK script (specification). */
/* */
/* Copyright 2006, 2007 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 __AFCJK_H__
#define __AFCJK_H__
#include "afhints.h"
[autofit] Add bluezones for CJK Ideographs. To remove extremas of vertical strokes of CJK Ideographs at low resolution and make the top and bottom horizontal stems aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version for AF_Latin{Blue,Axis,Metric}Rec. (af_cjk_metrics_check_digits): Ditto, shared with Indic module. (af_cjk_metrics_init_widths): Ditto. (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. (af_cjk_metrics_scale): Ditto (declaration). (af_cjk_hints_init): Ditto (declaration). (af_cjk_hints_apply): Ditto (declaration). * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). (af_cjk_hints_init): Ditto (body). (af_cjk_hints_apply): Ditto (body). (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. (af_cjk_metrics_init): Call CJK bluezone initializer. (af_cjk_metrics_scale_dim): Add code to scale bluezones. (af_cjk_hints_compute_blue_edges): New function, CJK version of af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. (af_cjk_hints_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. However bluezones are not initialized. (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. (af_indic_hints_init): Ditto. (af_indic_hints_apply): Ditto. * docs/CHANGES: Note about CJK bluezone support.
2011-05-08 12:07:13 +02:00
#include "aflatin.h"
FT_BEGIN_HEADER
/* the CJK-specific script class */
Position Independent Code (PIC) support in autofit module. * include/freetype/internal/autohint.h add macros to init instances of FT_AutoHinter_ServiceRec. * src/autofit/afmodule.h declare autofit_module_class using macros from ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined af_autofitter_service and autofit_module_class structs will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from afpic.h in order to access them. * src/autofit/aftypes.h add macros to init and declare instances of AF_ScriptClassRec. * src/autofit/afcjk.h declare af_cjk_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined af_cjk_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afdummy.h declare af_dummy_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined af_dummy_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/afindic.h declare af_indic_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined af_indic_script_class struct will have function to init it instead of being allocated in the global scope. * src/autofit/aflatin.h declare af_latin_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined af_latin_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/aflatin2.h declare af_latin2_script_class using macros from aftypes.h, when FT_CONFIG_OPTION_PIC is defined init function will be declared. * src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined af_latin2_script_class struct will have function to init it instead of being allocated in the global scope. Change af_latin2_blue_chars to be PIC-compatible by being a two dimentional array rather than array of pointers. * src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined af_script_classes array initialization was moved to afpic.c and is later refered using macros defeined in afpic.h. New Files: * src/autofit/afpic.h declare struct to hold PIC globals for autofit module and macros to access them. * src/autofit/afpic.c implement functions to allocate, destroy and initialize PIC globals for autofit module. * src/autofit/autofit.c add new file to build: afpic.c. * src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 17:23:38 +02:00
AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class)
[autofit] Add bluezones for CJK Ideographs. To remove extremas of vertical strokes of CJK Ideographs at low resolution and make the top and bottom horizontal stems aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version for AF_Latin{Blue,Axis,Metric}Rec. (af_cjk_metrics_check_digits): Ditto, shared with Indic module. (af_cjk_metrics_init_widths): Ditto. (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. (af_cjk_metrics_scale): Ditto (declaration). (af_cjk_hints_init): Ditto (declaration). (af_cjk_hints_apply): Ditto (declaration). * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). (af_cjk_hints_init): Ditto (body). (af_cjk_hints_apply): Ditto (body). (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. (af_cjk_metrics_init): Call CJK bluezone initializer. (af_cjk_metrics_scale_dim): Add code to scale bluezones. (af_cjk_hints_compute_blue_edges): New function, CJK version of af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. (af_cjk_hints_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. However bluezones are not initialized. (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. (af_indic_hints_init): Ditto. (af_indic_hints_apply): Ditto. * docs/CHANGES: Note about CJK bluezone support.
2011-05-08 12:07:13 +02:00
/* CJK (global) metrics management */
/*
* CJK glyphs tend to fill the square. So we have both verticle and
* horizontal blue zones. But some glyphs have flat bounding stroke that
* leave some space between neighbour glyphs.
*/
enum
{
AF_CJK_BLUE_TOP,
AF_CJK_BLUE_BOTTOM,
AF_CJK_BLUE_LEFT,
AF_CJK_BLUE_RIGHT,
AF_CJK_BLUE_MAX
};
#define AF_CJK_MAX_WIDTHS 16
#define AF_CJK_MAX_BLUES AF_CJK_BLUE_MAX
enum
{
AF_CJK_BLUE_ACTIVE = 1 << 0,
AF_CJK_BLUE_IS_TOP = 1 << 1,
AF_CJK_BLUE_IS_RIGHT = 1 << 2,
AF_CJK_BLUE_ADJUSTMENT = 1 << 3, /* used for scale adjustment */
/* optimization */
AF_CJK_BLUE_FLAG_MAX
};
typedef struct AF_CJKBlueRec_
{
AF_WidthRec ref;
AF_WidthRec shoot; /* undershoot */
FT_UInt flags;
} AF_CJKBlueRec, *AF_CJKBlue;
typedef struct AF_CJKAxisRec_
{
FT_Fixed scale;
FT_Pos delta;
FT_UInt width_count;
AF_WidthRec widths[AF_CJK_MAX_WIDTHS];
FT_Pos edge_distance_threshold;
FT_Pos standard_width;
FT_Bool extra_light;
/* used for horizontal metrics too for CJK */
FT_Bool control_overshoot;
FT_UInt blue_count;
AF_CJKBlueRec blues[AF_CJK_BLUE_MAX];
FT_Fixed org_scale;
FT_Pos org_delta;
} AF_CJKAxisRec, *AF_CJKAxis;
typedef struct AF_CJKMetricsRec_
{
AF_ScriptMetricsRec root;
FT_UInt units_per_em;
AF_CJKAxisRec axis[AF_DIMENSION_MAX];
} AF_CJKMetricsRec, *AF_CJKMetrics;
FT_LOCAL( FT_Error )
[autofit] Add bluezones for CJK Ideographs. To remove extremas of vertical strokes of CJK Ideographs at low resolution and make the top and bottom horizontal stems aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version for AF_Latin{Blue,Axis,Metric}Rec. (af_cjk_metrics_check_digits): Ditto, shared with Indic module. (af_cjk_metrics_init_widths): Ditto. (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. (af_cjk_metrics_scale): Ditto (declaration). (af_cjk_hints_init): Ditto (declaration). (af_cjk_hints_apply): Ditto (declaration). * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). (af_cjk_hints_init): Ditto (body). (af_cjk_hints_apply): Ditto (body). (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. (af_cjk_metrics_init): Call CJK bluezone initializer. (af_cjk_metrics_scale_dim): Add code to scale bluezones. (af_cjk_hints_compute_blue_edges): New function, CJK version of af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. (af_cjk_hints_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. However bluezones are not initialized. (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. (af_indic_hints_init): Ditto. (af_indic_hints_apply): Ditto. * docs/CHANGES: Note about CJK bluezone support.
2011-05-08 12:07:13 +02:00
af_cjk_metrics_init( AF_CJKMetrics metrics,
FT_Face face );
FT_LOCAL( void )
[autofit] Add bluezones for CJK Ideographs. To remove extremas of vertical strokes of CJK Ideographs at low resolution and make the top and bottom horizontal stems aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version for AF_Latin{Blue,Axis,Metric}Rec. (af_cjk_metrics_check_digits): Ditto, shared with Indic module. (af_cjk_metrics_init_widths): Ditto. (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. (af_cjk_metrics_scale): Ditto (declaration). (af_cjk_hints_init): Ditto (declaration). (af_cjk_hints_apply): Ditto (declaration). * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). (af_cjk_hints_init): Ditto (body). (af_cjk_hints_apply): Ditto (body). (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. (af_cjk_metrics_init): Call CJK bluezone initializer. (af_cjk_metrics_scale_dim): Add code to scale bluezones. (af_cjk_hints_compute_blue_edges): New function, CJK version of af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. (af_cjk_hints_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. However bluezones are not initialized. (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. (af_indic_hints_init): Ditto. (af_indic_hints_apply): Ditto. * docs/CHANGES: Note about CJK bluezone support.
2011-05-08 12:07:13 +02:00
af_cjk_metrics_scale( AF_CJKMetrics metrics,
AF_Scaler scaler );
FT_LOCAL( FT_Error )
af_cjk_hints_init( AF_GlyphHints hints,
[autofit] Add bluezones for CJK Ideographs. To remove extremas of vertical strokes of CJK Ideographs at low resolution and make the top and bottom horizontal stems aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version for AF_Latin{Blue,Axis,Metric}Rec. (af_cjk_metrics_check_digits): Ditto, shared with Indic module. (af_cjk_metrics_init_widths): Ditto. (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. (af_cjk_metrics_scale): Ditto (declaration). (af_cjk_hints_init): Ditto (declaration). (af_cjk_hints_apply): Ditto (declaration). * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). (af_cjk_hints_init): Ditto (body). (af_cjk_hints_apply): Ditto (body). (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. (af_cjk_metrics_init): Call CJK bluezone initializer. (af_cjk_metrics_scale_dim): Add code to scale bluezones. (af_cjk_hints_compute_blue_edges): New function, CJK version of af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. (af_cjk_hints_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. However bluezones are not initialized. (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. (af_indic_hints_init): Ditto. (af_indic_hints_apply): Ditto. * docs/CHANGES: Note about CJK bluezone support.
2011-05-08 12:07:13 +02:00
AF_CJKMetrics metrics );
FT_LOCAL( FT_Error )
af_cjk_hints_apply( AF_GlyphHints hints,
FT_Outline* outline,
[autofit] Add bluezones for CJK Ideographs. To remove extremas of vertical strokes of CJK Ideographs at low resolution and make the top and bottom horizontal stems aligned, bluezones for CJK Ideographs are calculated from sample glyphs. At present, vertical bluezones (bluezones to align vertical stems) are disabled by default. For detail, see http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html * include/freetype/internal/fttrace.h: New trace component `afcjk'. * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version for AF_Latin{Blue,Axis,Metric}Rec. (af_cjk_metrics_check_digits): Ditto, shared with Indic module. (af_cjk_metrics_init_widths): Ditto. (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. (af_cjk_metrics_scale): Ditto (declaration). (af_cjk_hints_init): Ditto (declaration). (af_cjk_hints_apply): Ditto (declaration). * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). (af_cjk_hints_init): Ditto (body). (af_cjk_hints_apply): Ditto (body). (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. (af_cjk_metrics_init): Call CJK bluezone initializer. (af_cjk_metrics_scale_dim): Add code to scale bluezones. (af_cjk_hints_compute_blue_edges): New function, CJK version of af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. (af_cjk_hints_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. However bluezones are not initialized. (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. (af_indic_hints_init): Ditto. (af_indic_hints_apply): Ditto. * docs/CHANGES: Note about CJK bluezone support.
2011-05-08 12:07:13 +02:00
AF_CJKMetrics metrics );
/* Shared. called from afindic.c */
FT_LOCAL( void )
af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
FT_Face face );
FT_LOCAL( void )
af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
FT_Face face,
FT_ULong charcode );
/* */
FT_END_HEADER
#endif /* __AFCJK_H__ */
/* END */