/**************************************************************************** * * gxvkern.c * * TrueTypeGX/AAT kern table validation (body). * * Copyright (C) 2004-2023 by * suzuki toshiya, Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, * modified, and distributed under the terms of the FreeType project * license, LICENSE.TXT. By continuing to use, modify, or distribute * this file you indicate that you have read the license and * understand and accept it fully. * */ /**************************************************************************** * * gxvalid is derived from both gxlayout module and otvalid module. * Development of gxlayout is supported by the Information-technology * Promotion Agency(IPA), Japan. * */ #include "gxvalid.h" #include "gxvcommn.h" #include <freetype/ftsnames.h> #include <freetype/internal/services/svgxval.h> /************************************************************************** * * The macro FT_COMPONENT is used in trace mode. It is an implicit * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log * messages during execution. */ #undef FT_COMPONENT #define FT_COMPONENT … /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** Data and Types *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ GXV_kern_Version; GXV_kern_Dialect; GXV_kern_Data; #define GXV_KERN_DATA( field ) … #define KERN_IS_CLASSIC( gxvalid ) … #define KERN_IS_NEW( gxvalid ) … #define KERN_DIALECT( gxvalid ) … #define KERN_ALLOWS_MS( gxvalid ) … #define KERN_ALLOWS_APPLE( gxvalid ) … #define GXV_KERN_HEADER_SIZE … #define GXV_KERN_SUBTABLE_HEADER_SIZE … /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** SUBTABLE VALIDATORS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /* ============================= format 0 ============================== */ static void gxv_kern_subtable_fmt0_pairs_validate( FT_Bytes table, FT_Bytes limit, FT_UShort nPairs, GXV_Validator gxvalid ) { … } static void gxv_kern_subtable_fmt0_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } /* ============================= format 1 ============================== */ GXV_kern_fmt1_StateOptRecData; static void gxv_kern_subtable_fmt1_valueTable_load( FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } /* * passed tables_size covers whole StateTable, including kern fmt1 header */ static void gxv_kern_subtable_fmt1_subtable_setup( FT_UShort table_size, FT_UShort classTable, FT_UShort stateArray, FT_UShort entryTable, FT_UShort* classTable_length_p, FT_UShort* stateArray_length_p, FT_UShort* entryTable_length_p, GXV_Validator gxvalid ) { … } /* * passed table & limit are of whole StateTable, not including subtables */ static void gxv_kern_subtable_fmt1_entry_validate( FT_Byte state, FT_UShort flags, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p, FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } static void gxv_kern_subtable_fmt1_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } /* ================ Data for Class-Based Subtables 2, 3 ================ */ GXV_kern_ClassSpec; /* ============================= format 2 ============================== */ /* ---------------------- format 2 specific data ----------------------- */ GXV_kern_subtable_fmt2_Data; #define GXV_KERN_FMT2_DATA( field ) … /* -------------------------- utility functions ----------------------- */ static void gxv_kern_subtable_fmt2_clstbl_validate( FT_Bytes table, FT_Bytes limit, GXV_kern_ClassSpec spec, GXV_Validator gxvalid ) { … } static void gxv_kern_subtable_fmt2_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } /* ============================= format 3 ============================== */ static void gxv_kern_subtable_fmt3_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } static FT_Bool gxv_kern_coverage_new_apple_validate( FT_UShort coverage, FT_UShort* format, GXV_Validator gxvalid ) { … } static FT_Bool gxv_kern_coverage_classic_apple_validate( FT_UShort coverage, FT_UShort* format, GXV_Validator gxvalid ) { … } static FT_Bool gxv_kern_coverage_classic_microsoft_validate( FT_UShort coverage, FT_UShort* format, GXV_Validator gxvalid ) { … } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** MAIN *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ static GXV_kern_Dialect gxv_kern_coverage_validate( FT_UShort coverage, FT_UShort* format, GXV_Validator gxvalid ) { … } static void gxv_kern_subtable_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator gxvalid ) { … } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** kern TABLE *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ static void gxv_kern_validate_generic( FT_Bytes table, FT_Face face, FT_Bool classic_only, GXV_kern_Dialect dialect_request, FT_Validator ftvalid ) { … } FT_LOCAL_DEF( void ) gxv_kern_validate( FT_Bytes table, FT_Face face, FT_Validator ftvalid ) { … } FT_LOCAL_DEF( void ) gxv_kern_validate_classic( FT_Bytes table, FT_Face face, FT_Int dialect_flags, FT_Validator ftvalid ) { … } /* END */