fontvariationsettings.odin (3816B)
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 variation settings [C API]. 19 FontVariationSettingsCore :: struct { 20 _d: ObjectDetail, 21 } 22 23 //! \cond INTERNAL 24 //! Font variation settings [C API Impl]. 25 //! 26 //! \note This Impl's layout is fully compatible with \ref BLArrayImpl. 27 FontVariationSettingsImpl :: struct { 28 //! Pointer to variation items. 29 data: ^FontVariationItem, 30 31 //! Number of variation items in `data`. 32 size: c.size_t, 33 34 //! Capacity of `data`. 35 capacity: c.size_t, 36 } 37 38 @(default_calling_convention="c", link_prefix="bl_") 39 foreign lib { 40 //! \endcond 41 font_variation_settings_init :: proc(self: ^FontVariationSettingsCore) -> Result --- 42 font_variation_settings_init_move :: proc(self: ^FontVariationSettingsCore, other: ^FontVariationSettingsCore) -> Result --- 43 font_variation_settings_init_weak :: proc(self: ^FontVariationSettingsCore, other: ^FontVariationSettingsCore) -> Result --- 44 font_variation_settings_destroy :: proc(self: ^FontVariationSettingsCore) -> Result --- 45 font_variation_settings_reset :: proc(self: ^FontVariationSettingsCore) -> Result --- 46 font_variation_settings_clear :: proc(self: ^FontVariationSettingsCore) -> Result --- 47 font_variation_settings_shrink :: proc(self: ^FontVariationSettingsCore) -> Result --- 48 font_variation_settings_assign_move :: proc(self: ^FontVariationSettingsCore, other: ^FontVariationSettingsCore) -> Result --- 49 font_variation_settings_assign_weak :: proc(self: ^FontVariationSettingsCore, other: ^FontVariationSettingsCore) -> Result --- 50 font_variation_settings_get_size :: proc(self: ^FontVariationSettingsCore) -> c.size_t --- 51 font_variation_settings_get_capacity :: proc(self: ^FontVariationSettingsCore) -> c.size_t --- 52 font_variation_settings_get_view :: proc(self: ^FontVariationSettingsCore, out: ^FontVariationSettingsView) -> Result --- 53 font_variation_settings_has_value :: proc(self: ^FontVariationSettingsCore, variation_tag: Tag) -> i32 --- 54 font_variation_settings_get_value :: proc(self: ^FontVariationSettingsCore, variation_tag: Tag) -> f32 --- 55 font_variation_settings_set_value :: proc(self: ^FontVariationSettingsCore, variation_tag: Tag, value: f32) -> Result --- 56 font_variation_settings_remove_value :: proc(self: ^FontVariationSettingsCore, variation_tag: Tag) -> Result --- 57 font_variation_settings_equals :: proc(a: ^FontVariationSettingsCore, b: ^FontVariationSettingsCore) -> i32 --- 58 } 59 60 //! Associates a font variation tag with a value. 61 FontVariationItem :: struct { 62 //! \name Members 63 //! \{ 64 65 //! Variation tag (32-bit). 66 tag: Tag, 67 68 //! Variation value. 69 //! 70 //! \note values outside of [0, 1] range are invalid. 71 value: f32, 72 } 73 74 //! A view unifying the representation of an internal storage used by \ref BLFontVariationSettings. 75 FontVariationSettingsView :: struct { 76 //! Pointer to font variation items, where each item describes a variation tag and its value. 77 //! 78 //! \note If the container is in SSO mode the `data` member will point to `sso_data`. 79 data: ^FontVariationItem, 80 81 //! Count of items in `data. 82 size: c.size_t, 83 84 //! Unpacked SSO items into \ref BLFontVariationItem array. 85 //! 86 //! \note This member won't be initialized or zeroed in case \ref BLFontVariationSettings is not in 87 //! SSO mode. And if the container is in SSO mode only the number of items used will be overwritten 88 //! by \ref BLFontVariationSettings::get_view(). 89 sso_data: [3]FontVariationItem, 90 } 91