tizen 2.3.1 release
[framework/graphics/freetype.git] / src / autofit / afcjk.h
index 8416c0d..4dd4f39 100644 (file)
@@ -2,9 +2,9 @@
 /*                                                                         */
 /*  afcjk.h                                                                */
 /*                                                                         */
-/*    Auto-fitter hinting routines for CJK script (specification).         */
+/*    Auto-fitter hinting routines for CJK writing system (specification). */
 /*                                                                         */
-/*  Copyright 2006, 2007, 2011 by                                          */
+/*  Copyright 2006, 2007, 2011-2014 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
 FT_BEGIN_HEADER
 
 
-  /* the CJK-specific script class */
+  /* the CJK-specific writing system */
 
-  AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class)
+  AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class )
+
+
+  /*************************************************************************/
+  /*************************************************************************/
+  /*****                                                               *****/
+  /*****              C J K   G L O B A L   M E T R I C S              *****/
+  /*****                                                               *****/
+  /*************************************************************************/
+  /*************************************************************************/
 
-  /* CJK (global) metrics management */
 
   /*
    *  CJK glyphs tend to fill the square.  So we have both vertical and
    *  horizontal blue zones.  But some glyphs have flat bounding strokes 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_IS_TOP_BLUE( b ) \
+          ( (b)->properties & AF_BLUE_PROPERTY_CJK_TOP )
+#define AF_CJK_IS_HORIZ_BLUE( b ) \
+          ( (b)->properties & AF_BLUE_PROPERTY_CJK_HORIZ )
+#define AF_CJK_IS_RIGHT_BLUE  AF_CJK_IS_TOP_BLUE
 
 #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_ACTIVE     = 1 << 0,  /* set if zone height is <= 3/4px */
+    AF_CJK_BLUE_TOP        = 1 << 1,  /* result of AF_CJK_IS_TOP_BLUE   */
+    AF_CJK_BLUE_ADJUSTMENT = 1 << 2,  /* used for scale adjustment      */
+                                      /* optimization                   */
     AF_CJK_BLUE_FLAG_MAX
   };
 
@@ -77,16 +79,16 @@ FT_BEGIN_HEADER
     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;
+    FT_UInt        width_count;                   /* number of used widths */
+    AF_WidthRec    widths[AF_CJK_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? */
 
     /* used for horizontal metrics too for CJK */
     FT_Bool        control_overshoot;
     FT_UInt        blue_count;
-    AF_CJKBlueRec  blues[AF_CJK_BLUE_MAX];
+    AF_CJKBlueRec  blues[AF_BLUE_STRINGSET_MAX];
 
     FT_Fixed       org_scale;
     FT_Pos         org_delta;
@@ -96,13 +98,14 @@ FT_BEGIN_HEADER
 
   typedef struct  AF_CJKMetricsRec_
   {
-    AF_ScriptMetricsRec  root;
-    FT_UInt              units_per_em;
-    AF_CJKAxisRec        axis[AF_DIMENSION_MAX];
+    AF_StyleMetricsRec  root;
+    FT_UInt             units_per_em;
+    AF_CJKAxisRec       axis[AF_DIMENSION_MAX];
 
   } AF_CJKMetricsRec, *AF_CJKMetrics;
 
 
+#ifdef AF_CONFIG_OPTION_CJK
   FT_LOCAL( FT_Error )
   af_cjk_metrics_init( AF_CJKMetrics  metrics,
                        FT_Face        face );
@@ -120,15 +123,15 @@ FT_BEGIN_HEADER
                       FT_Outline*    outline,
                       AF_CJKMetrics  metrics );
 
-  /* Shared. called from afindic.c */
+  /* 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_Face        face );
+#endif /* AF_CONFIG_OPTION_CJK */
 
 
 /* */