Skip to content

Commit

Permalink
add some docstrings to new text API
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfouilleul committed Oct 31, 2024
1 parent d6ccae0 commit 0b9f526
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -10287,7 +10287,14 @@
{
"kind": "proc",
"name": "oc_text_shape",
"doc": [
"Shapes a segment of unicode codepoints and returns a shaped glyph run. The glyph run can the be used to draw the glyphs, measure portions of the shaped text, or compute caret positions.",
"",
"The segment being shaped is comprised between `begin` (inclusive) and `end` (exclusive), but the shaper may look at codepoints before and after those bounds if available. This means that if you want to shape a subset of a bigger text, giving `oc_text_shape` the full text and setting `begin` and `end` appropriately may give better results than passing only the subset you want to shape."
],

"return": {
"doc": "The shaped glyph run, allocated on the given `arena`.",
"kind": "pointer",
"type": {
"kind": "namedType",
Expand All @@ -10297,6 +10304,7 @@
"params": [
{
"name": "arena",
"doc": "An arena on which to allocate all data for the resulting shaped run.",
"type": {
"kind": "pointer",
"type": {
Expand All @@ -10307,13 +10315,15 @@
},
{
"name": "font",
"doc": "The font to use for shaping.",
"type": {
"kind": "namedType",
"name": "oc_font"
}
},
{
"name": "settings",
"doc": "Settings to use for shaping the text. If some fields of the struct are set to zero, the shaper will try to guess their values from the input codepoints. You can also pass `null` to guess all settings.",
"type": {
"kind": "pointer",
"type": {
Expand All @@ -10324,19 +10334,22 @@
},
{
"name": "codepoints",
"doc": "The full string of unicode codepoints that the shaper may look at for shaping.",
"type": {
"kind": "namedType",
"name": "oc_str32"
}
},
{
"name": "begin",
"doc": "The begining index (inclusive) of the sub-segment of `codepoints` that should be shaped.",
"type": {
"kind": "u64"
}
},
{
"name": "end",
"doc": "The end index (exclusive) of the sub-segment of `codepoints` that should be shaped.",
"type": {
"kind": "u64"
}
Expand All @@ -10346,6 +10359,7 @@
{
"kind": "proc",
"name": "oc_glyph_run_point_to_cursor",
"doc": "Converts a geometric position in a glyph run to a codepoint index.",
"return": {
"kind": "u64"
},
Expand Down Expand Up @@ -10379,6 +10393,7 @@
{
"kind": "proc",
"name": "oc_glyph_run_cursor_to_point",
"doc": "Converts a codepoint index to a geometric position in the shaped glyph run.",
"return": {
"kind": "namedType",
"name": "oc_vec2"
Expand Down Expand Up @@ -10411,6 +10426,7 @@
{
"kind": "proc",
"name": "oc_glyph_run_range_metrics",
"doc": "Computes text metrics for a sub-range of a glyph run.",
"return": {
"kind": "namedType",
"name": "oc_text_metrics"
Expand Down Expand Up @@ -10449,6 +10465,7 @@
{
"kind": "proc",
"name": "oc_text_draw_run",
"doc": "Draws a shaped glyph run at a given size, starting at the current position.",
"return": {
"kind": "void"
},
Expand All @@ -10474,6 +10491,7 @@
{
"kind": "proc",
"name": "oc_text_draw_utf8",
"doc": "Helper to draw a UTF8 encoded string at the current position.",
"return": {
"kind": "void"
},
Expand Down Expand Up @@ -10503,6 +10521,7 @@
{
"kind": "proc",
"name": "oc_text_draw_utf32",
"doc": "Helper to draw a string of unicode codepoints at the current position.",
"return": {
"kind": "void"
},
Expand Down

0 comments on commit 0b9f526

Please sign in to comment.