font.odin (4776B)
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 //! Font [C API]. 19 FontCore :: struct { 20 _d: ObjectDetail, 21 } 22 23 //! \cond INTERNAL 24 //! Font [C API Impl]. 25 FontImpl :: struct { 26 //! Font face used by this font. 27 face: FontFaceCore, 28 29 //! Font width (1..1000) [0 if the font is not initialized]. 30 weight: u16, 31 32 //! Font stretch (1..9) [0 if the font is not initialized]. 33 stretch: u8, 34 35 //! Font style. 36 style: u8, 37 38 //! Reserved for future use. 39 reserved: u32, 40 41 //! Font metrics. 42 metrics: FontMetrics, 43 44 //! Font matrix. 45 _matrix: FontMatrix, 46 47 //! Assigned font features (key/value pairs). 48 feature_settings: FontFeatureSettingsCore, 49 50 //! Assigned font variations (key/value pairs). 51 variation_settings: FontVariationSettingsCore, 52 } 53 54 @(default_calling_convention="c", link_prefix="bl_") 55 foreign lib { 56 //! \endcond 57 font_init :: proc(self: ^FontCore) -> Result --- 58 font_init_move :: proc(self: ^FontCore, other: ^FontCore) -> Result --- 59 font_init_weak :: proc(self: ^FontCore, other: ^FontCore) -> Result --- 60 font_destroy :: proc(self: ^FontCore) -> Result --- 61 font_reset :: proc(self: ^FontCore) -> Result --- 62 font_assign_move :: proc(self: ^FontCore, other: ^FontCore) -> Result --- 63 font_assign_weak :: proc(self: ^FontCore, other: ^FontCore) -> Result --- 64 font_equals :: proc(a: ^FontCore, b: ^FontCore) -> i32 --- 65 font_create_from_face :: proc(self: ^FontCore, face: ^FontFaceCore, size: f32) -> Result --- 66 font_create_from_face_with_settings :: proc(self: ^FontCore, face: ^FontFaceCore, size: f32, feature_settings: ^FontFeatureSettingsCore, variation_settings: ^FontVariationSettingsCore) -> Result --- 67 font_get_face :: proc(self: ^FontCore, out: ^FontFaceCore) -> Result --- 68 font_get_size :: proc(self: ^FontCore) -> f32 --- 69 font_set_size :: proc(self: ^FontCore, size: f32) -> Result --- 70 font_get_metrics :: proc(self: ^FontCore, out: ^FontMetrics) -> Result --- 71 font_get_matrix :: proc(self: ^FontCore, out: ^FontMatrix) -> Result --- 72 font_get_design_metrics :: proc(self: ^FontCore, out: ^FontDesignMetrics) -> Result --- 73 font_get_feature_settings :: proc(self: ^FontCore, out: ^FontFeatureSettingsCore) -> Result --- 74 font_set_feature_settings :: proc(self: ^FontCore, feature_settings: ^FontFeatureSettingsCore) -> Result --- 75 font_reset_feature_settings :: proc(self: ^FontCore) -> Result --- 76 font_get_variation_settings :: proc(self: ^FontCore, out: ^FontVariationSettingsCore) -> Result --- 77 font_set_variation_settings :: proc(self: ^FontCore, variation_settings: ^FontVariationSettingsCore) -> Result --- 78 font_reset_variation_settings :: proc(self: ^FontCore) -> Result --- 79 font_shape :: proc(self: ^FontCore, gb: ^GlyphBufferCore) -> Result --- 80 font_map_text_to_glyphs :: proc(self: ^FontCore, gb: ^GlyphBufferCore, state_out: ^GlyphMappingState) -> Result --- 81 font_position_glyphs :: proc(self: ^FontCore, gb: ^GlyphBufferCore) -> Result --- 82 font_apply_kerning :: proc(self: ^FontCore, gb: ^GlyphBufferCore) -> Result --- 83 font_apply_gsub :: proc(self: ^FontCore, gb: ^GlyphBufferCore, lookups: ^BitArrayCore) -> Result --- 84 font_apply_gpos :: proc(self: ^FontCore, gb: ^GlyphBufferCore, lookups: ^BitArrayCore) -> Result --- 85 font_get_text_metrics :: proc(self: ^FontCore, gb: ^GlyphBufferCore, out: ^TextMetrics) -> Result --- 86 font_get_glyph_bounds :: proc(self: ^FontCore, glyph_data: ^u32, glyph_advance: c.intptr_t, out: ^BoxI, count: c.size_t) -> Result --- 87 font_get_glyph_advances :: proc(self: ^FontCore, glyph_data: ^u32, glyph_advance: c.intptr_t, out: ^GlyphPlacement, count: c.size_t) -> Result --- 88 font_get_glyph_outlines :: proc(self: ^FontCore, glyph_id: GlyphId, user_transform: ^Matrix2D, out: ^PathCore, sink: PathSinkFunc, user_data: rawptr) -> Result --- 89 font_get_glyph_run_outlines :: proc(self: ^FontCore, glyph_run: ^GlyphRun, user_transform: ^Matrix2D, out: ^PathCore, sink: PathSinkFunc, user_data: rawptr) -> Result --- 90 } 91