зеркало из https://github.com/stride3d/freetype.git
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.
This commit is contained in:
Родитель
2e7a4e9b7f
Коммит
fb429ec409
55
ChangeLog
55
ChangeLog
|
@ -1,3 +1,58 @@
|
|||
2009-04-05 Oran Agra <oran@monfort.co.il>
|
||||
|
||||
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 Oran Agra <oran@monfort.co.il>
|
||||
|
||||
Position Independent Code (PIC) support in truetype driver.
|
||||
|
|
|
@ -45,6 +45,26 @@ FT_BEGIN_HEADER
|
|||
FT_BDF_GetPropertyFunc get_property;
|
||||
};
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \
|
||||
static const FT_Service_BDFRec class_ = \
|
||||
{ \
|
||||
get_charset_id_, get_property_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \
|
||||
void \
|
||||
FT_Init_Class_##class_( FT_Service_BDFRec* clazz ) \
|
||||
{ \
|
||||
clazz->get_charset_id = get_charset_id_; \
|
||||
clazz->get_property = get_property_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,28 @@ FT_BEGIN_HEADER
|
|||
FT_GlyphDict_NameIndexFunc name_index; /* optional */
|
||||
};
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \
|
||||
static const FT_Service_GlyphDictRec class_ = \
|
||||
{ \
|
||||
get_name_, name_index_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \
|
||||
void \
|
||||
FT_Init_Class_##class_( FT_Library library, \
|
||||
FT_Service_GlyphDictRec* clazz) \
|
||||
{ \
|
||||
FT_UNUSED(library); \
|
||||
clazz->get_name = get_name_; \
|
||||
clazz->name_index = name_index_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,27 @@ FT_BEGIN_HEADER
|
|||
FT_PsName_GetFunc get_ps_font_name;
|
||||
};
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \
|
||||
static const FT_Service_PsFontNameRec class_ = \
|
||||
{ \
|
||||
get_ps_font_name_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \
|
||||
void \
|
||||
FT_Init_Class_##class_( FT_Library library, \
|
||||
FT_Service_PsFontNameRec* clazz) \
|
||||
{ \
|
||||
FT_UNUSED(library); \
|
||||
clazz->get_ps_font_name = get_ps_font_name_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -68,6 +68,27 @@ FT_BEGIN_HEADER
|
|||
FT_SFNT_TableInfoFunc table_info;
|
||||
};
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \
|
||||
static const FT_Service_SFNT_TableRec class_ = \
|
||||
{ \
|
||||
load_, get_, info_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \
|
||||
void \
|
||||
FT_Init_Class_##class_( FT_Service_SFNT_TableRec* clazz ) \
|
||||
{ \
|
||||
clazz->load_table = load_; \
|
||||
clazz->get_table = get_; \
|
||||
clazz->table_info = info_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -74,6 +74,27 @@ FT_BEGIN_HEADER
|
|||
TT_CMap_Info_GetFunc get_cmap_info;
|
||||
};
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \
|
||||
static const FT_Service_TTCMapsRec class_ = \
|
||||
{ \
|
||||
get_cmap_info_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \
|
||||
void \
|
||||
FT_Init_Class_##class_( FT_Library library, \
|
||||
FT_Service_TTCMapsRec* clazz) \
|
||||
{ \
|
||||
FT_UNUSED(library); \
|
||||
clazz->get_cmap_info = get_cmap_info_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -753,6 +753,141 @@ FT_BEGIN_HEADER
|
|||
/* transitional */
|
||||
typedef SFNT_Interface* SFNT_Service;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \
|
||||
a,
|
||||
#else
|
||||
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a)
|
||||
#endif
|
||||
#define FT_INTERNAL(a) \
|
||||
a,
|
||||
|
||||
#define FT_DEFINE_SFNT_INTERFACE(class_, \
|
||||
goto_table_, init_face_, load_face_, done_face_, get_interface_, \
|
||||
load_any_, load_sfnt_header_, load_directory_, load_head_, \
|
||||
load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \
|
||||
load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \
|
||||
load_kern_, load_gasp_, load_pclt_, load_bhed_, \
|
||||
set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \
|
||||
load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \
|
||||
get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \
|
||||
get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \
|
||||
set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \
|
||||
static const SFNT_Interface class_ = \
|
||||
{ \
|
||||
FT_INTERNAL(goto_table_) \
|
||||
FT_INTERNAL(init_face_) \
|
||||
FT_INTERNAL(load_face_) \
|
||||
FT_INTERNAL(done_face_) \
|
||||
FT_INTERNAL(get_interface_) \
|
||||
FT_INTERNAL(load_any_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory_) \
|
||||
FT_INTERNAL(load_head_) \
|
||||
FT_INTERNAL(load_hhea_) \
|
||||
FT_INTERNAL(load_cmap_) \
|
||||
FT_INTERNAL(load_maxp_) \
|
||||
FT_INTERNAL(load_os2_) \
|
||||
FT_INTERNAL(load_post_) \
|
||||
FT_INTERNAL(load_name_) \
|
||||
FT_INTERNAL(free_name_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub_) \
|
||||
FT_INTERNAL(load_kern_) \
|
||||
FT_INTERNAL(load_gasp_) \
|
||||
FT_INTERNAL(load_pclt_) \
|
||||
FT_INTERNAL(load_bhed_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics_) \
|
||||
FT_INTERNAL(load_sbit_image_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub_) \
|
||||
FT_INTERNAL(get_psname_) \
|
||||
FT_INTERNAL(free_psnames_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub_) \
|
||||
FT_INTERNAL(get_kerning_) \
|
||||
FT_INTERNAL(load_font_dir_) \
|
||||
FT_INTERNAL(load_hmtx_) \
|
||||
FT_INTERNAL(load_eblc_) \
|
||||
FT_INTERNAL(free_eblc_) \
|
||||
FT_INTERNAL(set_sbit_strike_) \
|
||||
FT_INTERNAL(load_strike_metrics_) \
|
||||
FT_INTERNAL(get_metrics_) \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \
|
||||
clazz->a = a_;
|
||||
#else
|
||||
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_)
|
||||
#endif
|
||||
#define FT_INTERNAL(a, a_) \
|
||||
clazz->a = a_;
|
||||
|
||||
#define FT_DEFINE_SFNT_INTERFACE(class_, \
|
||||
goto_table_, init_face_, load_face_, done_face_, get_interface_, \
|
||||
load_any_, load_sfnt_header_, load_directory_, load_head_, \
|
||||
load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, \
|
||||
load_name_, free_name_, load_hdmx_stub_, free_hdmx_stub_, \
|
||||
load_kern_, load_gasp_, load_pclt_, load_bhed_, \
|
||||
set_sbit_strike_stub_, load_sbits_stub_, find_sbit_image_, \
|
||||
load_sbit_metrics_, load_sbit_image_, free_sbits_stub_, \
|
||||
get_psname_, free_psnames_, load_charmap_stub_, free_charmap_stub_, \
|
||||
get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, \
|
||||
set_sbit_strike_, load_strike_metrics_, get_metrics_ ) \
|
||||
void \
|
||||
FT_Init_Class_##class_( FT_Library library, SFNT_Interface* clazz ) \
|
||||
{ \
|
||||
FT_UNUSED(library); \
|
||||
FT_INTERNAL(goto_table,goto_table_) \
|
||||
FT_INTERNAL(init_face,init_face_) \
|
||||
FT_INTERNAL(load_face,load_face_) \
|
||||
FT_INTERNAL(done_face,done_face_) \
|
||||
FT_INTERNAL(get_interface,get_interface_) \
|
||||
FT_INTERNAL(load_any,load_any_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sfnt_header,load_sfnt_header_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_directory,load_directory_) \
|
||||
FT_INTERNAL(load_head,load_head_) \
|
||||
FT_INTERNAL(load_hhea,load_hhea_) \
|
||||
FT_INTERNAL(load_cmap,load_cmap_) \
|
||||
FT_INTERNAL(load_maxp,load_maxp_) \
|
||||
FT_INTERNAL(load_os2,load_os2_) \
|
||||
FT_INTERNAL(load_post,load_post_) \
|
||||
FT_INTERNAL(load_name,load_name_) \
|
||||
FT_INTERNAL(free_name,free_name_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_hdmx_stub,load_hdmx_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(free_hdmx_stub,free_hdmx_stub_) \
|
||||
FT_INTERNAL(load_kern,load_kern_) \
|
||||
FT_INTERNAL(load_gasp,load_gasp_) \
|
||||
FT_INTERNAL(load_pclt,load_pclt_) \
|
||||
FT_INTERNAL(load_bhed,load_bhed_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(set_sbit_strike_stub,set_sbit_strike_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbits_stub,load_sbits_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(find_sbit_image,find_sbit_image_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_sbit_metrics,load_sbit_metrics_) \
|
||||
FT_INTERNAL(load_sbit_image,load_sbit_image_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(free_sbits_stub,free_sbits_stub_) \
|
||||
FT_INTERNAL(get_psname,get_psname_) \
|
||||
FT_INTERNAL(free_psnames,free_psnames_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(load_charmap_stub,load_charmap_stub_) \
|
||||
FT_DEFINE_DRIVERS_OLD_INTERNAL(free_charmap_stub,free_charmap_stub_) \
|
||||
FT_INTERNAL(get_kerning,get_kerning_) \
|
||||
FT_INTERNAL(load_font_dir,load_font_dir_) \
|
||||
FT_INTERNAL(load_hmtx,load_hmtx_) \
|
||||
FT_INTERNAL(load_eblc,load_eblc_) \
|
||||
FT_INTERNAL(free_eblc,free_eblc_) \
|
||||
FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \
|
||||
FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \
|
||||
FT_INTERNAL(get_metrics,get_metrics_) \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
|
|||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf ;
|
||||
_sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf sfntpic ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "sfdriver.h"
|
||||
#include "ttload.h"
|
||||
#include "sfobjs.h"
|
||||
#include "sfntpic.h"
|
||||
|
||||
#include "sferrors.h"
|
||||
|
||||
|
@ -118,12 +119,11 @@
|
|||
}
|
||||
|
||||
|
||||
static const FT_Service_SFNT_TableRec sfnt_service_sfnt_table =
|
||||
{
|
||||
FT_DEFINE_SERVICE_SFNT_TABLEREC(sfnt_service_sfnt_table,
|
||||
(FT_SFNT_TableLoadFunc)tt_face_load_any,
|
||||
(FT_SFNT_TableGetFunc) get_sfnt_table,
|
||||
(FT_SFNT_TableInfoFunc)sfnt_table_info
|
||||
};
|
||||
)
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
|
@ -176,11 +176,10 @@
|
|||
}
|
||||
|
||||
|
||||
static const FT_Service_GlyphDictRec sfnt_service_glyph_dict =
|
||||
{
|
||||
FT_DEFINE_SERVICE_GLYPHDICTREC(sfnt_service_glyph_dict,
|
||||
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
|
||||
(FT_GlyphDict_NameIndexFunc)sfnt_get_name_index
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
||||
|
||||
|
@ -300,19 +299,17 @@
|
|||
return result;
|
||||
}
|
||||
|
||||
static const FT_Service_PsFontNameRec sfnt_service_ps_name =
|
||||
{
|
||||
FT_DEFINE_SERVICE_PSFONTNAMEREC(sfnt_service_ps_name,
|
||||
(FT_PsName_GetFunc)sfnt_get_ps_name
|
||||
};
|
||||
)
|
||||
|
||||
|
||||
/*
|
||||
* TT CMAP INFO
|
||||
*/
|
||||
static const FT_Service_TTCMapsRec tt_service_get_cmap_info =
|
||||
{
|
||||
FT_DEFINE_SERVICE_TTCMAPSREC(tt_service_get_cmap_info,
|
||||
(TT_CMap_Info_GetFunc)tt_get_cmap_info
|
||||
};
|
||||
)
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
|
@ -353,11 +350,10 @@
|
|||
}
|
||||
|
||||
|
||||
static const FT_Service_BDFRec sfnt_service_bdf =
|
||||
{
|
||||
FT_DEFINE_SERVICE_BDFRec(sfnt_service_bdf,
|
||||
(FT_BDF_GetCharsetIdFunc) sfnt_get_charset_id,
|
||||
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop,
|
||||
};
|
||||
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_BDF */
|
||||
|
||||
|
@ -366,29 +362,46 @@
|
|||
* SERVICE LIST
|
||||
*/
|
||||
|
||||
static const FT_ServiceDescRec sfnt_services[] =
|
||||
{
|
||||
{ FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table },
|
||||
{ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name },
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
{ FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict },
|
||||
#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF
|
||||
FT_DEFINE_SERVICEDESCREC5(sfnt_services,
|
||||
FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET,
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
|
||||
FT_SERVICE_ID_GLYPH_DICT, &FT_SFNT_SERVICE_GLYPH_DICT_GET,
|
||||
FT_SERVICE_ID_BDF, &FT_SFNT_SERVICE_BDF_GET,
|
||||
FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET
|
||||
)
|
||||
#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
FT_DEFINE_SERVICEDESCREC4(sfnt_services,
|
||||
FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET,
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
|
||||
FT_SERVICE_ID_GLYPH_DICT, &FT_SFNT_SERVICE_GLYPH_DICT_GET,
|
||||
FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET
|
||||
)
|
||||
#elif defined TT_CONFIG_OPTION_BDF
|
||||
FT_DEFINE_SERVICEDESCREC4(sfnt_services,
|
||||
FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET,
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
|
||||
FT_SERVICE_ID_BDF, &FT_SFNT_SERVICE_BDF_GET,
|
||||
FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET
|
||||
)
|
||||
#else
|
||||
FT_DEFINE_SERVICEDESCREC3(sfnt_services,
|
||||
FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET,
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET,
|
||||
FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET
|
||||
)
|
||||
#endif
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
{ FT_SERVICE_ID_BDF, &sfnt_service_bdf },
|
||||
#endif
|
||||
{ FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Module_Interface )
|
||||
sfnt_get_interface( FT_Module module,
|
||||
const char* module_interface )
|
||||
{
|
||||
FT_Library library = module->library;
|
||||
FT_UNUSED(library);
|
||||
FT_UNUSED( module );
|
||||
|
||||
return ft_service_list_lookup( sfnt_services, module_interface );
|
||||
return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface );
|
||||
}
|
||||
|
||||
|
||||
|
@ -519,10 +532,18 @@
|
|||
|
||||
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
#define PUT_EMBEDDED_BITMAPS(a) a
|
||||
#else
|
||||
#define PUT_EMBEDDED_BITMAPS(a) 0
|
||||
#endif
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
#define PUT_PS_NAMES(a) a
|
||||
#else
|
||||
#define PUT_PS_NAMES(a) 0
|
||||
#endif
|
||||
|
||||
static
|
||||
const SFNT_Interface sfnt_interface =
|
||||
{
|
||||
FT_DEFINE_SFNT_INTERFACE(sfnt_interface,
|
||||
tt_face_goto_table,
|
||||
|
||||
sfnt_init_face,
|
||||
|
@ -532,10 +553,8 @@
|
|||
|
||||
tt_face_load_any,
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
tt_face_load_sfnt_header_stub,
|
||||
tt_face_load_directory_stub,
|
||||
#endif
|
||||
tt_face_load_sfnt_header_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
tt_face_load_directory_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
tt_face_load_head,
|
||||
tt_face_load_hhea,
|
||||
|
@ -547,53 +566,32 @@
|
|||
tt_face_load_name,
|
||||
tt_face_free_name,
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
tt_face_load_hdmx_stub,
|
||||
tt_face_free_hdmx_stub,
|
||||
#endif
|
||||
tt_face_load_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
tt_face_free_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
tt_face_load_kern,
|
||||
tt_face_load_gasp,
|
||||
tt_face_load_pclt,
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
/* see `ttload.h' */
|
||||
tt_face_load_bhed,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
PUT_EMBEDDED_BITMAPS(tt_face_load_bhed),
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
tt_face_set_sbit_strike_stub,
|
||||
tt_face_load_sbit_stub,
|
||||
tt_face_set_sbit_strike_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
tt_face_load_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
tt_find_sbit_image,
|
||||
tt_load_sbit_metrics,
|
||||
#endif
|
||||
tt_find_sbit_image, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
tt_load_sbit_metrics, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
tt_face_load_sbit_image,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
PUT_EMBEDDED_BITMAPS(tt_face_load_sbit_image),
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
tt_face_free_sbit_stub,
|
||||
#endif
|
||||
tt_face_free_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
/* see `ttpost.h' */
|
||||
tt_face_get_ps_name,
|
||||
tt_face_free_ps_names,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
PUT_PS_NAMES(tt_face_get_ps_name),
|
||||
PUT_PS_NAMES(tt_face_free_ps_names),
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
tt_face_load_charmap_stub,
|
||||
tt_face_free_charmap_stub,
|
||||
#endif
|
||||
tt_face_load_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
tt_face_free_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
||||
|
||||
/* since version 2.1.8 */
|
||||
|
||||
|
@ -604,27 +602,19 @@
|
|||
tt_face_load_font_dir,
|
||||
tt_face_load_hmtx,
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
/* see `ttsbit.h' and `sfnt.h' */
|
||||
tt_face_load_eblc,
|
||||
tt_face_free_eblc,
|
||||
PUT_EMBEDDED_BITMAPS(tt_face_load_eblc),
|
||||
PUT_EMBEDDED_BITMAPS(tt_face_free_eblc),
|
||||
|
||||
tt_face_set_sbit_strike,
|
||||
tt_face_load_strike_metrics,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
PUT_EMBEDDED_BITMAPS(tt_face_set_sbit_strike),
|
||||
PUT_EMBEDDED_BITMAPS(tt_face_load_strike_metrics),
|
||||
|
||||
tt_face_get_metrics
|
||||
};
|
||||
)
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_Module_Class sfnt_module_class =
|
||||
{
|
||||
FT_DEFINE_MODULE(sfnt_module_class,
|
||||
|
||||
0, /* not a font driver or renderer */
|
||||
sizeof( FT_ModuleRec ),
|
||||
|
||||
|
@ -632,12 +622,12 @@
|
|||
0x10000L, /* driver version 1.0 */
|
||||
0x20000L, /* driver requires FreeType 2.0 or higher */
|
||||
|
||||
(const void*)&sfnt_interface, /* module specific interface */
|
||||
(const void*)&FT_SFNT_INTERFACE_GET, /* module specific interface */
|
||||
|
||||
(FT_Module_Constructor)0,
|
||||
(FT_Module_Destructor) 0,
|
||||
(FT_Module_Requester) sfnt_get_interface
|
||||
};
|
||||
)
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
FT_EXPORT_VAR( const FT_Module_Class ) sfnt_module_class;
|
||||
FT_DECLARE_MODULE( sfnt_module_class )
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#define FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#include <ft2build.h>
|
||||
#include "sfntpic.c"
|
||||
#include "ttload.c"
|
||||
#include "ttmtx.c"
|
||||
#include "ttcmap.c"
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* sfntpic.c */
|
||||
/* */
|
||||
/* The FreeType position independent code services for sfnt module. */
|
||||
/* */
|
||||
/* Copyright 2009 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include "sfntpic.h"
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_PIC
|
||||
|
||||
/* forward declaration of PIC init functions from sfdriver.c */
|
||||
FT_Error FT_Create_Class_sfnt_services( FT_Library, FT_ServiceDescRec**);
|
||||
void FT_Destroy_Class_sfnt_services( FT_Library, FT_ServiceDescRec*);
|
||||
void FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec*);
|
||||
void FT_Init_Class_sfnt_interface( FT_Library, SFNT_Interface*);
|
||||
void FT_Init_Class_sfnt_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
|
||||
void FT_Init_Class_sfnt_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
|
||||
void FT_Init_Class_tt_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
|
||||
void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec*);
|
||||
|
||||
/* forward declaration of PIC init functions from ttcmap.c */
|
||||
FT_Error FT_Create_Class_tt_cmap_classes( FT_Library, TT_CMap_Class**);
|
||||
void FT_Destroy_Class_tt_cmap_classes( FT_Library, TT_CMap_Class*);
|
||||
|
||||
void
|
||||
sfnt_module_class_pic_free( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_Memory memory = library->memory;
|
||||
if ( pic_container->sfnt )
|
||||
{
|
||||
sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt;
|
||||
if(container->sfnt_services)
|
||||
FT_Destroy_Class_sfnt_services(library, container->sfnt_services);
|
||||
container->sfnt_services = NULL;
|
||||
if(container->tt_cmap_classes)
|
||||
FT_Destroy_Class_tt_cmap_classes(library, container->tt_cmap_classes);
|
||||
container->tt_cmap_classes = NULL;
|
||||
FT_FREE( container );
|
||||
pic_container->sfnt = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
sfnt_module_class_pic_init( FT_Library library )
|
||||
{
|
||||
FT_PIC_Container* pic_container = &library->pic_container;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
sfntModulePIC* container;
|
||||
FT_Memory memory = library->memory;
|
||||
|
||||
/* allocate pointer, clear and set global container pointer */
|
||||
if ( FT_ALLOC ( container, sizeof ( *container ) ) )
|
||||
return error;
|
||||
FT_MEM_SET( container, 0, sizeof(*container) );
|
||||
pic_container->sfnt = container;
|
||||
|
||||
/* initialize pointer table - this is how the module usually expects this data */
|
||||
error = FT_Create_Class_sfnt_services(library, &container->sfnt_services);
|
||||
if(error)
|
||||
goto Exit;
|
||||
error = FT_Create_Class_tt_cmap_classes(library, &container->tt_cmap_classes);
|
||||
if(error)
|
||||
goto Exit;
|
||||
FT_Init_Class_sfnt_service_glyph_dict(library, &container->sfnt_service_glyph_dict);
|
||||
FT_Init_Class_sfnt_service_ps_name(library, &container->sfnt_service_ps_name);
|
||||
FT_Init_Class_tt_service_get_cmap_info(library, &container->tt_service_get_cmap_info);
|
||||
FT_Init_Class_sfnt_service_sfnt_table(&container->sfnt_service_sfnt_table);
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
FT_Init_Class_sfnt_service_bdf(&container->sfnt_service_bdf);
|
||||
#endif
|
||||
FT_Init_Class_sfnt_interface(library, &container->sfnt_interface);
|
||||
|
||||
Exit:
|
||||
if(error)
|
||||
sfnt_module_class_pic_free(library);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
|
||||
/* END */
|
|
@ -0,0 +1,88 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* sfntpic.h */
|
||||
/* */
|
||||
/* The FreeType position independent code services for sfnt module. */
|
||||
/* */
|
||||
/* Copyright 2009 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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 __SFNTPIC_H__
|
||||
#define __SFNTPIC_H__
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
#include FT_INTERNAL_PIC_H
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
#define FT_SFNT_SERVICES_GET sfnt_services
|
||||
#define FT_SFNT_SERVICE_GLYPH_DICT_GET sfnt_service_glyph_dict
|
||||
#define FT_SFNT_SERVICE_PS_NAME_GET sfnt_service_ps_name
|
||||
#define FT_TT_SERVICE_GET_CMAP_INFO_GET tt_service_get_cmap_info
|
||||
#define FT_SFNT_SERVICES_GET sfnt_services
|
||||
#define FT_TT_CMAP_CLASSES_GET tt_cmap_classes
|
||||
#define FT_SFNT_SERVICE_SFNT_TABLE_GET sfnt_service_sfnt_table
|
||||
#define FT_SFNT_SERVICE_BDF_GET sfnt_service_bdf
|
||||
#define FT_SFNT_INTERFACE_GET sfnt_interface
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* some include files required for members of sfntModulePIC */
|
||||
#include FT_SERVICE_GLYPH_DICT_H
|
||||
#include FT_SERVICE_POSTSCRIPT_NAME_H
|
||||
#include FT_SERVICE_SFNT_H
|
||||
#include FT_SERVICE_TT_CMAP_H
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
#include "ttbdf.h"
|
||||
#include FT_SERVICE_BDF_H
|
||||
#endif
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_INTERNAL_SFNT_H
|
||||
#include "ttcmap.h"
|
||||
|
||||
typedef struct sfntModulePIC_
|
||||
{
|
||||
FT_ServiceDescRec* sfnt_services;
|
||||
FT_Service_GlyphDictRec sfnt_service_glyph_dict;
|
||||
FT_Service_PsFontNameRec sfnt_service_ps_name;
|
||||
FT_Service_TTCMapsRec tt_service_get_cmap_info;
|
||||
TT_CMap_Class* tt_cmap_classes;
|
||||
FT_Service_SFNT_TableRec sfnt_service_sfnt_table;
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
FT_Service_BDFRec sfnt_service_bdf;
|
||||
#endif
|
||||
SFNT_Interface sfnt_interface;
|
||||
} sfntModulePIC;
|
||||
|
||||
#define GET_PIC(lib) ((sfntModulePIC*)((lib)->pic_container.sfnt))
|
||||
#define FT_SFNT_SERVICES_GET (GET_PIC(library)->sfnt_services)
|
||||
#define FT_SFNT_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->sfnt_service_glyph_dict)
|
||||
#define FT_SFNT_SERVICE_PS_NAME_GET (GET_PIC(library)->sfnt_service_ps_name)
|
||||
#define FT_TT_SERVICE_GET_CMAP_INFO_GET (GET_PIC(library)->tt_service_get_cmap_info)
|
||||
#define FT_SFNT_SERVICES_GET (GET_PIC(library)->sfnt_services)
|
||||
#define FT_TT_CMAP_CLASSES_GET (GET_PIC(library)->tt_cmap_classes)
|
||||
#define FT_SFNT_SERVICE_SFNT_TABLE_GET (GET_PIC(library)->sfnt_service_sfnt_table)
|
||||
#define FT_SFNT_SERVICE_BDF_GET (GET_PIC(library)->sfnt_service_bdf)
|
||||
#define FT_SFNT_INTERFACE_GET (GET_PIC(library)->sfnt_interface)
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __SFNTPIC_H__ */
|
||||
|
||||
|
||||
/* END */
|
|
@ -25,6 +25,7 @@
|
|||
#include FT_INTERNAL_STREAM_H
|
||||
#include "ttload.h"
|
||||
#include "ttcmap.h"
|
||||
#include "sfntpic.h"
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -164,10 +165,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap0_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap0_class_rec,
|
||||
sizeof ( TT_CMapRec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap_init,
|
||||
|
@ -176,11 +174,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap0_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
0,
|
||||
(TT_CMap_ValidateFunc) tt_cmap0_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap0_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_0 */
|
||||
|
||||
|
@ -543,10 +541,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap2_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap2_class_rec,
|
||||
sizeof ( TT_CMapRec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap_init,
|
||||
|
@ -555,11 +550,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap2_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
2,
|
||||
(TT_CMap_ValidateFunc) tt_cmap2_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap2_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_2 */
|
||||
|
||||
|
@ -1382,10 +1377,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap4_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap4_class_rec,
|
||||
sizeof ( TT_CMap4Rec ),
|
||||
(FT_CMap_InitFunc) tt_cmap4_init,
|
||||
(FT_CMap_DoneFunc) NULL,
|
||||
|
@ -1393,11 +1385,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap4_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
4,
|
||||
(TT_CMap_ValidateFunc) tt_cmap4_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap4_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_4 */
|
||||
|
||||
|
@ -1544,10 +1536,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap6_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap6_class_rec,
|
||||
sizeof ( TT_CMapRec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap_init,
|
||||
|
@ -1556,11 +1545,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap6_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
6,
|
||||
(TT_CMap_ValidateFunc) tt_cmap6_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap6_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_6 */
|
||||
|
||||
|
@ -1800,10 +1789,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap8_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap8_class_rec,
|
||||
sizeof ( TT_CMapRec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap_init,
|
||||
|
@ -1812,11 +1798,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap8_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
8,
|
||||
(TT_CMap_ValidateFunc) tt_cmap8_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap8_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_8 */
|
||||
|
||||
|
@ -1952,10 +1938,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap10_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap10_class_rec,
|
||||
sizeof ( TT_CMapRec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap_init,
|
||||
|
@ -1964,11 +1947,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap10_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
10,
|
||||
(TT_CMap_ValidateFunc) tt_cmap10_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap10_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_10 */
|
||||
|
||||
|
@ -2272,10 +2255,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap12_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap12_class_rec,
|
||||
sizeof ( TT_CMap12Rec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap12_init,
|
||||
|
@ -2284,11 +2264,11 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap12_char_next,
|
||||
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
},
|
||||
,
|
||||
12,
|
||||
(TT_CMap_ValidateFunc) tt_cmap12_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap12_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_12 */
|
||||
|
||||
|
@ -3325,10 +3305,7 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap14_class_rec =
|
||||
{
|
||||
{
|
||||
FT_DEFINE_TT_CMAP(tt_cmap14_class_rec,
|
||||
sizeof ( TT_CMap14Rec ),
|
||||
|
||||
(FT_CMap_InitFunc) tt_cmap14_init,
|
||||
|
@ -3342,56 +3319,67 @@
|
|||
(FT_CMap_VariantListFunc) tt_cmap14_variants,
|
||||
(FT_CMap_CharVariantListFunc) tt_cmap14_char_variants,
|
||||
(FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars
|
||||
},
|
||||
,
|
||||
14,
|
||||
(TT_CMap_ValidateFunc)tt_cmap14_validate,
|
||||
(TT_CMap_Info_GetFunc)tt_cmap14_get_info
|
||||
};
|
||||
)
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_14 */
|
||||
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
static const TT_CMap_Class tt_cmap_classes[] =
|
||||
{
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_0
|
||||
&tt_cmap0_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_2
|
||||
&tt_cmap2_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_4
|
||||
&tt_cmap4_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_6
|
||||
&tt_cmap6_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_8
|
||||
&tt_cmap8_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_10
|
||||
&tt_cmap10_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_12
|
||||
&tt_cmap12_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_13
|
||||
&tt_cmap13_class_rec,
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_14
|
||||
&tt_cmap14_class_rec,
|
||||
#endif
|
||||
|
||||
#define TTCMAPCITEM(a) &a,
|
||||
#include "ttcmapc.h"
|
||||
NULL,
|
||||
};
|
||||
|
||||
#else /*FT_CONFIG_OPTION_PIC*/
|
||||
|
||||
void FT_Destroy_Class_tt_cmap_classes(FT_Library library, TT_CMap_Class* clazz)
|
||||
{
|
||||
FT_Memory memory = library->memory;
|
||||
if ( clazz )
|
||||
FT_FREE( clazz );
|
||||
}
|
||||
|
||||
FT_Error FT_Create_Class_tt_cmap_classes(FT_Library library, TT_CMap_Class** output_class)
|
||||
{
|
||||
TT_CMap_Class* clazz;
|
||||
TT_CMap_ClassRec* recs;
|
||||
FT_Error error;
|
||||
FT_Memory memory = library->memory;
|
||||
int i = 0;
|
||||
|
||||
#define TTCMAPCITEM(a) i++;
|
||||
#include "ttcmapc.h"
|
||||
|
||||
/* allocate enough space for both the pointers +terminator and the class instances */
|
||||
if ( FT_ALLOC( clazz, sizeof(*clazz)*(i+1)+sizeof(TT_CMap_ClassRec)*i ) )
|
||||
return error;
|
||||
|
||||
/* the location of the class instances follows the array of pointers */
|
||||
recs = (TT_CMap_ClassRec*) (((char*)clazz)+(sizeof(*clazz)*(i+1)));
|
||||
i=0;
|
||||
|
||||
#undef TTCMAPCITEM
|
||||
#define TTCMAPCITEM(a) \
|
||||
FT_Init_Class_##a(&recs[i]); \
|
||||
clazz[i] = &recs[i]; \
|
||||
i++;
|
||||
#include "ttcmapc.h"
|
||||
|
||||
clazz[i] = NULL;
|
||||
|
||||
*output_class = clazz;
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
#endif /*FT_CONFIG_OPTION_PIC*/
|
||||
|
||||
|
||||
/* parse the `cmap' table and build the corresponding TT_CMap objects */
|
||||
/* in the current face */
|
||||
|
@ -3403,6 +3391,8 @@
|
|||
FT_Byte* limit = table + face->cmap_size;
|
||||
FT_UInt volatile num_cmaps;
|
||||
FT_Byte* volatile p = table;
|
||||
FT_Library library = FT_FACE_LIBRARY(face);
|
||||
FT_UNUSED(library);
|
||||
|
||||
|
||||
if ( p + 4 > limit )
|
||||
|
@ -3435,7 +3425,7 @@
|
|||
{
|
||||
FT_Byte* volatile cmap = table + offset;
|
||||
volatile FT_UInt format = TT_PEEK_USHORT( cmap );
|
||||
const TT_CMap_Class* volatile pclazz = tt_cmap_classes;
|
||||
const TT_CMap_Class* volatile pclazz = FT_TT_CMAP_CLASSES_GET;
|
||||
TT_CMap_Class volatile clazz;
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,46 @@ FT_BEGIN_HEADER
|
|||
|
||||
} TT_CMap_ClassRec;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_PIC
|
||||
|
||||
#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_ \
|
||||
};
|
||||
|
||||
#else /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
#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_) \
|
||||
void \
|
||||
FT_Init_Class_##class_( TT_CMap_ClassRec* clazz ) \
|
||||
{ \
|
||||
clazz->clazz.size = size_; \
|
||||
clazz->clazz.init = init_; \
|
||||
clazz->clazz.done = done_; \
|
||||
clazz->clazz.char_index = char_index_; \
|
||||
clazz->clazz.char_next = char_next_; \
|
||||
clazz->clazz.char_var_index = char_var_index_; \
|
||||
clazz->clazz.char_var_default = char_var_default_; \
|
||||
clazz->clazz.variant_list = variant_list_; \
|
||||
clazz->clazz.charvariant_list = charvariant_list_; \
|
||||
clazz->clazz.variantchar_list = variantchar_list_; \
|
||||
clazz->format = format_; \
|
||||
clazz->validate = validate_; \
|
||||
clazz->get_cmap_info = get_cmap_info_; \
|
||||
}
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_PIC */
|
||||
|
||||
typedef struct TT_ValidatorRec_
|
||||
{
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ttcmapc.h */
|
||||
/* */
|
||||
/* TT CMAP classes definitions (specification only). */
|
||||
/* */
|
||||
/* Copyright 2009 by */
|
||||
/* Oran Agra and Mickey Gabel. */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_0
|
||||
TTCMAPCITEM(tt_cmap0_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_2
|
||||
TTCMAPCITEM(tt_cmap2_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_4
|
||||
TTCMAPCITEM(tt_cmap4_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_6
|
||||
TTCMAPCITEM(tt_cmap6_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_8
|
||||
TTCMAPCITEM(tt_cmap8_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_10
|
||||
TTCMAPCITEM(tt_cmap10_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_12
|
||||
TTCMAPCITEM(tt_cmap12_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_13
|
||||
TTCMAPCITEM(tt_cmap13_class_rec)
|
||||
#endif
|
||||
|
||||
#ifdef TT_CONFIG_CMAP_FORMAT_14
|
||||
TTCMAPCITEM(tt_cmap14_class_rec)
|
||||
#endif
|
||||
|
||||
/* END */
|
Загрузка…
Ссылка в новой задаче