ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

gxvmorx5.c
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  gxvmorx5.c                                                             */
00004 /*                                                                         */
00005 /*    TrueTypeGX/AAT morx table validation                                 */
00006 /*    body for type5 (Contextual Glyph Insertion) subtable.                */
00007 /*                                                                         */
00008 /*  Copyright 2005, 2007 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 "gxvmorx.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_gxvmorx
00039 
00040 
00041   /*
00042    * `morx' subtable type5 (Contextual Glyph Insertion)
00043    * has format of a StateTable with insertion-glyph-list
00044    * without name.  However, the 32bit offset from the head
00045    * of subtable to the i-g-l is given after `entryTable',
00046    * without variable name specification (the existence of
00047    * this offset to the table is different from mort type5).
00048    */
00049 
00050 
00051   typedef struct  GXV_morx_subtable_type5_StateOptRec_
00052   {
00053     FT_ULong  insertionGlyphList;
00054     FT_ULong  insertionGlyphList_length;
00055 
00056   }  GXV_morx_subtable_type5_StateOptRec,
00057     *GXV_morx_subtable_type5_StateOptRecData;
00058 
00059 
00060 #define GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE \
00061           ( GXV_STATETABLE_HEADER_SIZE + 4 )
00062 
00063 
00064   static void
00065   gxv_morx_subtable_type5_insertionGlyphList_load( FT_Bytes       table,
00066                                                    FT_Bytes       limit,
00067                                                    GXV_Validator  valid )
00068   {
00069     FT_Bytes  p = table;
00070 
00071     GXV_morx_subtable_type5_StateOptRecData  optdata =
00072       (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;
00073 
00074 
00075     GXV_LIMIT_CHECK( 4 );
00076     optdata->insertionGlyphList = FT_NEXT_ULONG( p );
00077   }
00078 
00079 
00080   static void
00081   gxv_morx_subtable_type5_subtable_setup( FT_ULong       table_size,
00082                                           FT_ULong       classTable,
00083                                           FT_ULong       stateArray,
00084                                           FT_ULong       entryTable,
00085                                           FT_ULong*      classTable_length_p,
00086                                           FT_ULong*      stateArray_length_p,
00087                                           FT_ULong*      entryTable_length_p,
00088                                           GXV_Validator  valid )
00089   {
00090     FT_ULong   o[4];
00091     FT_ULong*  l[4];
00092     FT_ULong   buff[5];
00093 
00094     GXV_morx_subtable_type5_StateOptRecData  optdata =
00095       (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata;
00096 
00097 
00098     o[0] = classTable;
00099     o[1] = stateArray;
00100     o[2] = entryTable;
00101     o[3] = optdata->insertionGlyphList;
00102     l[0] = classTable_length_p;
00103     l[1] = stateArray_length_p;
00104     l[2] = entryTable_length_p;
00105     l[3] = &(optdata->insertionGlyphList_length);
00106 
00107     gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid );
00108   }
00109 
00110 
00111   static void
00112   gxv_morx_subtable_type5_InsertList_validate( FT_UShort      table_index,
00113                                                FT_UShort      count,
00114                                                FT_Bytes       table,
00115                                                FT_Bytes       limit,
00116                                                GXV_Validator  valid )
00117   {
00118     FT_Bytes p = table + table_index * 2;
00119 
00120 
00121     while ( p < table + count * 2 + table_index * 2 )
00122     {
00123       FT_UShort  insert_glyphID;
00124 
00125 
00126       GXV_LIMIT_CHECK( 2 );
00127       insert_glyphID = FT_NEXT_USHORT( p );
00128       GXV_TRACE(( " 0x%04x", insert_glyphID ));
00129     }
00130 
00131     GXV_TRACE(( "\n" ));
00132   }
00133 
00134 
00135   static void
00136   gxv_morx_subtable_type5_entry_validate(
00137     FT_UShort                       state,
00138     FT_UShort                       flags,
00139     GXV_StateTable_GlyphOffsetCPtr  glyphOffset_p,
00140     FT_Bytes                        table,
00141     FT_Bytes                        limit,
00142     GXV_Validator                   valid )
00143   {
00144     FT_Bool    setMark;
00145     FT_Bool    dontAdvance;
00146     FT_Bool    currentIsKashidaLike;
00147     FT_Bool    markedIsKashidaLike;
00148     FT_Bool    currentInsertBefore;
00149     FT_Bool    markedInsertBefore;
00150     FT_Byte    currentInsertCount;
00151     FT_Byte    markedInsertCount;
00152     FT_Byte    currentInsertList;
00153     FT_UShort  markedInsertList;
00154 
00155     FT_UNUSED( state );
00156 
00157 
00158     setMark              = FT_BOOL( ( flags >> 15 ) & 1 );
00159     dontAdvance          = FT_BOOL( ( flags >> 14 ) & 1 );
00160     currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 );
00161     markedIsKashidaLike  = FT_BOOL( ( flags >> 12 ) & 1 );
00162     currentInsertBefore  = FT_BOOL( ( flags >> 11 ) & 1 );
00163     markedInsertBefore   = FT_BOOL( ( flags >> 10 ) & 1 );
00164 
00165     currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F   );
00166     markedInsertCount  = (FT_Byte)(   flags        & 0x001F );
00167 
00168     currentInsertList = (FT_Byte)  ( glyphOffset_p->ul >> 16 );
00169     markedInsertList  = (FT_UShort)( glyphOffset_p->ul       );
00170 
00171     if ( currentInsertList && 0 != currentInsertCount )
00172       gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
00173                                                    currentInsertCount,
00174                                                    table, limit,
00175                                                    valid );
00176 
00177     if ( markedInsertList && 0 != markedInsertCount )
00178       gxv_morx_subtable_type5_InsertList_validate( markedInsertList,
00179                                                    markedInsertCount,
00180                                                    table, limit,
00181                                                    valid );
00182   }
00183 
00184 
00185   FT_LOCAL_DEF( void )
00186   gxv_morx_subtable_type5_validate( FT_Bytes       table,
00187                                     FT_Bytes       limit,
00188                                     GXV_Validator  valid )
00189   {
00190     FT_Bytes  p = table;
00191 
00192     GXV_morx_subtable_type5_StateOptRec      et_rec;
00193     GXV_morx_subtable_type5_StateOptRecData  et = &et_rec;
00194 
00195 
00196     GXV_NAME_ENTER( "morx chain subtable type5 (Glyph Insertion)" );
00197 
00198     GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE5_HEADER_SIZE );
00199 
00200     valid->xstatetable.optdata =
00201       et;
00202     valid->xstatetable.optdata_load_func =
00203       gxv_morx_subtable_type5_insertionGlyphList_load;
00204     valid->xstatetable.subtable_setup_func =
00205       gxv_morx_subtable_type5_subtable_setup;
00206     valid->xstatetable.entry_glyphoffset_fmt =
00207       GXV_GLYPHOFFSET_ULONG;
00208     valid->xstatetable.entry_validate_func =
00209       gxv_morx_subtable_type5_entry_validate;
00210 
00211     gxv_XStateTable_validate( p, limit, valid );
00212 
00213     GXV_EXIT;
00214   }
00215 
00216 
00217 /* END */

Generated on Sun May 27 2012 04:33:51 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.