gxvmort4.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  gxvmort4.c                                                             */
00004 /*                                                                         */
00005 /*    TrueTypeGX/AAT mort table validation                                 */
00006 /*    body for type4 (Non-Contextual Glyph Substitution) 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 void
00042   gxv_mort_subtable_type4_lookupval_validate( FT_UShort            glyph,
00043                                               GXV_LookupValueCPtr  value_p,
00044                                               GXV_Validator        valid )
00045   {
00046     FT_UNUSED( glyph );
00047 
00048     gxv_glyphid_validate( value_p->u, valid );
00049   }
00050 
00051   /*
00052     +===============+ --------+
00053     | lookup header |         |
00054     +===============+         |
00055     | BinSrchHeader |         |
00056     +===============+         |
00057     | lastGlyph[0]  |         |
00058     +---------------+         |
00059     | firstGlyph[0] |         |    head of lookup table
00060     +---------------+         |             +
00061     | offset[0]     |    ->   |          offset            [byte]
00062     +===============+         |             +
00063     | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]
00064     +---------------+         |
00065     | firstGlyph[1] |         |
00066     +---------------+         |
00067     | offset[1]     |         |
00068     +===============+         |
00069                               |
00070      ....                     |
00071                               |
00072     16bit value array         |
00073     +===============+         |
00074     |     value     | <-------+
00075      ....
00076   */
00077 
00078   static GXV_LookupValueDesc
00079   gxv_mort_subtable_type4_lookupfmt4_transit(
00080     FT_UShort            relative_gindex,
00081     GXV_LookupValueCPtr  base_value_p,
00082     FT_Bytes             lookuptbl_limit,
00083     GXV_Validator        valid )
00084   {
00085     FT_Bytes             p;
00086     FT_Bytes             limit;
00087     FT_UShort            offset;
00088     GXV_LookupValueDesc  value;
00089 
00090     /* XXX: check range? */
00091     offset = (FT_UShort)( base_value_p->u +
00092                           relative_gindex * sizeof ( FT_UShort ) );
00093 
00094     p     = valid->lookuptbl_head + offset;
00095     limit = lookuptbl_limit;
00096 
00097     GXV_LIMIT_CHECK( 2 );
00098     value.u = FT_NEXT_USHORT( p );
00099 
00100     return value;
00101   }
00102 
00103 
00104   FT_LOCAL_DEF( void )
00105   gxv_mort_subtable_type4_validate( FT_Bytes       table,
00106                                     FT_Bytes       limit,
00107                                     GXV_Validator  valid )
00108   {
00109     FT_Bytes  p = table;
00110 
00111 
00112     GXV_NAME_ENTER( "mort chain subtable type4 "
00113                     "(Non-Contextual Glyph Substitution)" );
00114 
00115     valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;
00116     valid->lookupval_func   = gxv_mort_subtable_type4_lookupval_validate;
00117     valid->lookupfmt4_trans = gxv_mort_subtable_type4_lookupfmt4_transit;
00118 
00119     gxv_LookupTable_validate( p, limit, valid );
00120 
00121     GXV_EXIT;
00122   }
00123 
00124 
00125 /* END */

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