gxvmort0.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  gxvmort0.c                                                             */
00004 /*                                                                         */
00005 /*    TrueTypeGX/AAT mort table validation                                 */
00006 /*    body for type0 (Indic Script Rearrangement) subtable.                */
00007 /*                                                                         */
00008 /*  Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,       */
00009 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00010 /*                                                                         */
00011 /*  This file is part of the FreeType project, and may only be used,       */
00012 /*  modified, and distributed under the terms of the FreeType project      */
00013 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00014 /*  this file you indicate that you have read the license and              */
00015 /*  understand and accept it fully.                                        */
00016 /*                                                                         */
00017 /***************************************************************************/
00018 
00019 /***************************************************************************/
00020 /*                                                                         */
00021 /* gxvalid is derived from both gxlayout module and otvalid module.        */
00022 /* Development of gxlayout is supported by the Information-technology      */
00023 /* Promotion Agency(IPA), Japan.                                           */
00024 /*                                                                         */
00025 /***************************************************************************/
00026 
00027 
00028 #include "gxvmort.h"
00029 
00030 
00031   /*************************************************************************/
00032   /*                                                                       */
00033   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
00034   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
00035   /* messages during execution.                                            */
00036   /*                                                                       */
00037 #undef  FT_COMPONENT
00038 #define FT_COMPONENT  trace_gxvmort
00039 
00040 
00041   static const char* GXV_Mort_IndicScript_Msg[] =
00042   {
00043     "no change",
00044     "Ax => xA",
00045     "xD => Dx",
00046     "AxD => DxA",
00047     "ABx => xAB",
00048     "ABx => xBA",
00049     "xCD => CDx",
00050     "xCD => DCx",
00051     "AxCD => CDxA",
00052     "AxCD => DCxA",
00053     "ABxD => DxAB",
00054     "ABxD => DxBA",
00055     "ABxCD => CDxAB",
00056     "ABxCD => CDxBA",
00057     "ABxCD => DCxAB",
00058     "ABxCD => DCxBA",
00059 
00060   };
00061 
00062 
00063   static void
00064   gxv_mort_subtable_type0_entry_validate(
00065     FT_Byte                         state,
00066     FT_UShort                       flags,
00067     GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
00068     FT_Bytes                        table,
00069     FT_Bytes                        limit,
00070     GXV_Validator                   valid )
00071   {
00072     FT_UShort  markFirst;
00073     FT_UShort  dontAdvance;
00074     FT_UShort  markLast;
00075     FT_UShort  reserved;
00076     FT_UShort  verb = 0;
00077 
00078     FT_UNUSED( state );
00079     FT_UNUSED( table );
00080     FT_UNUSED( limit );
00081 
00082     FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */
00083     FT_UNUSED( glyphOffset_p );                  /* case                  */
00084 
00085 
00086     markFirst   = (FT_UShort)( ( flags >> 15 ) & 1 );
00087     dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
00088     markLast    = (FT_UShort)( ( flags >> 13 ) & 1 );
00089 
00090     reserved = (FT_UShort)( flags & 0x1FF0 );
00091     verb     = (FT_UShort)( flags & 0x000F );
00092 
00093     GXV_TRACE(( "  IndicScript MorphRule for glyphOffset 0x%04x",
00094                 glyphOffset_p->u ));
00095     GXV_TRACE(( " markFirst=%01d", markFirst ));
00096     GXV_TRACE(( " dontAdvance=%01d", dontAdvance ));
00097     GXV_TRACE(( " markLast=%01d", markLast ));
00098     GXV_TRACE(( " %02d", verb ));
00099     GXV_TRACE(( " %s\n", GXV_Mort_IndicScript_Msg[verb] ));
00100 
00101     if ( 0 < reserved )
00102     {
00103       GXV_TRACE(( " non-zero bits found in reserved range\n" ));
00104       FT_INVALID_DATA;
00105     }
00106     else
00107       GXV_TRACE(( "\n" ));
00108   }
00109 
00110 
00111   FT_LOCAL_DEF( void )
00112   gxv_mort_subtable_type0_validate( FT_Bytes       table,
00113                                     FT_Bytes       limit,
00114                                     GXV_Validator  valid )
00115   {
00116     FT_Bytes  p = table;
00117 
00118 
00119     GXV_NAME_ENTER(
00120       "mort chain subtable type0 (Indic-Script Rearrangement)" );
00121 
00122     GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );
00123 
00124     valid->statetable.optdata               = NULL;
00125     valid->statetable.optdata_load_func     = NULL;
00126     valid->statetable.subtable_setup_func   = NULL;
00127     valid->statetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;
00128     valid->statetable.entry_validate_func =
00129       gxv_mort_subtable_type0_entry_validate;
00130 
00131     gxv_StateTable_validate( p, limit, valid );
00132 
00133     GXV_EXIT;
00134   }
00135 
00136 
00137 /* END */

Generated on Tue Jul 5 14:13:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1