#include <freetype/ftlist.h>
#include <freetype/ftoutln.h>
#include <freetype/ftfntfmt.h>
#include <freetype/otsvg.h>
#include <freetype/internal/ftvalid.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftrfork.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/sfnt.h>
#include <freetype/internal/psaux.h>
#include <freetype/internal/svginterface.h>
#include <freetype/tttables.h>
#include <freetype/tttags.h>
#include <freetype/ttnameid.h>
#include <freetype/internal/services/svprop.h>
#include <freetype/internal/services/svsfnt.h>
#include <freetype/internal/services/svpostnm.h>
#include <freetype/internal/services/svgldict.h>
#include <freetype/internal/services/svttcmap.h>
#include <freetype/internal/services/svkern.h>
#include <freetype/internal/services/svtteng.h>
#include <freetype/ftdriver.h>
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#include "ftbase.h"
#endif
#ifdef FT_DEBUG_LEVEL_TRACE
#include <freetype/ftbitmap.h>
#if defined( _MSC_VER )
#pragma warning( push )
#pragma warning( disable : 4244 )
#endif
#define MD5_u32plus …
#define MD5_CTX …
#define MD5_Init …
#define MD5_Update …
#define MD5_Final …
#undef HAVE_OPENSSL
#include "md5.c"
#if defined( _MSC_VER )
#pragma warning( pop )
#endif
static const char* const pixel_modes[] =
{
"none",
"monochrome bitmap",
"gray 8-bit bitmap",
"gray 2-bit bitmap",
"gray 4-bit bitmap",
"LCD 8-bit bitmap",
"vertical LCD 8-bit bitmap",
"BGRA 32-bit color image bitmap",
"SDF 8-bit bitmap"
};
#endif
#define GRID_FIT_METRICS
static FT_Error
ft_open_face_internal( FT_Library library,
const FT_Open_Args* args,
FT_Long face_index,
FT_Face *aface,
FT_Bool test_mac_fonts );
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id )
{ … }
FT_BASE_DEF( void )
ft_validator_init( FT_Validator valid,
const FT_Byte* base,
const FT_Byte* limit,
FT_ValidationLevel level )
{ … }
FT_BASE_DEF( FT_Int )
ft_validator_run( FT_Validator valid )
{ … }
FT_BASE_DEF( void )
ft_validator_error( FT_Validator valid,
FT_Error error )
{ … }
FT_BASE_DEF( FT_Error )
FT_Stream_New( FT_Library library,
const FT_Open_Args* args,
FT_Stream *astream )
{ … }
FT_BASE_DEF( void )
FT_Stream_Free( FT_Stream stream,
FT_Int external )
{ … }
#undef FT_COMPONENT
#define FT_COMPONENT …
static FT_Error
ft_glyphslot_init( FT_GlyphSlot slot )
{ … }
FT_BASE_DEF( void )
ft_glyphslot_free_bitmap( FT_GlyphSlot slot )
{ … }
FT_BASE_DEF( FT_Bool )
ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin )
{ … }
FT_BASE_DEF( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Byte* buffer )
{ … }
FT_BASE_DEF( FT_Error )
ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
FT_ULong size )
{ … }
static void
ft_glyphslot_clear( FT_GlyphSlot slot )
{ … }
static void
ft_glyphslot_done( FT_GlyphSlot slot )
{ … }
FT_BASE_DEF( FT_Error )
FT_New_GlyphSlot( FT_Face face,
FT_GlyphSlot *aslot )
{ … }
FT_BASE_DEF( void )
FT_Done_GlyphSlot( FT_GlyphSlot slot )
{ … }
FT_EXPORT_DEF( void )
FT_Set_Transform( FT_Face face,
FT_Matrix* matrix,
FT_Vector* delta )
{ … }
FT_EXPORT_DEF( void )
FT_Get_Transform( FT_Face face,
FT_Matrix* matrix,
FT_Vector* delta )
{ … }
static FT_Renderer
ft_lookup_glyph_renderer( FT_GlyphSlot slot );
#ifdef GRID_FIT_METRICS
static void
ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot,
FT_Bool vertical )
{ … }
#endif
FT_EXPORT_DEF( FT_Error )
FT_Load_Glyph( FT_Face face,
FT_UInt glyph_index,
FT_Int32 load_flags )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Load_Char( FT_Face face,
FT_ULong char_code,
FT_Int32 load_flags )
{ … }
static void
destroy_size( FT_Memory memory,
void* size_,
void* driver_ )
{ … }
static void
ft_cmap_done_internal( FT_CMap cmap );
static void
destroy_charmaps( FT_Face face,
FT_Memory memory )
{ … }
static void
destroy_face( FT_Memory memory,
void* face_,
void* driver_ )
{ … }
static void
Destroy_Driver( FT_Driver driver )
{ … }
static FT_Error
find_unicode_charmap( FT_Face face )
{ … }
static FT_CharMap
find_variant_selector_charmap( FT_Face face )
{ … }
static FT_Error
open_face( FT_Driver driver,
FT_Stream *astream,
FT_Bool *anexternal_stream,
FT_Long face_index,
FT_Int num_params,
FT_Parameter* params,
FT_Face *aface )
{ … }
#ifndef FT_MACINTOSH
FT_EXPORT_DEF( FT_Error )
FT_New_Face( FT_Library library,
const char* pathname,
FT_Long face_index,
FT_Face *aface )
{ … }
#endif
FT_EXPORT_DEF( FT_Error )
FT_New_Memory_Face( FT_Library library,
const FT_Byte* file_base,
FT_Long file_size,
FT_Long face_index,
FT_Face *aface )
{ … }
#ifdef FT_CONFIG_OPTION_MAC_FONTS
static void
memory_stream_close( FT_Stream stream )
{ … }
static FT_Error
new_memory_stream( FT_Library library,
FT_Byte* base,
FT_ULong size,
FT_Stream_CloseFunc close,
FT_Stream *astream )
{ … }
FT_LOCAL_DEF( FT_Error )
open_face_from_buffer( FT_Library library,
FT_Byte* base,
FT_ULong size,
FT_Long face_index,
const char* driver_name,
FT_Face *aface )
{ … }
static FT_Error
ft_lookup_PS_in_sfnt_stream( FT_Stream stream,
FT_Long face_index,
FT_ULong* offset,
FT_ULong* length,
FT_Bool* is_sfnt_cid )
{ … }
FT_LOCAL_DEF( FT_Error )
open_face_PS_from_sfnt_stream( FT_Library library,
FT_Stream stream,
FT_Long face_index,
FT_Int num_params,
FT_Parameter *params,
FT_Face *aface )
{ … }
#ifndef FT_MACINTOSH
static FT_Error
Mac_Read_POST_Resource( FT_Library library,
FT_Stream stream,
FT_Long *offsets,
FT_Long resource_cnt,
FT_Long face_index,
FT_Face *aface )
{ … }
static FT_Error
Mac_Read_sfnt_Resource( FT_Library library,
FT_Stream stream,
FT_Long *offsets,
FT_Long resource_cnt,
FT_Long face_index,
FT_Face *aface )
{ … }
static FT_Error
IsMacResource( FT_Library library,
FT_Stream stream,
FT_Long resource_offset,
FT_Long face_index,
FT_Face *aface )
{ … }
static FT_Error
IsMacBinary( FT_Library library,
FT_Stream stream,
FT_Long face_index,
FT_Face *aface )
{ … }
static FT_Error
load_face_in_embedded_rfork( FT_Library library,
FT_Stream stream,
FT_Long face_index,
FT_Face *aface,
const FT_Open_Args *args )
{ … }
static FT_Error
load_mac_face( FT_Library library,
FT_Stream stream,
FT_Long face_index,
FT_Face *aface,
const FT_Open_Args *args )
{ … }
#endif
#endif
FT_EXPORT_DEF( FT_Error )
FT_Open_Face( FT_Library library,
const FT_Open_Args* args,
FT_Long face_index,
FT_Face *aface )
{ … }
static FT_Error
ft_open_face_internal( FT_Library library,
const FT_Open_Args* args,
FT_Long face_index,
FT_Face *aface,
FT_Bool test_mac_fonts )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Attach_File( FT_Face face,
const char* filepathname )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Attach_Stream( FT_Face face,
const FT_Open_Args* parameters )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Reference_Face( FT_Face face )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Done_Face( FT_Face face )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_New_Size( FT_Face face,
FT_Size *asize )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Done_Size( FT_Size size )
{ … }
FT_BASE_DEF( FT_Error )
FT_Match_Size( FT_Face face,
FT_Size_Request req,
FT_Bool ignore_width,
FT_ULong* size_index )
{ … }
FT_BASE_DEF( void )
ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
FT_Pos advance )
{ … }
static void
ft_recompute_scaled_metrics( FT_Face face,
FT_Size_Metrics* metrics )
{ … }
FT_BASE_DEF( void )
FT_Select_Metrics( FT_Face face,
FT_ULong strike_index )
{ … }
FT_BASE_DEF( FT_Error )
FT_Request_Metrics( FT_Face face,
FT_Size_Request req )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Select_Size( FT_Face face,
FT_Int strike_index )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Request_Size( FT_Face face,
FT_Size_Request req )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Set_Char_Size( FT_Face face,
FT_F26Dot6 char_width,
FT_F26Dot6 char_height,
FT_UInt horz_resolution,
FT_UInt vert_resolution )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Set_Pixel_Sizes( FT_Face face,
FT_UInt pixel_width,
FT_UInt pixel_height )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Get_Kerning( FT_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_UInt kern_mode,
FT_Vector *akerning )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Get_Track_Kerning( FT_Face face,
FT_Fixed point_size,
FT_Int degree,
FT_Fixed* akerning )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Select_Charmap( FT_Face face,
FT_Encoding encoding )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Set_Charmap( FT_Face face,
FT_CharMap charmap )
{ … }
FT_EXPORT_DEF( FT_Int )
FT_Get_Charmap_Index( FT_CharMap charmap )
{ … }
static void
ft_cmap_done_internal( FT_CMap cmap )
{ … }
FT_BASE_DEF( void )
FT_CMap_Done( FT_CMap cmap )
{ … }
FT_BASE_DEF( FT_Error )
FT_CMap_New( FT_CMap_Class clazz,
FT_Pointer init_data,
FT_CharMap charmap,
FT_CMap *acmap )
{ … }
FT_EXPORT_DEF( FT_UInt )
FT_Get_Char_Index( FT_Face face,
FT_ULong charcode )
{ … }
FT_EXPORT_DEF( FT_ULong )
FT_Get_First_Char( FT_Face face,
FT_UInt *agindex )
{ … }
FT_EXPORT_DEF( FT_ULong )
FT_Get_Next_Char( FT_Face face,
FT_ULong charcode,
FT_UInt *agindex )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Face_Properties( FT_Face face,
FT_UInt num_properties,
FT_Parameter* properties )
{ … }
FT_EXPORT_DEF( FT_UInt )
FT_Face_GetCharVariantIndex( FT_Face face,
FT_ULong charcode,
FT_ULong variantSelector )
{ … }
FT_EXPORT_DEF( FT_Int )
FT_Face_GetCharVariantIsDefault( FT_Face face,
FT_ULong charcode,
FT_ULong variantSelector )
{ … }
FT_EXPORT_DEF( FT_UInt32* )
FT_Face_GetVariantSelectors( FT_Face face )
{ … }
FT_EXPORT_DEF( FT_UInt32* )
FT_Face_GetVariantsOfChar( FT_Face face,
FT_ULong charcode )
{ … }
FT_EXPORT_DEF( FT_UInt32* )
FT_Face_GetCharsOfVariant( FT_Face face,
FT_ULong variantSelector )
{ … }
FT_EXPORT_DEF( FT_UInt )
FT_Get_Name_Index( FT_Face face,
const FT_String* glyph_name )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Get_Glyph_Name( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
{ … }
FT_EXPORT_DEF( const char* )
FT_Get_Postscript_Name( FT_Face face )
{ … }
FT_EXPORT_DEF( void* )
FT_Get_Sfnt_Table( FT_Face face,
FT_Sfnt_Tag tag )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Load_Sfnt_Table( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Sfnt_Table_Info( FT_Face face,
FT_UInt table_index,
FT_ULong *tag,
FT_ULong *length )
{ … }
FT_EXPORT_DEF( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap )
{ … }
FT_EXPORT_DEF( FT_Long )
FT_Get_CMap_Format( FT_CharMap charmap )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Activate_Size( FT_Size size )
{ … }
FT_BASE_DEF( FT_Renderer )
FT_Lookup_Renderer( FT_Library library,
FT_Glyph_Format format,
FT_ListNode* node )
{ … }
static FT_Renderer
ft_lookup_glyph_renderer( FT_GlyphSlot slot )
{ … }
static void
ft_set_current_renderer( FT_Library library )
{ … }
static FT_Error
ft_add_renderer( FT_Module module )
{ … }
static void
ft_remove_renderer( FT_Module module )
{ … }
FT_EXPORT_DEF( FT_Renderer )
FT_Get_Renderer( FT_Library library,
FT_Glyph_Format format )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Set_Renderer( FT_Library library,
FT_Renderer renderer,
FT_UInt num_params,
FT_Parameter* parameters )
{ … }
FT_BASE_DEF( FT_Error )
FT_Render_Glyph_Internal( FT_Library library,
FT_GlyphSlot slot,
FT_Render_Mode render_mode )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Render_Glyph( FT_GlyphSlot slot,
FT_Render_Mode render_mode )
{ … }
static void
Destroy_Module( FT_Module module )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Add_Module( FT_Library library,
const FT_Module_Class* clazz )
{ … }
FT_EXPORT_DEF( FT_Module )
FT_Get_Module( FT_Library library,
const char* module_name )
{ … }
FT_BASE_DEF( const void* )
FT_Get_Module_Interface( FT_Library library,
const char* mod_name )
{ … }
FT_BASE_DEF( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id,
FT_Bool global )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Remove_Module( FT_Library library,
FT_Module module )
{ … }
static FT_Error
ft_property_do( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
void* value,
FT_Bool set,
FT_Bool value_is_string )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Property_Set( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
const void* value )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Property_Get( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
void* value )
{ … }
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_BASE_DEF( FT_Error )
ft_property_string_set( FT_Library library,
const FT_String* module_name,
const FT_String* property_name,
FT_String* value )
{ … }
#endif
FT_EXPORT_DEF( FT_Error )
FT_Reference_Library( FT_Library library )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_New_Library( FT_Memory memory,
FT_Library *alibrary )
{ … }
FT_EXPORT_DEF( void )
FT_Library_Version( FT_Library library,
FT_Int *amajor,
FT_Int *aminor,
FT_Int *apatch )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Done_Library( FT_Library library )
{ … }
FT_EXPORT_DEF( void )
FT_Set_Debug_Hook( FT_Library library,
FT_UInt hook_index,
FT_DebugHook_Func debug_hook )
{ … }
FT_EXPORT_DEF( FT_TrueTypeEngineType )
FT_Get_TrueType_Engine_Type( FT_Library library )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
FT_UInt sub_index,
FT_Int *p_index,
FT_UInt *p_flags,
FT_Int *p_arg1,
FT_Int *p_arg2,
FT_Matrix *p_transform )
{ … }
FT_EXPORT_DEF( FT_Bool )
FT_Get_Color_Glyph_Layer( FT_Face face,
FT_UInt base_glyph,
FT_UInt *aglyph_index,
FT_UInt *acolor_index,
FT_LayerIterator* iterator )
{ … }
FT_EXPORT_DEF( FT_Bool )
FT_Get_Color_Glyph_Paint( FT_Face face,
FT_UInt base_glyph,
FT_Color_Root_Transform root_transform,
FT_OpaquePaint* paint )
{ … }
FT_EXPORT_DEF( FT_Bool )
FT_Get_Color_Glyph_ClipBox( FT_Face face,
FT_UInt base_glyph,
FT_ClipBox* clip_box )
{ … }
FT_EXPORT_DEF( FT_Bool )
FT_Get_Paint_Layers( FT_Face face,
FT_LayerIterator* layer_iterator,
FT_OpaquePaint* paint )
{ … }
FT_EXPORT_DEF( FT_Bool )
FT_Get_Paint( FT_Face face,
FT_OpaquePaint opaque_paint,
FT_COLR_Paint* paint )
{ … }
FT_EXPORT_DEF( FT_Bool )
FT_Get_Colorline_Stops ( FT_Face face,
FT_ColorStop * color_stop,
FT_ColorStopIterator *iterator )
{ … }