Skip to content

Commit 4ded261

Browse files
committed
Added new functions for text shaping to API, update TextInput cursor
1 parent 907ad5b commit 4ded261

File tree

14 files changed

+828
-86
lines changed

14 files changed

+828
-86
lines changed

api.json

+65
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,14 @@
12141214
"returns": {"type": "OptionFontRef"},
12151215
"fn_body": "callbackinfo.get_font_ref(node_id).into()"
12161216
},
1217+
"get_text_layout_options": {
1218+
"fn_args": [
1219+
{"self": "ref"},
1220+
{"node_id": "DomNodeId"}
1221+
],
1222+
"returns": {"type": "OptionResolvedTextLayoutOptions"},
1223+
"fn_body": "callbackinfo.get_text_layout_options(node_id).into()"
1224+
},
12171225
"shape_text": {
12181226
"doc": "Similar to `get_inline_text()`: If the node is a `Text` node, shape the `text` string with the same parameters as the current text and return the calculated InlineTextLayout. Necessary to calculate text cursor offsets and to detect when a line overflows content.",
12191227
"fn_args": [
@@ -1668,6 +1676,19 @@
16681676
{"css_path": {"type": "CssPath"}}
16691677
]
16701678
},
1679+
"ResolvedTextLayoutOptions": {
1680+
"external": "azul_impl::ui_solver::ResolvedTextLayoutOptions",
1681+
"struct_fields": [
1682+
{"font_size_px": {"type": "f32"}},
1683+
{"line_height": {"type": "OptionF32"}},
1684+
{"letter_spacing": {"type": "OptionF32"}},
1685+
{"word_spacing": {"type": "OptionF32"}},
1686+
{"tab_width": {"type": "OptionF32"}},
1687+
{"max_horizontal_width": {"type": "OptionF32"}},
1688+
{"leading": {"type": "OptionF32"}},
1689+
{"holes": {"type": "LogicalRectVec"}}
1690+
]
1691+
},
16711692
"Animation": {
16721693
"doc": "Animation struct to start a new animation",
16731694
"external": "azul_impl::callbacks::Animation",
@@ -10705,6 +10726,16 @@
1070510726
],
1070610727
"returns": {"type": "FontMetrics"},
1070710728
"fn_body": "azul_impl::text_layout::get_font_metrics_fontref(fontref)"
10729+
},
10730+
"shape_text": {
10731+
"doc": "Returns the text layout of the shaped text",
10732+
"fn_args": [
10733+
{"self": "ref"},
10734+
{"text": "Refstr"},
10735+
{"options": "ResolvedTextLayoutOptions"}
10736+
],
10737+
"returns": {"type": "InlineText"},
10738+
"fn_body": "azul_impl::text_layout::shape_text(fontref, text.as_str(), &options)"
1070810739
}
1070910740
}
1071010741
}
@@ -12014,6 +12045,17 @@
1201412045
"vec": {
1201512046
"doc": "Definition of azuls internal `Vec<*>` wrappers",
1201612047
"classes": {
12048+
"LogicalRectVec": {
12049+
"doc": "Wrapper over a Rust-allocated `Vec<LogicalRect>`",
12050+
"custom_destructor": true,
12051+
"external": "azul_core::window::LogicalRectVec",
12052+
"struct_fields": [
12053+
{ "ptr": { "type": "*const LogicalRect" } },
12054+
{ "len": { "type": "usize" } },
12055+
{ "cap": { "type": "usize" } },
12056+
{ "destructor": { "type": "LogicalRectVecDestructor" } }
12057+
]
12058+
},
1201712059
"NodeTypeIdInfoMapVec": {
1201812060
"doc": "Wrapper over a Rust-allocated `Vec<NodeTypeIdInfoMap>`",
1201912061
"custom_destructor": true,
@@ -12743,6 +12785,22 @@
1274312785
]
1274412786
}
1274512787
},
12788+
"LogicalRectVecDestructor": {
12789+
"external": "azul_core::window::LogicalRectVecDestructor",
12790+
"derive": ["Copy"],
12791+
"enum_fields": [
12792+
{"DefaultRust": {}},
12793+
{"NoDestructor": {}},
12794+
{"External": {"type": "LogicalRectVecDestructorType"}}
12795+
]
12796+
},
12797+
"LogicalRectVecDestructorType": {
12798+
"callback_typedef": {
12799+
"fn_args": [
12800+
{"type": "LogicalRectVec", "ref": "refmut"}
12801+
]
12802+
}
12803+
},
1274612804
"NodeTypeIdInfoMapVecDestructor": {
1274712805
"external": "crate::widgets::node_graph::NodeTypeIdInfoMapVecDestructor",
1274812806
"derive": ["Copy"],
@@ -13724,6 +13782,13 @@
1372413782
"option": {
1372513783
"doc": "Definition of azuls internal `Option<*>` wrappers",
1372613784
"classes": {
13785+
"OptionResolvedTextLayoutOptions": {
13786+
"external": "azul_impl::ui_solver::OptionResolvedTextLayoutOptions",
13787+
"enum_fields": [
13788+
{"None": {}},
13789+
{"Some": {"type": "ResolvedTextLayoutOptions"}}
13790+
]
13791+
},
1372713792
"OptionNodeGraphOnNodeAdded": {
1372813793
"external": "crate::widgets::node_graph::OptionOnNodeAdded",
1372913794
"enum_fields": [

api/_patches/azul.rs/vec.rs

+3
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@
322322
impl_vec_clone!(AzOutputConnection, AzOutputConnectionVec, AzOutputConnectionVecDestructor);
323323
impl_vec!(AzInputNodeAndIndex, AzInputNodeAndIndexVec, AzInputNodeAndIndexVecDestructor, az_input_node_and_index_vec_destructor, AzInputNodeAndIndexVec_delete);
324324
impl_vec_clone!(AzInputNodeAndIndex, AzInputNodeAndIndexVec, AzInputNodeAndIndexVecDestructor);
325+
impl_vec!(AzLogicalRect, AzLogicalRectVec, AzLogicalRectVecDestructor, az_logical_rect_vec_destructor, AzLogicalRectVec_delete);
326+
impl_vec_clone!(AzLogicalRect, AzLogicalRectVec, AzLogicalRectVecDestructor);
327+
325328

326329
impl_vec!(AzAccessibilityState, AzAccessibilityStateVec, AzAccessibilityStateVecDestructor, az_accessibility_state_vec_destructor, AzAccessibilityStateVec_delete);
327330
impl_vec_clone!(AzAccessibilityState, AzAccessibilityStateVec, AzAccessibilityStateVecDestructor);

0 commit comments

Comments
 (0)