1 2 // Copyright 2019 - 2021 Michael D. Parker 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.freetype.bind.ftmodapi; 8 9 import bindbc.freetype.config; 10 import bindbc.freetype.bind.freetype, 11 bindbc.freetype.bind.ftsystem, 12 bindbc.freetype.bind.fttypes; 13 14 enum { 15 FT_MODULE_FONT_DRIVER = 1, 16 FT_MODULE_RENDERER = 2, 17 FT_MODULE_HINTER = 4, 18 FT_MODULE_STYLER = 8, 19 FT_MODULE_DRIVER_SCALABLE = 0x100, 20 FT_MODULE_DRIVER_NO_OUTLINES= 0x200, 21 FT_MODULE_DRIVER_HAS_HINTER = 0x400, 22 FT_MODULE_DRIVER_HINTS_LIGHTLY = 0x800, 23 } 24 25 alias FT_Module_Interface = FT_Pointer; 26 27 extern(C) nothrow { 28 alias FT_Module_Constructor = FT_Error function(FT_Module); 29 alias FT_Module_Destructor = void function(FT_Module); 30 alias FT_Module_Requester = FT_Module_Interface function(FT_Module, const(char)*); 31 } 32 33 struct FT_Module_Class { 34 FT_ULong module_flags; 35 FT_Long module_size; 36 FT_String* module_name; 37 FT_Fixed module_version; 38 FT_Fixed module_requires; 39 void* module_interface; 40 FT_Module_Constructor module_init; 41 FT_Module_Destructor module_done; 42 FT_Module_Requester get_interface; 43 } 44 45 static if((ftSupport == FTSupport.ft210 && FREETYPE_PATCH > 0) || ftSupport > FTSupport.ft210) 46 extern(C) nothrow alias FT_DebugHook_Func = FT_Error function(void*); 47 else 48 extern(C) nothrow alias FT_DebugHook_Func = void function(void*); 49 50 alias FT_TrueTypeEngineType = int; 51 enum { 52 FT_TRUETYPE_ENGINE_TYPE_NONE = 0, 53 FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, 54 FT_TRUETYPE_ENGINE_TYPE_PATENTED 55 } 56 57 static if(staticBinding) { 58 extern(C) @nogc nothrow { 59 FT_Error FT_Add_Module(FT_Library library, const(FT_Module_Class)* clazz); 60 FT_Module FT_Get_Module(FT_Library library, const(char)* module_name); 61 FT_Error FT_Remove_Module(FT_Library library, FT_Module module_); 62 FT_Error FT_Property_Set(FT_Library library, const(FT_String)* module_name, const(FT_String)* property_name, const(void)* value); 63 FT_Error FT_Property_Get(FT_Library library, const(FT_String)* module_name, const(FT_String)* property_name, void* value); 64 FT_Error FT_Reference_Library(FT_Library library); 65 FT_Error FT_New_Library(FT_Memory memory, FT_Library* alibrary); 66 FT_Error FT_Done_Library(FT_Library library); 67 void FT_Set_Debug_Hook(FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook); 68 void FT_Add_Default_Modules(FT_Library library); 69 FT_TrueTypeEngineType FT_Get_TrueType_Engine_Type(FT_Library library); 70 71 static if(ftSupport >= FTSupport.ft28) { 72 void FT_Set_Default_Properties(FT_Library library); 73 } 74 } 75 } 76 else { 77 extern(C) @nogc nothrow { 78 alias pFT_Add_Module = FT_Error function(FT_Library library, const(FT_Module_Class)* clazz); 79 alias pFT_Get_Module = FT_Module function(FT_Library library, const(char)* module_name); 80 alias pFT_Remove_Module = FT_Error function(FT_Library library, FT_Module module_); 81 alias pFT_Property_Set = FT_Error function(FT_Library library, const(FT_String)* module_name, const(FT_String)* property_name, const(void)* value); 82 alias pFT_Property_Get = FT_Error function(FT_Library library, const(FT_String)* module_name, const(FT_String)* property_name, void* value); 83 alias pFT_Reference_Library = FT_Error function(FT_Library library); 84 alias pFT_New_Library = FT_Error function(FT_Memory memory, FT_Library* alibrary); 85 alias pFT_Done_Library = FT_Error function(FT_Library library); 86 alias pFT_Set_Debug_Hook = void function(FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook); 87 alias pFT_Add_Default_Modules = void function(FT_Library library); 88 alias pFT_Get_TrueType_Engine_Type = FT_TrueTypeEngineType function(FT_Library library); 89 90 static if(ftSupport >= FTSupport.ft28) { 91 alias pFT_Set_Default_Properties = void function(FT_Library library); 92 } 93 } 94 95 __gshared { 96 pFT_Add_Module FT_Add_Module; 97 pFT_Get_Module FT_Get_Module; 98 pFT_Remove_Module FT_Remove_Module; 99 pFT_Property_Set FT_Property_Set; 100 pFT_Property_Get FT_Property_Get; 101 pFT_Reference_Library FT_Reference_Library; 102 pFT_New_Library FT_New_Library; 103 pFT_Done_Library FT_Done_Library; 104 pFT_Set_Debug_Hook FT_Set_Debug_Hook; 105 pFT_Add_Default_Modules FT_Add_Default_Modules; 106 pFT_Get_TrueType_Engine_Type FT_Get_TrueType_Engine_Type; 107 108 static if(ftSupport >= FTSupport.ft28) { 109 pFT_Set_Default_Properties FT_Set_Default_Properties; 110 } 111 } 112 }