Add partial FreeType bindings.

This commit is contained in:
H. Utku Maden 2023-09-15 20:35:46 +03:00
parent ae0c9e742c
commit 4a35f18737
Signed by: themixedupstuff
GPG Key ID: 25A001B636F17843
9 changed files with 762 additions and 1 deletions

2
.gitmodules vendored

@ -4,3 +4,5 @@
[submodule "lib/freetype"] [submodule "lib/freetype"]
path = lib/freetype path = lib/freetype
url = https://gitlab.freedesktop.org/freetype/freetype.git url = https://gitlab.freedesktop.org/freetype/freetype.git
[submodule "freetype"]
branch = VER-2-9-1

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)
# TODO: Figure out how the hell i'm supposed to build freetype in this weird.
# arrangement.
#
# include("../lib/freetype/CMakeLists.txt")
# project(quik_freetype2 LANGUAGES C VERSION 1.0)
# add_compile_options(-static-libgcc)
# add_library(quik_freetype SHARED)
# target_link_libraries(quik_freetype PUBLIC freetype)
# install(TARGETS quik_freetype)

596
Quik.FreeType/FreeType.cs Normal file

@ -0,0 +1,596 @@
using System.Runtime.InteropServices;
namespace Quik.FreeType
{
public partial struct FT_Glyph_Metrics_
{
[NativeTypeName("FT_Pos")]
public long width;
[NativeTypeName("FT_Pos")]
public long height;
[NativeTypeName("FT_Pos")]
public long horiBearingX;
[NativeTypeName("FT_Pos")]
public long horiBearingY;
[NativeTypeName("FT_Pos")]
public long horiAdvance;
[NativeTypeName("FT_Pos")]
public long vertBearingX;
[NativeTypeName("FT_Pos")]
public long vertBearingY;
[NativeTypeName("FT_Pos")]
public long vertAdvance;
}
public partial struct FT_Bitmap_Size_
{
[NativeTypeName("FT_Short")]
public short height;
[NativeTypeName("FT_Short")]
public short width;
[NativeTypeName("FT_Pos")]
public long size;
[NativeTypeName("FT_Pos")]
public long x_ppem;
[NativeTypeName("FT_Pos")]
public long y_ppem;
}
public partial struct FT_LibraryRec_
{
}
public partial struct FT_ModuleRec_
{
}
public partial struct FT_DriverRec_
{
}
public partial struct FT_RendererRec_
{
}
[NativeTypeName("unsigned int")]
public enum FT_Encoding_ : uint
{
FT_ENCODING_NONE = (unchecked(((uint)((byte)(0)) << 24) | ((uint)((byte)(0)) << 16) | ((uint)((byte)(0)) << 8) | (uint)((byte)(0)))),
FT_ENCODING_MS_SYMBOL = (unchecked(((uint)((byte)('s')) << 24) | ((uint)((byte)('y')) << 16) | ((uint)((byte)('m')) << 8) | (uint)((byte)('b')))),
FT_ENCODING_UNICODE = (unchecked(((uint)((byte)('u')) << 24) | ((uint)((byte)('n')) << 16) | ((uint)((byte)('i')) << 8) | (uint)((byte)('c')))),
FT_ENCODING_SJIS = (unchecked(((uint)((byte)('s')) << 24) | ((uint)((byte)('j')) << 16) | ((uint)((byte)('i')) << 8) | (uint)((byte)('s')))),
FT_ENCODING_PRC = (unchecked(((uint)((byte)('g')) << 24) | ((uint)((byte)('b')) << 16) | ((uint)((byte)(' ')) << 8) | (uint)((byte)(' ')))),
FT_ENCODING_BIG5 = (unchecked(((uint)((byte)('b')) << 24) | ((uint)((byte)('i')) << 16) | ((uint)((byte)('g')) << 8) | (uint)((byte)('5')))),
FT_ENCODING_WANSUNG = (unchecked(((uint)((byte)('w')) << 24) | ((uint)((byte)('a')) << 16) | ((uint)((byte)('n')) << 8) | (uint)((byte)('s')))),
FT_ENCODING_JOHAB = (unchecked(((uint)((byte)('j')) << 24) | ((uint)((byte)('o')) << 16) | ((uint)((byte)('h')) << 8) | (uint)((byte)('a')))),
FT_ENCODING_GB2312 = FT_ENCODING_PRC,
FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,
FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
FT_ENCODING_ADOBE_STANDARD = (unchecked(((uint)((byte)('A')) << 24) | ((uint)((byte)('D')) << 16) | ((uint)((byte)('O')) << 8) | (uint)((byte)('B')))),
FT_ENCODING_ADOBE_EXPERT = (unchecked(((uint)((byte)('A')) << 24) | ((uint)((byte)('D')) << 16) | ((uint)((byte)('B')) << 8) | (uint)((byte)('E')))),
FT_ENCODING_ADOBE_CUSTOM = (unchecked(((uint)((byte)('A')) << 24) | ((uint)((byte)('D')) << 16) | ((uint)((byte)('B')) << 8) | (uint)((byte)('C')))),
FT_ENCODING_ADOBE_LATIN_1 = (unchecked(((uint)((byte)('l')) << 24) | ((uint)((byte)('a')) << 16) | ((uint)((byte)('t')) << 8) | (uint)((byte)('1')))),
FT_ENCODING_OLD_LATIN_2 = (unchecked(((uint)((byte)('l')) << 24) | ((uint)((byte)('a')) << 16) | ((uint)((byte)('t')) << 8) | (uint)((byte)('2')))),
FT_ENCODING_APPLE_ROMAN = (unchecked(((uint)((byte)('a')) << 24) | ((uint)((byte)('r')) << 16) | ((uint)((byte)('m')) << 8) | (uint)((byte)('n')))),
}
public unsafe partial struct FT_CharMapRec_
{
[NativeTypeName("FT_Face")]
public FT_FaceRec_* face;
[NativeTypeName("FT_Encoding")]
public FT_Encoding_ encoding;
[NativeTypeName("FT_UShort")]
public ushort platform_id;
[NativeTypeName("FT_UShort")]
public ushort encoding_id;
}
public partial struct FT_Face_InternalRec_
{
}
public unsafe partial struct FT_FaceRec_
{
[NativeTypeName("FT_Long")]
public long num_faces;
[NativeTypeName("FT_Long")]
public long face_index;
[NativeTypeName("FT_Long")]
public long face_flags;
[NativeTypeName("FT_Long")]
public long style_flags;
[NativeTypeName("FT_Long")]
public long num_glyphs;
[NativeTypeName("FT_String *")]
public byte* family_name;
[NativeTypeName("FT_String *")]
public byte* style_name;
[NativeTypeName("FT_Int")]
public int num_fixed_sizes;
[NativeTypeName("FT_Bitmap_Size *")]
public FT_Bitmap_Size_* available_sizes;
[NativeTypeName("FT_Int")]
public int num_charmaps;
[NativeTypeName("FT_CharMap *")]
public FT_CharMapRec_** charmaps;
[NativeTypeName("FT_Generic")]
public FT_Generic_ generic;
[NativeTypeName("FT_BBox")]
public FT_BBox_ bbox;
[NativeTypeName("FT_UShort")]
public ushort units_per_EM;
[NativeTypeName("FT_Short")]
public short ascender;
[NativeTypeName("FT_Short")]
public short descender;
[NativeTypeName("FT_Short")]
public short height;
[NativeTypeName("FT_Short")]
public short max_advance_width;
[NativeTypeName("FT_Short")]
public short max_advance_height;
[NativeTypeName("FT_Short")]
public short underline_position;
[NativeTypeName("FT_Short")]
public short underline_thickness;
[NativeTypeName("FT_GlyphSlot")]
public FT_GlyphSlotRec_* glyph;
[NativeTypeName("FT_Size")]
public FT_SizeRec_* size;
[NativeTypeName("FT_CharMap")]
public FT_CharMapRec_* charmap;
[NativeTypeName("FT_Driver")]
public FT_DriverRec_* driver;
[NativeTypeName("FT_Memory")]
public FT_MemoryRec_* memory;
[NativeTypeName("FT_Stream")]
public FT_StreamRec_* stream;
[NativeTypeName("FT_ListRec")]
public FT_ListRec_ sizes_list;
[NativeTypeName("FT_Generic")]
public FT_Generic_ autohint;
public void* extensions;
[NativeTypeName("FT_Face_Internal")]
public FT_Face_InternalRec_* @internal;
}
public partial struct FT_Size_InternalRec_
{
}
public partial struct FT_Size_Metrics_
{
[NativeTypeName("FT_UShort")]
public ushort x_ppem;
[NativeTypeName("FT_UShort")]
public ushort y_ppem;
[NativeTypeName("FT_Fixed")]
public long x_scale;
[NativeTypeName("FT_Fixed")]
public long y_scale;
[NativeTypeName("FT_Pos")]
public long ascender;
[NativeTypeName("FT_Pos")]
public long descender;
[NativeTypeName("FT_Pos")]
public long height;
[NativeTypeName("FT_Pos")]
public long max_advance;
}
public unsafe partial struct FT_SizeRec_
{
[NativeTypeName("FT_Face")]
public FT_FaceRec_* face;
[NativeTypeName("FT_Generic")]
public FT_Generic_ generic;
[NativeTypeName("FT_Size_Metrics")]
public FT_Size_Metrics_ metrics;
[NativeTypeName("FT_Size_Internal")]
public FT_Size_InternalRec_* @internal;
}
public partial struct FT_SubGlyphRec_
{
}
public partial struct FT_Slot_InternalRec_
{
}
public unsafe partial struct FT_GlyphSlotRec_
{
[NativeTypeName("FT_Library")]
public FT_LibraryRec_* library;
[NativeTypeName("FT_Face")]
public FT_FaceRec_* face;
[NativeTypeName("FT_GlyphSlot")]
public FT_GlyphSlotRec_* next;
[NativeTypeName("FT_UInt")]
public uint glyph_index;
[NativeTypeName("FT_Generic")]
public FT_Generic_ generic;
[NativeTypeName("FT_Glyph_Metrics")]
public FT_Glyph_Metrics_ metrics;
[NativeTypeName("FT_Fixed")]
public long linearHoriAdvance;
[NativeTypeName("FT_Fixed")]
public long linearVertAdvance;
[NativeTypeName("FT_Vector")]
public FT_Vector_ advance;
[NativeTypeName("FT_Glyph_Format")]
public FT_Glyph_Format_ format;
[NativeTypeName("FT_Bitmap")]
public FT_Bitmap_ bitmap;
[NativeTypeName("FT_Int")]
public int bitmap_left;
[NativeTypeName("FT_Int")]
public int bitmap_top;
[NativeTypeName("FT_Outline")]
public FT_Outline_ outline;
[NativeTypeName("FT_UInt")]
public uint num_subglyphs;
[NativeTypeName("FT_SubGlyph")]
public FT_SubGlyphRec_* subglyphs;
public void* control_data;
public long control_len;
[NativeTypeName("FT_Pos")]
public long lsb_delta;
[NativeTypeName("FT_Pos")]
public long rsb_delta;
public void* other;
[NativeTypeName("FT_Slot_Internal")]
public FT_Slot_InternalRec_* @internal;
}
public unsafe partial struct FT_Parameter_
{
[NativeTypeName("FT_ULong")]
public ulong tag;
[NativeTypeName("FT_Pointer")]
public void* data;
}
public unsafe partial struct FT_Open_Args_
{
[NativeTypeName("FT_UInt")]
public uint flags;
[NativeTypeName("const FT_Byte *")]
public byte* memory_base;
[NativeTypeName("FT_Long")]
public long memory_size;
[NativeTypeName("FT_String *")]
public byte* pathname;
[NativeTypeName("FT_Stream")]
public FT_StreamRec_* stream;
[NativeTypeName("FT_Module")]
public FT_ModuleRec_* driver;
[NativeTypeName("FT_Int")]
public int num_params;
[NativeTypeName("FT_Parameter *")]
public FT_Parameter_* @params;
}
[NativeTypeName("unsigned int")]
public enum FT_Size_Request_Type_ : uint
{
FT_SIZE_REQUEST_TYPE_NOMINAL,
FT_SIZE_REQUEST_TYPE_REAL_DIM,
FT_SIZE_REQUEST_TYPE_BBOX,
FT_SIZE_REQUEST_TYPE_CELL,
FT_SIZE_REQUEST_TYPE_SCALES,
FT_SIZE_REQUEST_TYPE_MAX,
}
public partial struct FT_Size_RequestRec_
{
[NativeTypeName("FT_Size_Request_Type")]
public FT_Size_Request_Type_ type;
[NativeTypeName("FT_Long")]
public long width;
[NativeTypeName("FT_Long")]
public long height;
[NativeTypeName("FT_UInt")]
public uint horiResolution;
[NativeTypeName("FT_UInt")]
public uint vertResolution;
}
[NativeTypeName("unsigned int")]
public enum FT_Render_Mode_ : uint
{
FT_RENDER_MODE_NORMAL = 0,
FT_RENDER_MODE_LIGHT,
FT_RENDER_MODE_MONO,
FT_RENDER_MODE_LCD,
FT_RENDER_MODE_LCD_V,
FT_RENDER_MODE_SDF,
FT_RENDER_MODE_MAX,
}
[NativeTypeName("unsigned int")]
public enum FT_Kerning_Mode_ : uint
{
FT_KERNING_DEFAULT = 0,
FT_KERNING_UNFITTED,
FT_KERNING_UNSCALED,
}
public static unsafe partial class FT
{
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Init_FreeType", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Init_FreeType([NativeTypeName("FT_Library *")] FT_LibraryRec_** alibrary);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Done_FreeType", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Done_FreeType([NativeTypeName("FT_Library")] FT_LibraryRec_* library);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_New_Face", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int New_Face([NativeTypeName("FT_Library")] FT_LibraryRec_* library, [NativeTypeName("const char *")] sbyte* filepathname, [NativeTypeName("FT_Long")] long face_index, [NativeTypeName("FT_Face *")] FT_FaceRec_** aface);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_New_Memory_Face", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int New_Memory_Face([NativeTypeName("FT_Library")] FT_LibraryRec_* library, [NativeTypeName("const FT_Byte *")] byte* file_base, [NativeTypeName("FT_Long")] long file_size, [NativeTypeName("FT_Long")] long face_index, [NativeTypeName("FT_Face *")] FT_FaceRec_** aface);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Open_Face", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Open_Face([NativeTypeName("FT_Library")] FT_LibraryRec_* library, [NativeTypeName("const FT_Open_Args *")] FT_Open_Args_* args, [NativeTypeName("FT_Long")] long face_index, [NativeTypeName("FT_Face *")] FT_FaceRec_** aface);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Attach_File", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Attach_File([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("const char *")] sbyte* filepathname);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Attach_Stream", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Attach_Stream([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("const FT_Open_Args *")] FT_Open_Args_* parameters);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Reference_Face", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Reference_Face([NativeTypeName("FT_Face")] FT_FaceRec_* face);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Done_Face", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Done_Face([NativeTypeName("FT_Face")] FT_FaceRec_* face);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Select_Size", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Select_Size([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Int")] int strike_index);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Request_Size", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Request_Size([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Size_Request")] FT_Size_RequestRec_* req);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Set_Char_Size", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Set_Char_Size([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_F26Dot6")] int char_width, [NativeTypeName("FT_F26Dot6")] int char_height, [NativeTypeName("FT_UInt")] uint horz_resolution, [NativeTypeName("FT_UInt")] uint vert_resolution);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Set_Pixel_Sizes", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Set_Pixel_Sizes([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_UInt")] uint pixel_width, [NativeTypeName("FT_UInt")] uint pixel_height);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Load_Glyph", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Load_Glyph([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_UInt")] uint glyph_index, [NativeTypeName("FT_Int32")] int load_flags);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Load_Char", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Load_Char([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong char_code, [NativeTypeName("FT_Int32")] int load_flags);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Set_Transform", ExactSpelling = true)]
public static extern void Set_Transform([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Matrix *")] FT_Matrix_* matrix, [NativeTypeName("FT_Vector *")] FT_Vector_* delta);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Transform", ExactSpelling = true)]
public static extern void Get_Transform([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Matrix *")] FT_Matrix_* matrix, [NativeTypeName("FT_Vector *")] FT_Vector_* delta);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Render_Glyph", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Render_Glyph([NativeTypeName("FT_GlyphSlot")] FT_GlyphSlotRec_* slot, [NativeTypeName("FT_Render_Mode")] FT_Render_Mode_ render_mode);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Kerning", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Get_Kerning([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_UInt")] uint left_glyph, [NativeTypeName("FT_UInt")] uint right_glyph, [NativeTypeName("FT_UInt")] uint kern_mode, [NativeTypeName("FT_Vector *")] FT_Vector_* akerning);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Track_Kerning", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Get_Track_Kerning([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Fixed")] long point_size, [NativeTypeName("FT_Int")] int degree, [NativeTypeName("FT_Fixed *")] long* akerning);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Select_Charmap", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Select_Charmap([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Encoding")] FT_Encoding_ encoding);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Set_Charmap", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Set_Charmap([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_CharMap")] FT_CharMapRec_* charmap);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Charmap_Index", ExactSpelling = true)]
[return: NativeTypeName("FT_Int")]
public static extern int Get_Charmap_Index([NativeTypeName("FT_CharMap")] FT_CharMapRec_* charmap);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Char_Index", ExactSpelling = true)]
[return: NativeTypeName("FT_UInt")]
public static extern uint Get_Char_Index([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong charcode);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_First_Char", ExactSpelling = true)]
[return: NativeTypeName("FT_ULong")]
public static extern ulong Get_First_Char([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_UInt *")] uint* agindex);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Next_Char", ExactSpelling = true)]
[return: NativeTypeName("FT_ULong")]
public static extern ulong Get_Next_Char([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong char_code, [NativeTypeName("FT_UInt *")] uint* agindex);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_Properties", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Face_Properties([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_UInt")] uint num_properties, [NativeTypeName("FT_Parameter *")] FT_Parameter_* properties);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Name_Index", ExactSpelling = true)]
[return: NativeTypeName("FT_UInt")]
public static extern uint Get_Name_Index([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("const FT_String *")] byte* glyph_name);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Glyph_Name", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Get_Glyph_Name([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_UInt")] uint glyph_index, [NativeTypeName("FT_Pointer")] void* buffer, [NativeTypeName("FT_UInt")] uint buffer_max);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_Postscript_Name", ExactSpelling = true)]
[return: NativeTypeName("const char *")]
public static extern sbyte* Get_Postscript_Name([NativeTypeName("FT_Face")] FT_FaceRec_* face);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_SubGlyph_Info", ExactSpelling = true)]
[return: NativeTypeName("FT_Error")]
public static extern int Get_SubGlyph_Info([NativeTypeName("FT_GlyphSlot")] FT_GlyphSlotRec_* glyph, [NativeTypeName("FT_UInt")] uint sub_index, [NativeTypeName("FT_Int *")] int* p_index, [NativeTypeName("FT_UInt *")] uint* p_flags, [NativeTypeName("FT_Int *")] int* p_arg1, [NativeTypeName("FT_Int *")] int* p_arg2, [NativeTypeName("FT_Matrix *")] FT_Matrix_* p_transform);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Get_FSType_Flags", ExactSpelling = true)]
[return: NativeTypeName("FT_UShort")]
public static extern ushort Get_FSType_Flags([NativeTypeName("FT_Face")] FT_FaceRec_* face);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_GetCharVariantIndex", ExactSpelling = true)]
[return: NativeTypeName("FT_UInt")]
public static extern uint Face_GetCharVariantIndex([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong charcode, [NativeTypeName("FT_ULong")] ulong variantSelector);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_GetCharVariantIsDefault", ExactSpelling = true)]
[return: NativeTypeName("FT_Int")]
public static extern int Face_GetCharVariantIsDefault([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong charcode, [NativeTypeName("FT_ULong")] ulong variantSelector);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_GetVariantSelectors", ExactSpelling = true)]
[return: NativeTypeName("FT_UInt32 *")]
public static extern uint* Face_GetVariantSelectors([NativeTypeName("FT_Face")] FT_FaceRec_* face);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_GetVariantsOfChar", ExactSpelling = true)]
[return: NativeTypeName("FT_UInt32 *")]
public static extern uint* Face_GetVariantsOfChar([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong charcode);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_GetCharsOfVariant", ExactSpelling = true)]
[return: NativeTypeName("FT_UInt32 *")]
public static extern uint* Face_GetCharsOfVariant([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_ULong")] ulong variantSelector);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_MulDiv", ExactSpelling = true)]
[return: NativeTypeName("FT_Long")]
public static extern long MulDiv([NativeTypeName("FT_Long")] long a, [NativeTypeName("FT_Long")] long b, [NativeTypeName("FT_Long")] long c);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_MulFix", ExactSpelling = true)]
[return: NativeTypeName("FT_Long")]
public static extern long MulFix([NativeTypeName("FT_Long")] long a, [NativeTypeName("FT_Long")] long b);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_DivFix", ExactSpelling = true)]
[return: NativeTypeName("FT_Long")]
public static extern long DivFix([NativeTypeName("FT_Long")] long a, [NativeTypeName("FT_Long")] long b);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_RoundFix", ExactSpelling = true)]
[return: NativeTypeName("FT_Fixed")]
public static extern long RoundFix([NativeTypeName("FT_Fixed")] long a);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_CeilFix", ExactSpelling = true)]
[return: NativeTypeName("FT_Fixed")]
public static extern long CeilFix([NativeTypeName("FT_Fixed")] long a);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_FloorFix", ExactSpelling = true)]
[return: NativeTypeName("FT_Fixed")]
public static extern long FloorFix([NativeTypeName("FT_Fixed")] long a);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Vector_Transform", ExactSpelling = true)]
public static extern void Vector_Transform([NativeTypeName("FT_Vector *")] FT_Vector_* vector, [NativeTypeName("const FT_Matrix *")] FT_Matrix_* matrix);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Library_Version", ExactSpelling = true)]
public static extern void Library_Version([NativeTypeName("FT_Library")] FT_LibraryRec_* library, [NativeTypeName("FT_Int *")] int* amajor, [NativeTypeName("FT_Int *")] int* aminor, [NativeTypeName("FT_Int *")] int* apatch);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_CheckTrueTypePatents", ExactSpelling = true)]
[return: NativeTypeName("FT_Bool")]
public static extern byte Face_CheckTrueTypePatents([NativeTypeName("FT_Face")] FT_FaceRec_* face);
[DllImport("freetype", CallingConvention = CallingConvention.Cdecl, EntryPoint = "FT_Face_SetUnpatentedHinting", ExactSpelling = true)]
[return: NativeTypeName("FT_Bool")]
public static extern byte Face_SetUnpatentedHinting([NativeTypeName("FT_Face")] FT_FaceRec_* face, [NativeTypeName("FT_Bool")] byte value);
}
}

@ -0,0 +1,87 @@
using System;
namespace Quik.FreeType
{
public struct FT_BBox_
{
public long xMin, yMin;
public long xMax, yMax;
}
public struct FT_Generic_
{
public IntPtr Data;
public IntPtr Finalizer;
}
public struct FT_Matrix_
{
public long xx, xy;
public long yx, yy;
}
public struct FT_Vector_
{
public long x;
public long y;
}
public struct FT_MemoryRec_
{
public IntPtr User;
public IntPtr Alloc;
public IntPtr Free;
public IntPtr Realloc;
}
public struct FT_StreamRec_
{
public IntPtr Base;
public long Size;
public long Position;
public IntPtr Descriptor;
public IntPtr Read;
public IntPtr Close;
public IntPtr Memory;
public IntPtr Cursor;
public IntPtr Limit;
}
public struct FT_ListRec_
{
public IntPtr Head;
public IntPtr Tail;
}
public enum FT_Glyph_Format_
{
None = 0,
Composite = 1668246896,
Bitmap = 1651078259,
Outline = 1869968492,
Plotter = 1886154612,
Svg = 1398163232,
}
public struct FT_Bitmap_
{
public int rows;
public int width;
public int pitch;
public IntPtr Buffer;
public short NumGrays;
public byte pixel_mode;
public byte palette_mode;
public IntPtr Palette;
}
public struct FT_Outline_
{
public short n_contours;
public short n_points;
public IntPtr Points;
public IntPtr Tags;
public IntPtr Contours;
public int Flags;
}
}

@ -0,0 +1,12 @@
using System;
namespace Quik.FreeType
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.ReturnValue)]
public sealed class NativeTypeNameAttribute : Attribute
{
public NativeTypeNameAttribute(string name)
{
}
}
}

@ -0,0 +1,35 @@
-x
c
-l
freetype
--config
compatible-codegen
single-file
exclude-fnptr-codegen
generate-aggressive-inlining
generate-setslastsystemerror-attribute
unix-types
--include-directory
../lib/freetype/include
--include-directory
.
--include-directory
/usr/lib/llvm-14/lib/clang/14.0.6/include
--file
../lib/freetype/include/freetype/freetype.h
--methodClassName
FT
--namespace
Quik.FreeType
--output
FreeType.cs
--prefixStrip
FT_
--remap
FT_Pos=long
FT_String=byte
FT_Long=long
FT_Fixed=long
FT_ULong=ulong
long=long
FT_F26Dot6=int

1
Quik.FreeType/headers.h Normal file

@ -0,0 +1 @@
#include "freetype/freetype.h"

@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.Stb.Tests", "tests\Qui
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuikDemo", "tests\QuikDemo\QuikDemo.csproj", "{79CBF97F-4884-4692-94FB-75DDEB61E26F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuikDemo", "tests\QuikDemo\QuikDemo.csproj", "{79CBF97F-4884-4692-94FB-75DDEB61E26F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Quik.Freetype", "Quik.FreeType\Quik.Freetype.csproj", "{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -111,6 +113,18 @@ Global
{79CBF97F-4884-4692-94FB-75DDEB61E26F}.Release|x64.Build.0 = Release|Any CPU {79CBF97F-4884-4692-94FB-75DDEB61E26F}.Release|x64.Build.0 = Release|Any CPU
{79CBF97F-4884-4692-94FB-75DDEB61E26F}.Release|x86.ActiveCfg = Release|Any CPU {79CBF97F-4884-4692-94FB-75DDEB61E26F}.Release|x86.ActiveCfg = Release|Any CPU
{79CBF97F-4884-4692-94FB-75DDEB61E26F}.Release|x86.Build.0 = Release|Any CPU {79CBF97F-4884-4692-94FB-75DDEB61E26F}.Release|x86.Build.0 = Release|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Debug|x64.ActiveCfg = Debug|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Debug|x64.Build.0 = Debug|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Debug|x86.ActiveCfg = Debug|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Debug|x86.Build.0 = Debug|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Release|Any CPU.Build.0 = Release|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Release|x64.ActiveCfg = Release|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Release|x64.Build.0 = Release|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Release|x86.ActiveCfg = Release|Any CPU
{2C347CB2-C50C-49B2-AAA4-70FE0ED6461B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{BC7D3002-B79B-4141-B6CC-74FB2175B474} = {AE05ADE5-A809-479F-97D5-BEAFE7604285} {BC7D3002-B79B-4141-B6CC-74FB2175B474} = {AE05ADE5-A809-479F-97D5-BEAFE7604285}

@ -1 +1 @@
Subproject commit 1ecfd2199012edb403605c7f68618a761eaf1193 Subproject commit 86bc8a95056c97a810986434a3f268cbe67f2902