Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | /* */ |
| 3 | /* afcjk.h */ |
| 4 | /* */ |
| 5 | /* Auto-fitter hinting routines for CJK script (specification). */ |
| 6 | /* */ |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 7 | /* Copyright 2006, 2007, 2011 by */ |
Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 | /* */ |
| 10 | /* This file is part of the FreeType project, and may only be used, */ |
| 11 | /* modified, and distributed under the terms of the FreeType project */ |
| 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 | /* this file you indicate that you have read the license and */ |
| 14 | /* understand and accept it fully. */ |
| 15 | /* */ |
| 16 | /***************************************************************************/ |
| 17 | |
| 18 | |
| 19 | #ifndef __AFCJK_H__ |
| 20 | #define __AFCJK_H__ |
| 21 | |
| 22 | #include "afhints.h" |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 23 | #include "aflatin.h" |
Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 24 | |
| 25 | |
| 26 | FT_BEGIN_HEADER |
| 27 | |
| 28 | |
| 29 | /* the CJK-specific script class */ |
| 30 | |
Oran Agra | 59b4af8 | 2009-04-05 18:23:38 +0300 | [diff] [blame] | 31 | AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class) |
Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 32 | |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 33 | /* CJK (global) metrics management */ |
| 34 | |
| 35 | /* |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 36 | * CJK glyphs tend to fill the square. So we have both vertical and |
| 37 | * horizontal blue zones. But some glyphs have flat bounding strokes that |
| 38 | * leave some space between neighbour glyphs. |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 39 | */ |
| 40 | enum |
| 41 | { |
| 42 | AF_CJK_BLUE_TOP, |
| 43 | AF_CJK_BLUE_BOTTOM, |
| 44 | AF_CJK_BLUE_LEFT, |
| 45 | AF_CJK_BLUE_RIGHT, |
| 46 | |
| 47 | AF_CJK_BLUE_MAX |
| 48 | }; |
| 49 | |
| 50 | |
| 51 | #define AF_CJK_MAX_WIDTHS 16 |
| 52 | #define AF_CJK_MAX_BLUES AF_CJK_BLUE_MAX |
| 53 | |
| 54 | |
| 55 | enum |
| 56 | { |
| 57 | AF_CJK_BLUE_ACTIVE = 1 << 0, |
| 58 | AF_CJK_BLUE_IS_TOP = 1 << 1, |
| 59 | AF_CJK_BLUE_IS_RIGHT = 1 << 2, |
| 60 | AF_CJK_BLUE_ADJUSTMENT = 1 << 3, /* used for scale adjustment */ |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 61 | /* optimization */ |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 62 | AF_CJK_BLUE_FLAG_MAX |
| 63 | }; |
| 64 | |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 65 | |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 66 | typedef struct AF_CJKBlueRec_ |
| 67 | { |
| 68 | AF_WidthRec ref; |
| 69 | AF_WidthRec shoot; /* undershoot */ |
| 70 | FT_UInt flags; |
| 71 | |
| 72 | } AF_CJKBlueRec, *AF_CJKBlue; |
| 73 | |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 74 | |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 75 | typedef struct AF_CJKAxisRec_ |
| 76 | { |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 77 | FT_Fixed scale; |
| 78 | FT_Pos delta; |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 79 | |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 80 | FT_UInt width_count; |
| 81 | AF_WidthRec widths[AF_CJK_MAX_WIDTHS]; |
| 82 | FT_Pos edge_distance_threshold; |
| 83 | FT_Pos standard_width; |
| 84 | FT_Bool extra_light; |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 85 | |
| 86 | /* used for horizontal metrics too for CJK */ |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 87 | FT_Bool control_overshoot; |
| 88 | FT_UInt blue_count; |
| 89 | AF_CJKBlueRec blues[AF_CJK_BLUE_MAX]; |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 90 | |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 91 | FT_Fixed org_scale; |
| 92 | FT_Pos org_delta; |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 93 | |
| 94 | } AF_CJKAxisRec, *AF_CJKAxis; |
| 95 | |
| 96 | |
| 97 | typedef struct AF_CJKMetricsRec_ |
| 98 | { |
| 99 | AF_ScriptMetricsRec root; |
| 100 | FT_UInt units_per_em; |
| 101 | AF_CJKAxisRec axis[AF_DIMENSION_MAX]; |
| 102 | |
| 103 | } AF_CJKMetricsRec, *AF_CJKMetrics; |
Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 104 | |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 105 | |
Werner Lemberg | 1e1b6df | 2007-07-07 07:30:40 +0000 | [diff] [blame] | 106 | FT_LOCAL( FT_Error ) |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 107 | af_cjk_metrics_init( AF_CJKMetrics metrics, |
| 108 | FT_Face face ); |
Werner Lemberg | 1e1b6df | 2007-07-07 07:30:40 +0000 | [diff] [blame] | 109 | |
| 110 | FT_LOCAL( void ) |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 111 | af_cjk_metrics_scale( AF_CJKMetrics metrics, |
| 112 | AF_Scaler scaler ); |
Werner Lemberg | 1e1b6df | 2007-07-07 07:30:40 +0000 | [diff] [blame] | 113 | |
| 114 | FT_LOCAL( FT_Error ) |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 115 | af_cjk_hints_init( AF_GlyphHints hints, |
| 116 | AF_CJKMetrics metrics ); |
Werner Lemberg | 1e1b6df | 2007-07-07 07:30:40 +0000 | [diff] [blame] | 117 | |
| 118 | FT_LOCAL( FT_Error ) |
Werner Lemberg | 27b20e9 | 2011-05-09 09:48:49 +0200 | [diff] [blame] | 119 | af_cjk_hints_apply( AF_GlyphHints hints, |
| 120 | FT_Outline* outline, |
| 121 | AF_CJKMetrics metrics ); |
suzuki toshiya | 084abf0 | 2011-05-08 19:07:13 +0900 | [diff] [blame] | 122 | |
| 123 | /* Shared. called from afindic.c */ |
| 124 | FT_LOCAL( void ) |
| 125 | af_cjk_metrics_check_digits( AF_CJKMetrics metrics, |
| 126 | FT_Face face ); |
| 127 | |
| 128 | FT_LOCAL( void ) |
| 129 | af_cjk_metrics_init_widths( AF_CJKMetrics metrics, |
| 130 | FT_Face face, |
| 131 | FT_ULong charcode ); |
| 132 | |
Werner Lemberg | 1e1b6df | 2007-07-07 07:30:40 +0000 | [diff] [blame] | 133 | |
Wu, Chia-I (吳佳一) | 4cdb45c | 2006-02-09 14:17:04 +0000 | [diff] [blame] | 134 | /* */ |
| 135 | |
| 136 | FT_END_HEADER |
| 137 | |
| 138 | #endif /* __AFCJK_H__ */ |
| 139 | |
| 140 | |
| 141 | /* END */ |