freetype2/src/sfnt/ttcmap.h

127 lines
3.6 KiB
C
Raw Permalink Normal View History

/****************************************************************************
*
* ttcmap.h
*
* TrueType character mapping table (cmap) support (specification).
*
2024-01-27 17:11:22 +01:00
* Copyright (C) 2002-2024 by
* 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.
*
*/
#ifndef TTCMAP_H_
#define TTCMAP_H_
#include <freetype/internal/tttypes.h>
#include <freetype/internal/ftvalid.h>
#include <freetype/internal/services/svttcmap.h>
FT_BEGIN_HEADER
#define TT_CMAP_FLAG_UNSORTED 1
#define TT_CMAP_FLAG_OVERLAPPING 2
typedef struct TT_CMapRec_
{
FT_CMapRec cmap;
FT_Byte* data; /* pointer to in-memory cmap table */
FT_Int flags; /* for format 4 only */
} TT_CMapRec, *TT_CMap;
typedef const struct TT_CMap_ClassRec_* TT_CMap_Class;
typedef FT_Error
(*TT_CMap_ValidateFunc)( FT_Byte* data,
FT_Validator valid );
typedef struct TT_CMap_ClassRec_
{
FT_CMap_ClassRec clazz;
FT_UInt format;
TT_CMap_ValidateFunc validate;
TT_CMap_Info_GetFunc get_cmap_info;
} TT_CMap_ClassRec;
2012-08-27 05:48:23 +02:00
#define FT_DEFINE_TT_CMAP( class_, \
size_, \
init_, \
done_, \
char_index_, \
char_next_, \
char_var_index_, \
char_var_default_, \
variant_list_, \
charvariant_list_, \
variantchar_list_, \
format_, \
validate_, \
get_cmap_info_ ) \
FT_CALLBACK_TABLE_DEF \
const TT_CMap_ClassRec class_ = \
{ \
{ size_, \
init_, \
done_, \
char_index_, \
char_next_, \
char_var_index_, \
char_var_default_, \
variant_list_, \
charvariant_list_, \
variantchar_list_ \
}, \
\
format_, \
validate_, \
get_cmap_info_ \
Position Independent Code (PIC) support in sfnt driver. * include/freetype/internal/services/svbdf.h add macros to init instances of FT_Service_BDFRec. * include/freetype/internal/services/svgldict.h add macros to init instances of FT_Service_GlyphDictRec. * include/freetype/internal/services/svpostnm.h add macros to init instances of FT_Service_PsFontNameRec. * include/freetype/internal/services/svsfnt.h add macros to init instances of FT_Service_SFNT_TableRec. * include/freetype/internal/services/svttcmap.h add macros to init instances of FT_Service_TTCMapsRec. * include/freetype/internal/sfnt.h add macros to init instances of SFNT_Interface. * src/sfnt/sfdriver.h declare sfnt_module_class using macros from ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined the following structs: sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface, sfnt_module_class, and sfnt_services array will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from sfntpic.h in order to access them from the pic_container. * src/sfnt/ttcmap.h add macros to init instances of TT_CMap_ClassRec. * src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined the following structs: tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec, tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from sfntpic.h in order to access them from the pic_container. The content of tt_cmap_classes is now described in the new file 'ttcmapc.h'. New Files: * src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt driver and macros to access them. * src/sfnt/sfntpic.c implement functions to allocate, destroy and initialize PIC globals for sfnt driver. * src/sfnt/ttcmapc.h describing the content of tt_cmap_classes allocated in ttcmap.c * src/sfnt/sfnt.c add new file to build: sfntpic.c. * src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
};
2012-08-27 05:48:23 +02:00
#undef TTCMAPCITEM
#define TTCMAPCITEM( a ) FT_CALLBACK_TABLE const TT_CMap_ClassRec a;
#include "ttcmapc.h"
typedef struct TT_ValidatorRec_
{
2002-03-22 18:09:52 +01:00
FT_ValidatorRec validator;
FT_UInt num_glyphs;
} TT_ValidatorRec, *TT_Validator;
2012-08-27 05:48:23 +02:00
#define TT_VALIDATOR( x ) ( (TT_Validator)( x ) )
#define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs
FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec;
FT_LOCAL( FT_Error )
tt_face_build_cmaps( TT_Face face );
/* used in tt-cmaps service */
FT_LOCAL( FT_Error )
tt_get_cmap_info( FT_CharMap charmap,
TT_CMapInfo *cmap_info );
FT_END_HEADER
#endif /* TTCMAP_H_ */
/* END */