ReactOS 0.4.15-dev-8093-g3285f69
ttcmap.h File Reference
#include <ft2build.h>
Include dependency graph for ttcmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TT_CMapRec_
 
struct  TT_CMap_ClassRec_
 
struct  TT_ValidatorRec_
 

Macros

#define TT_CMAP_FLAG_UNSORTED   1
 
#define TT_CMAP_FLAG_OVERLAPPING   2
 
#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_)
 
#define TT_VALIDATOR(x)   ( (TT_Validator)( x ) )
 
#define TT_VALID_GLYPH_COUNT(x)   TT_VALIDATOR( x )->num_glyphs
 

Typedefs

typedef struct TT_CMapRec_ TT_CMapRec
 
typedef struct 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_ TT_CMap_ClassRec
 
typedef struct TT_ValidatorRec_ TT_ValidatorRec
 
typedef struct TT_ValidatorRec_TT_Validator
 

Functions

 tt_face_build_cmaps (TT_Face face)
 
 tt_get_cmap_info (FT_CharMap charmap, TT_CMapInfo *cmap_info)
 

Variables

FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec
 

Macro Definition Documentation

◆ FT_DEFINE_TT_CMAP

#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_ 
)
Value:
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_ \
};

Definition at line 61 of file ttcmap.h.

◆ TT_CMAP_FLAG_OVERLAPPING

#define TT_CMAP_FLAG_OVERLAPPING   2

Definition at line 32 of file ttcmap.h.

◆ TT_CMAP_FLAG_UNSORTED

#define TT_CMAP_FLAG_UNSORTED   1

Definition at line 31 of file ttcmap.h.

◆ TT_VALID_GLYPH_COUNT

#define TT_VALID_GLYPH_COUNT (   x)    TT_VALIDATOR( x )->num_glyphs

Definition at line 141 of file ttcmap.h.

◆ TT_VALIDATOR

#define TT_VALIDATOR (   x)    ( (TT_Validator)( x ) )

Definition at line 140 of file ttcmap.h.

Typedef Documentation

◆ TT_CMap

◆ TT_CMap_Class

Definition at line 42 of file ttcmap.h.

◆ TT_CMap_ClassRec

◆ TT_CMap_ValidateFunc

typedef FT_Error(* TT_CMap_ValidateFunc) (FT_Byte *data, FT_Validator valid)

Definition at line 45 of file ttcmap.h.

◆ TT_CMapRec

◆ TT_Validator

◆ TT_ValidatorRec

Function Documentation

◆ tt_face_build_cmaps()

tt_face_build_cmaps ( TT_Face  face)

Definition at line 3814 of file ttcmap.c.

3815 {
3816 FT_Byte* table = face->cmap_table;
3817 FT_Byte* limit = table + face->cmap_size;
3818 FT_UInt volatile num_cmaps;
3819 FT_Byte* volatile p = table;
3821
3822 FT_UNUSED( library );
3823
3824
3825 if ( !p || p + 4 > limit )
3826 return FT_THROW( Invalid_Table );
3827
3828 /* only recognize format 0 */
3829 if ( TT_NEXT_USHORT( p ) != 0 )
3830 {
3831 FT_ERROR(( "tt_face_build_cmaps:"
3832 " unsupported `cmap' table format = %d\n",
3833 TT_PEEK_USHORT( p - 2 ) ));
3834 return FT_THROW( Invalid_Table );
3835 }
3836
3837 num_cmaps = TT_NEXT_USHORT( p );
3838
3839 for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
3840 {
3841 FT_CharMapRec charmap;
3842 FT_UInt32 offset;
3843
3844
3845 charmap.platform_id = TT_NEXT_USHORT( p );
3846 charmap.encoding_id = TT_NEXT_USHORT( p );
3847 charmap.face = FT_FACE( face );
3848 charmap.encoding = FT_ENCODING_NONE; /* will be filled later */
3849 offset = TT_NEXT_ULONG( p );
3850
3851 if ( offset && offset <= face->cmap_size - 2 )
3852 {
3853 FT_Byte* volatile cmap = table + offset;
3854 volatile FT_UInt format = TT_PEEK_USHORT( cmap );
3855 const TT_CMap_Class* volatile pclazz = TT_CMAP_CLASSES_GET;
3856 TT_CMap_Class volatile clazz;
3857
3858
3859 for ( ; *pclazz; pclazz++ )
3860 {
3861 clazz = *pclazz;
3862 if ( clazz->format == format )
3863 {
3864 volatile TT_ValidatorRec valid;
3865 volatile FT_Error error = FT_Err_Ok;
3866
3867
3870
3871 valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;
3872
3873 if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer) == 0 )
3874 {
3875 /* validate this cmap sub-table */
3876 error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
3877 }
3878
3879 if ( !valid.validator.error )
3880 {
3881 FT_CMap ttcmap;
3882
3883
3884 /* It might make sense to store the single variation */
3885 /* selector cmap somewhere special. But it would have to be */
3886 /* in the public FT_FaceRec, and we can't change that. */
3887
3888 if ( !FT_CMap_New( (FT_CMap_Class)clazz,
3889 cmap, &charmap, &ttcmap ) )
3890 {
3891 /* it is simpler to directly set `flags' than adding */
3892 /* a parameter to FT_CMap_New */
3893 ((TT_CMap)ttcmap)->flags = (FT_Int)error;
3894 }
3895 }
3896 else
3897 {
3898 FT_TRACE0(( "tt_face_build_cmaps:"
3899 " broken cmap sub-table ignored\n" ));
3900 }
3901 break;
3902 }
3903 }
3904
3905 if ( !*pclazz )
3906 {
3907 FT_TRACE0(( "tt_face_build_cmaps:"
3908 " unsupported cmap sub-table ignored\n" ));
3909 }
3910 }
3911 }
3912
3913 return FT_Err_Ok;
3914 }
FT_Library library
Definition: cffdrivr.c:654
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:635
#define FT_FACE(x)
Definition: ftobjs.h:630
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3614
#define ft_setjmp(b)
Definition: ftstdlib.h:163
unsigned char FT_Byte
Definition: fttypes.h:154
int FT_Error
Definition: fttypes.h:300
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
@ FT_VALIDATE_DEFAULT
Definition: ftvalid.h:72
#define FT_VALIDATOR(x)
Definition: ftvalid.h:103
ft_validator_init(FT_Validator valid, const FT_Byte *base, const FT_Byte *limit, FT_ValidationLevel level)
Definition: ftobjs.c:122
BOOLEAN valid
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLint limit
Definition: glext.h:10326
GLfloat GLfloat p
Definition: glext.h:8902
GLintptr offset
Definition: glext.h:5920
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
#define TT_CMAP_CLASSES_GET
Definition: sfntpic.h:32
FT_Face face
Definition: freetype.h:842
FT_Encoding encoding
Definition: freetype.h:843
FT_UShort platform_id
Definition: freetype.h:844
FT_UShort encoding_id
Definition: freetype.h:845
FT_UInt format
Definition: ttcmap.h:52
TT_CMap_ValidateFunc validate
Definition: ttcmap.h:53
#define TT_NEXT_USHORT
Definition: ttcmap.c:50
#define TT_NEXT_ULONG
Definition: ttcmap.c:53
#define TT_PEEK_USHORT
Definition: ttcmap.c:44
struct TT_CMapRec_ * TT_CMap

Referenced by sfnt_load_face().

◆ tt_get_cmap_info()

tt_get_cmap_info ( FT_CharMap  charmap,
TT_CMapInfo cmap_info 
)

Definition at line 3918 of file ttcmap.c.

3920 {
3921 FT_CMap cmap = (FT_CMap)charmap;
3922 TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz;
3923
3924 if ( clazz->get_cmap_info )
3925 return clazz->get_cmap_info( charmap, cmap_info );
3926 else
3927 return FT_THROW( Invalid_CharMap_Format );
3928 }
TT_CMapInfo * cmap_info
Definition: cffdrivr.c:649
struct FT_CMapRec_ * FT_CMap
Definition: ftobjs.h:145
FT_CMap_Class clazz
Definition: ftobjs.h:154
TT_CMap_Info_GetFunc get_cmap_info
Definition: ttcmap.h:54
const struct TT_CMap_ClassRec_ * TT_CMap_Class
Definition: ttcmap.h:42

Variable Documentation

◆ tt_cmap_unicode_class_rec

FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec

Definition at line 144 of file ttcmap.h.

Referenced by sfnt_load_face().