fontdata.odin (3283B)
1 // This file is part of Blend2D project <https://blend2d.com> 2 // 3 // See blend2d.h or LICENSE.md for license and copyright information 4 // SPDX-License-Identifier: Zlib 5 package blend2d 6 7 import "core:c" 8 9 when ODIN_OS == .Windows { 10 foreign import lib "blend2d.lib" 11 } else when ODIN_OS == .Darwin { 12 foreign import lib "libblend2d.a" 13 } else when ODIN_OS == .Linux { 14 foreign import lib "libblend2d.a" 15 } 16 17 18 //! Flags used by \ref BLFontData (or \ref BLFontDataCore). 19 FontDataFlags :: enum u32 { 20 //! No flags. 21 NO_FLAGS = 0, 22 23 //!< Font data references a font-collection. 24 FLAG_COLLECTION = 1, 25 FLAG_FORCE_UINT = 4294967295, 26 } 27 28 //! A read only data that represents a font table or its sub-table. 29 FontTable :: struct { 30 //! \name Members 31 //! \{ 32 33 //! Pointer to the beginning of the data interpreted as `uint8_t*`. 34 data: ^u8, 35 36 //! Size of `data` in bytes. 37 size: c.size_t, 38 } 39 40 //! Font data [C API]. 41 FontDataCore :: struct { 42 _d: ObjectDetail, 43 } 44 45 //! \cond INTERNAL 46 //! Font data [C API Virtual Function Table]. 47 FontDataVirt :: struct { 48 base: ObjectVirtBase, 49 get_table_tags: proc "c" (impl: ^FontDataImpl, face_index: u32, out: ^ArrayCore) -> Result, 50 get_tables: proc "c" (impl: ^FontDataImpl, face_index: u32, dst: ^FontTable, tags: ^Tag, n: c.size_t) -> c.size_t, 51 } 52 53 //! Font data [C API Impl]. 54 FontDataImpl :: struct { 55 //! Virtual function table. 56 virt: ^FontDataVirt, 57 58 //! Type of the face that would be created with this font data. 59 face_type: u8, 60 61 //! Number of font faces stored in this font data instance. 62 face_count: u32, 63 64 //! Font data flags. 65 flags: u32, 66 } 67 68 @(default_calling_convention="c", link_prefix="bl_") 69 foreign lib { 70 //! \endcond 71 font_data_init :: proc(self: ^FontDataCore) -> Result --- 72 font_data_init_move :: proc(self: ^FontDataCore, other: ^FontDataCore) -> Result --- 73 font_data_init_weak :: proc(self: ^FontDataCore, other: ^FontDataCore) -> Result --- 74 font_data_destroy :: proc(self: ^FontDataCore) -> Result --- 75 font_data_reset :: proc(self: ^FontDataCore) -> Result --- 76 font_data_assign_move :: proc(self: ^FontDataCore, other: ^FontDataCore) -> Result --- 77 font_data_assign_weak :: proc(self: ^FontDataCore, other: ^FontDataCore) -> Result --- 78 font_data_create_from_file :: proc(self: ^FontDataCore, file_name: cstring, read_flags: FileReadFlags) -> Result --- 79 font_data_create_from_data_array :: proc(self: ^FontDataCore, data_array: ^ArrayCore) -> Result --- 80 font_data_create_from_data :: proc(self: ^FontDataCore, data: rawptr, data_size: c.size_t, destroy_func: DestroyExternalDataFunc, user_data: rawptr) -> Result --- 81 font_data_equals :: proc(a: ^FontDataCore, b: ^FontDataCore) -> i32 --- 82 font_data_get_face_count :: proc(self: ^FontDataCore) -> u32 --- 83 font_data_get_face_type :: proc(self: ^FontDataCore) -> FontFaceType --- 84 font_data_get_flags :: proc(self: ^FontDataCore) -> FontDataFlags --- 85 font_data_get_table_tags :: proc(self: ^FontDataCore, face_index: u32, dst: ^ArrayCore) -> Result --- 86 font_data_get_tables :: proc(self: ^FontDataCore, face_index: u32, dst: ^FontTable, tags: ^Tag, count: c.size_t) -> c.size_t --- 87 } 88