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

gxvmort5.c
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  gxvmort5.c                                                             */
00004 /*                                                                         */
00005 /*    TrueTypeGX/AAT mort table validation                                 */
00006 /*    body for type5 (Contextual Glyph Insertion) 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   /*
00042    * mort subtable type5 (Contextual Glyph Insertion)
00043    * has the format of StateTable with insertion-glyph-list,
00044    * but without name.  The offset is given by glyphOffset in
00045    * entryTable.  There is no table location declaration
00046    * like xxxTable.
00047    */
00048 
00049   typedef struct  GXV_mort_subtable_type5_StateOptRec_
00050   {
00051     FT_UShort   classTable;
00052     FT_UShort   stateArray;
00053     FT_UShort   entryTable;
00054 
00055 #define GXV_MORT_SUBTABLE_TYPE5_HEADER_SIZE  GXV_STATETABLE_HEADER_SIZE
00056 
00057     FT_UShort*  classTable_length_p;
00058     FT_UShort*  stateArray_length_p;
00059     FT_UShort*  entryTable_length_p;
00060 
00061   }  GXV_mort_subtable_type5_StateOptRec,
00062     *GXV_mort_subtable_type5_StateOptRecData;
00063 
00064 
00065   FT_LOCAL_DEF( void )
00066   gxv_mort_subtable_type5_subtable_setup( FT_UShort      table_size,
00067                                           FT_UShort      classTable,
00068                                           FT_UShort      stateArray,
00069                                           FT_UShort      entryTable,
00070                                           FT_UShort*     classTable_length_p,
00071                                           FT_UShort*     stateArray_length_p,
00072                                           FT_UShort*     entryTable_length_p,
00073                                           GXV_Validator  valid )
00074   {
00075     GXV_mort_subtable_type5_StateOptRecData  optdata =
00076       (GXV_mort_subtable_type5_StateOptRecData)valid->statetable.optdata;
00077 
00078 
00079     gxv_StateTable_subtable_setup( table_size,
00080                                    classTable,
00081                                    stateArray,
00082                                    entryTable,
00083                                    classTable_length_p,
00084                                    stateArray_length_p,
00085                                    entryTable_length_p,
00086                                    valid );
00087 
00088     optdata->classTable = classTable;
00089     optdata->stateArray = stateArray;
00090     optdata->entryTable = entryTable;
00091 
00092     optdata->classTable_length_p = classTable_length_p;
00093     optdata->stateArray_length_p = stateArray_length_p;
00094     optdata->entryTable_length_p = entryTable_length_p;
00095   }
00096 
00097 
00098   static void
00099   gxv_mort_subtable_type5_InsertList_validate( FT_UShort      offset,
00100                                                FT_UShort      count,
00101                                                FT_Bytes       table,
00102                                                FT_Bytes       limit,
00103                                                GXV_Validator  valid )
00104   {
00105     /*
00106      * We don't know the range of insertion-glyph-list.
00107      * Set range by whole of state table.
00108      */
00109     FT_Bytes  p = table + offset;
00110 
00111     GXV_mort_subtable_type5_StateOptRecData  optdata =
00112       (GXV_mort_subtable_type5_StateOptRecData)valid->statetable.optdata;
00113 
00114     if ( optdata->classTable < offset                                   &&
00115          offset < optdata->classTable + *(optdata->classTable_length_p) )
00116       GXV_TRACE(( " offset runs into ClassTable" ));
00117     if ( optdata->stateArray < offset                                   &&
00118          offset < optdata->stateArray + *(optdata->stateArray_length_p) )
00119       GXV_TRACE(( " offset runs into StateArray" ));
00120     if ( optdata->entryTable < offset                                   &&
00121          offset < optdata->entryTable + *(optdata->entryTable_length_p) )
00122       GXV_TRACE(( " offset runs into EntryTable" ));
00123 
00124     while ( p < table + offset + ( count * 2 ) )
00125     {
00126       FT_UShort insert_glyphID;
00127 
00128 
00129       GXV_LIMIT_CHECK( 2 );
00130       insert_glyphID = FT_NEXT_USHORT( p );
00131       GXV_TRACE(( " 0x%04x", insert_glyphID ));
00132     }
00133 
00134     GXV_TRACE(( "\n" ));
00135   }
00136 
00137 
00138   static void
00139   gxv_mort_subtable_type5_entry_validate(
00140     FT_Byte                         state,
00141     FT_UShort                       flags,
00142     GXV_StateTable_GlyphOffsetCPtr  glyphOffset,
00143     FT_Bytes                        table,
00144     FT_Bytes                        limit,
00145     GXV_Validator                   valid )
00146   {
00147     FT_Bool    setMark;
00148     FT_Bool    dontAdvance;
00149     FT_Bool    currentIsKashidaLike;
00150     FT_Bool    markedIsKashidaLike;
00151     FT_Bool    currentInsertBefore;
00152     FT_Bool    markedInsertBefore;
00153     FT_Byte    currentInsertCount;
00154     FT_Byte    markedInsertCount;
00155     FT_UShort  currentInsertList;
00156     FT_UShort  markedInsertList;
00157 
00158     FT_UNUSED( state );
00159 
00160 
00161     setMark              = FT_BOOL( ( flags >> 15 ) & 1 );
00162     dontAdvance          = FT_BOOL( ( flags >> 14 ) & 1 );
00163     currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 );
00164     markedIsKashidaLike  = FT_BOOL( ( flags >> 12 ) & 1 );
00165     currentInsertBefore  = FT_BOOL( ( flags >> 11 ) & 1 );
00166     markedInsertBefore   = FT_BOOL( ( flags >> 10 ) & 1 );
00167 
00168     currentInsertCount   = (FT_Byte)( ( flags >> 5 ) & 0x1F   );
00169     markedInsertCount    = (FT_Byte)(   flags        & 0x001F );
00170 
00171     currentInsertList    = (FT_UShort)( glyphOffset->ul >> 16 );
00172     markedInsertList     = (FT_UShort)( glyphOffset->ul       );
00173 
00174     if ( 0 != currentInsertList && 0 != currentInsertCount )
00175     {
00176       gxv_mort_subtable_type5_InsertList_validate( currentInsertList,
00177                                                    currentInsertCount,
00178                                                    table,
00179                                                    limit,
00180                                                    valid );
00181     }
00182 
00183     if ( 0 != markedInsertList && 0 != markedInsertCount )
00184     {
00185       gxv_mort_subtable_type5_InsertList_validate( markedInsertList,
00186                                                    markedInsertCount,
00187                                                    table,
00188                                                    limit,
00189                                                    valid );
00190     }
00191   }
00192 
00193 
00194   FT_LOCAL_DEF( void )
00195   gxv_mort_subtable_type5_validate( FT_Bytes       table,
00196                                     FT_Bytes       limit,
00197                                     GXV_Validator  valid )
00198   {
00199     FT_Bytes  p = table;
00200 
00201     GXV_mort_subtable_type5_StateOptRec      et_rec;
00202     GXV_mort_subtable_type5_StateOptRecData  et = &et_rec;
00203 
00204 
00205     GXV_NAME_ENTER( "mort chain subtable type5 (Glyph Insertion)" );
00206 
00207     GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE5_HEADER_SIZE );
00208 
00209     valid->statetable.optdata =
00210       et;
00211     valid->statetable.optdata_load_func =
00212       NULL;
00213     valid->statetable.subtable_setup_func =
00214       gxv_mort_subtable_type5_subtable_setup;
00215     valid->statetable.entry_glyphoffset_fmt =
00216       GXV_GLYPHOFFSET_ULONG;
00217     valid->statetable.entry_validate_func =
00218       gxv_mort_subtable_type5_entry_validate;
00219 
00220     gxv_StateTable_validate( p, limit, valid );
00221 
00222     GXV_EXIT;
00223   }
00224 
00225 
00226 /* END */

Generated on Mon May 28 2012 04:33:42 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.