/src/freetype/src/gxvalid/gxvmorx0.c

https://bitbucket.org/cabalistic/ogredeps/ · C · 111 lines · 58 code · 22 blank · 31 comment · 1 complexity · bcb0e7238f4d53d70ca6903e412af094 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* gxvmorx0.c */
  4. /* */
  5. /* TrueTypeGX/AAT morx table validation */
  6. /* body for type0 (Indic Script Rearrangement) subtable. */
  7. /* */
  8. /* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
  9. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  10. /* */
  11. /* This file is part of the FreeType project, and may only be used, */
  12. /* modified, and distributed under the terms of the FreeType project */
  13. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  14. /* this file you indicate that you have read the license and */
  15. /* understand and accept it fully. */
  16. /* */
  17. /***************************************************************************/
  18. /***************************************************************************/
  19. /* */
  20. /* gxvalid is derived from both gxlayout module and otvalid module. */
  21. /* Development of gxlayout is supported by the Information-technology */
  22. /* Promotion Agency(IPA), Japan. */
  23. /* */
  24. /***************************************************************************/
  25. #include "gxvmorx.h"
  26. /*************************************************************************/
  27. /* */
  28. /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
  29. /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
  30. /* messages during execution. */
  31. /* */
  32. #undef FT_COMPONENT
  33. #define FT_COMPONENT trace_gxvmorx
  34. static void
  35. gxv_morx_subtable_type0_entry_validate(
  36. FT_UShort state,
  37. FT_UShort flags,
  38. GXV_XStateTable_GlyphOffsetCPtr glyphOffset_p,
  39. FT_Bytes table,
  40. FT_Bytes limit,
  41. GXV_Validator valid )
  42. {
  43. #ifdef GXV_LOAD_UNUSED_VARS
  44. FT_UShort markFirst;
  45. FT_UShort dontAdvance;
  46. FT_UShort markLast;
  47. #endif
  48. FT_UShort reserved;
  49. #ifdef GXV_LOAD_UNUSED_VARS
  50. FT_UShort verb;
  51. #endif
  52. FT_UNUSED( state );
  53. FT_UNUSED( glyphOffset_p );
  54. FT_UNUSED( table );
  55. FT_UNUSED( limit );
  56. #ifdef GXV_LOAD_UNUSED_VARS
  57. markFirst = (FT_UShort)( ( flags >> 15 ) & 1 );
  58. dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
  59. markLast = (FT_UShort)( ( flags >> 13 ) & 1 );
  60. #endif
  61. reserved = (FT_UShort)( flags & 0x1FF0 );
  62. #ifdef GXV_LOAD_UNUSED_VARS
  63. verb = (FT_UShort)( flags & 0x000F );
  64. #endif
  65. if ( 0 < reserved )
  66. {
  67. GXV_TRACE(( " non-zero bits found in reserved range\n" ));
  68. FT_INVALID_DATA;
  69. }
  70. }
  71. FT_LOCAL_DEF( void )
  72. gxv_morx_subtable_type0_validate( FT_Bytes table,
  73. FT_Bytes limit,
  74. GXV_Validator valid )
  75. {
  76. FT_Bytes p = table;
  77. GXV_NAME_ENTER(
  78. "morx chain subtable type0 (Indic-Script Rearrangement)" );
  79. GXV_LIMIT_CHECK( GXV_STATETABLE_HEADER_SIZE );
  80. valid->xstatetable.optdata = NULL;
  81. valid->xstatetable.optdata_load_func = NULL;
  82. valid->xstatetable.subtable_setup_func = NULL;
  83. valid->xstatetable.entry_glyphoffset_fmt = GXV_GLYPHOFFSET_NONE;
  84. valid->xstatetable.entry_validate_func =
  85. gxv_morx_subtable_type0_entry_validate;
  86. gxv_XStateTable_validate( p, limit, valid );
  87. GXV_EXIT;
  88. }
  89. /* END */