Skip to content

Commit 0ac55cd

Browse files
update api.json with new text line API
1 parent de53322 commit 0ac55cd

File tree

2 files changed

+115
-237
lines changed

2 files changed

+115
-237
lines changed

src/api.json

Lines changed: 90 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -8311,51 +8311,38 @@
83118311
},
83128312
{
83138313
"kind": "typename",
8314-
"name": "oc_text_shape_settings",
8315-
"doc": "Settings used with `oc_text_shape()`.",
8314+
"name": "oc_text_attributes",
8315+
"doc": "A struct describing graphical attributes to apply to a range of text.",
83168316
"type": {
83178317
"kind": "struct",
83188318
"fields": [
83198319
{
8320-
"name": "script",
8321-
"doc": [
8322-
"An ISO 15924 script tag specifying the script of the text being shaped. ",
8323-
"An empty string indicates that `oc_text_shape()` should try to guess the input text's script."
8324-
],
8320+
"name": "font",
83258321
"type": {
83268322
"kind": "namedType",
8327-
"name": "oc_str8"
8323+
"name": "oc_font"
83288324
}
83298325
},
83308326
{
8331-
"name": "lang",
8332-
"doc": [
8333-
"An BCP 47 language tag specifying the language of the text being shaped. ",
8334-
"An empty string indicates that `oc_text_shape()` should try to guess the input text's language."
8335-
],
8327+
"name": "fontSize",
83368328
"type": {
8337-
"kind": "namedType",
8338-
"name": "oc_str8"
8329+
"kind": "f32"
83398330
}
83408331
},
83418332
{
8342-
"name": "direction",
8343-
"doc": [
8344-
"The direction of the text being shaped. ",
8345-
"`OC_TEXT_DIRECTION_UNKNOWN` indicates that `oc_text_shape()` should use the default direction for the text's script."
8346-
],
8333+
"name": "color",
83478334
"type": {
83488335
"kind": "namedType",
8349-
"name": "oc_text_direction"
8336+
"name": "oc_color"
83508337
}
83518338
}
83528339
]
83538340
}
83548341
},
83558342
{
83568343
"kind": "typename",
8357-
"name": "oc_glyph_run",
8358-
"doc": "An opaque struct representing a shaped glyph run.",
8344+
"name": "oc_text_line",
8345+
"doc": "An opaque struct representing a line of shaped glyphs.",
83598346
"type": {
83608347
"kind": "struct"
83618348
}
@@ -10234,19 +10221,14 @@
1023410221
},
1023510222
{
1023610223
"kind": "proc",
10237-
"name": "oc_text_shape",
10238-
"doc": [
10239-
"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.",
10240-
"",
10241-
"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."
10242-
],
10243-
10224+
"name": "oc_text_line_from_utf32",
10225+
"doc": "Shapes a line of unicode codepoints. The line can the be used to draw the shaped glyphs, measure portions of the shaped text, or compute caret positions.",
1024410226
"return": {
10245-
"doc": "The shaped glyph run, allocated on the given `arena`.",
10227+
"doc": "The shaped line of text, allocated on the given `arena`.",
1024610228
"kind": "pointer",
1024710229
"type": {
1024810230
"kind": "namedType",
10249-
"name": "oc_glyph_run"
10231+
"name": "oc_text_line"
1025010232
}
1025110233
},
1025210234
"params": [
@@ -10262,74 +10244,91 @@
1026210244
}
1026310245
},
1026410246
{
10265-
"name": "font",
10266-
"doc": "The font to use for shaping.",
10247+
"name": "codepoints",
10248+
"doc": "The string of unicode codepoints to shape.",
1026710249
"type": {
1026810250
"kind": "namedType",
10269-
"name": "oc_font"
10251+
"name": "oc_str32"
1027010252
}
1027110253
},
1027210254
{
10273-
"name": "settings",
10274-
"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.",
10255+
"name": "attributes",
10256+
"doc": "The text attributes to use when shaping the text.",
1027510257
"type": {
1027610258
"kind": "pointer",
1027710259
"type": {
1027810260
"kind": "namedType",
10279-
"name": "oc_text_shape_settings"
10261+
"name": "oc_text_attributes"
1028010262
}
1028110263
}
10282-
},
10264+
}
10265+
]
10266+
},
10267+
{
10268+
"kind": "proc",
10269+
"name": "oc_text_line_from_utf8",
10270+
"doc": "Shapes a line of utf8 encoded text. This is a wrapper around `oc_text_line_from_utf32()`",
10271+
"return": {
10272+
"doc": "The shaped line of text, allocated on the given `arena`.",
10273+
"kind": "pointer",
10274+
"type": {
10275+
"kind": "namedType",
10276+
"name": "oc_text_line"
10277+
}
10278+
},
10279+
"params": [
1028310280
{
10284-
"name": "codepoints",
10285-
"doc": "The full string of unicode codepoints that the shaper may look at for shaping.",
10281+
"name": "arena",
10282+
"doc": "An arena on which to allocate all data for the resulting shaped run.",
1028610283
"type": {
10287-
"kind": "namedType",
10288-
"name": "oc_str32"
10284+
"kind": "pointer",
10285+
"type": {
10286+
"kind": "namedType",
10287+
"name": "oc_arena"
10288+
}
1028910289
}
1029010290
},
1029110291
{
10292-
"name": "begin",
10293-
"doc": "The begining index (inclusive) of the sub-segment of `codepoints` that should be shaped.",
10292+
"name": "string",
10293+
"doc": "The string of utf8 encoded text to shape.",
1029410294
"type": {
10295-
"kind": "u64"
10295+
"kind": "namedType",
10296+
"name": "oc_str8"
1029610297
}
1029710298
},
1029810299
{
10299-
"name": "end",
10300-
"doc": "The end index (exclusive) of the sub-segment of `codepoints` that should be shaped.",
10300+
"name": "attributes",
10301+
"doc": "The text attributes to use when shaping the text.",
1030110302
"type": {
10302-
"kind": "u64"
10303+
"kind": "pointer",
10304+
"type": {
10305+
"kind": "namedType",
10306+
"name": "oc_text_attributes"
10307+
}
1030310308
}
1030410309
}
1030510310
]
1030610311
},
1030710312
{
1030810313
"kind": "proc",
10309-
"name": "oc_glyph_run_point_to_cursor",
10310-
"doc": "Converts a geometric position in a glyph run to a codepoint index.",
10314+
"name": "oc_text_line_codepoint_index_for_position",
10315+
"doc": "Converts a geometric position in a text line to a codepoint index.",
1031110316
"return": {
1031210317
"kind": "u64"
1031310318
},
1031410319
"params": [
1031510320
{
10316-
"name": "run",
10321+
"name": "line",
1031710322
"type": {
1031810323
"kind": "pointer",
1031910324
"type": {
1032010325
"kind": "namedType",
10321-
"name": "oc_glyph_run"
10326+
"name": "oc_text_line"
1032210327
}
1032310328
}
1032410329
},
1032510330
{
10326-
"name": "fontSize",
10327-
"type": {
10328-
"kind": "f32"
10329-
}
10330-
},
10331-
{
10332-
"name": "point",
10331+
"name": "position",
1033310332
"type": {
1033410333
"kind": "namedType",
1033510334
"name": "oc_vec2"
@@ -10340,31 +10339,25 @@
1034010339
},
1034110340
{
1034210341
"kind": "proc",
10343-
"name": "oc_glyph_run_cursor_to_point",
10344-
"doc": "Converts a codepoint index to a geometric position in the shaped glyph run.",
10342+
"name": "oc_text_line_position_for_codepoint_index",
10343+
"doc": "Converts a codepoint index to a geometric position in a shaped line of text.",
1034510344
"return": {
1034610345
"kind": "namedType",
1034710346
"name": "oc_vec2"
1034810347
},
1034910348
"params": [
1035010349
{
10351-
"name": "run",
10350+
"name": "line",
1035210351
"type": {
1035310352
"kind": "pointer",
1035410353
"type": {
1035510354
"kind": "namedType",
10356-
"name": "oc_glyph_run"
10355+
"name": "oc_text_line"
1035710356
}
1035810357
}
1035910358
},
1036010359
{
10361-
"name": "fontSize",
10362-
"type": {
10363-
"kind": "f32"
10364-
}
10365-
},
10366-
{
10367-
"name": "cursor",
10360+
"name": "index",
1036810361
"type": {
1036910362
"kind": "u64"
1037010363
}
@@ -10373,27 +10366,42 @@
1037310366
},
1037410367
{
1037510368
"kind": "proc",
10376-
"name": "oc_glyph_run_range_metrics",
10377-
"doc": "Computes text metrics for a sub-range of a glyph run.",
10369+
"name": "oc_text_line_get_metrics",
10370+
"doc": "Returns the metrics of a line of text.",
1037810371
"return": {
1037910372
"kind": "namedType",
1038010373
"name": "oc_text_metrics"
1038110374
},
1038210375
"params": [
1038310376
{
10384-
"name": "run",
10377+
"name": "line",
1038510378
"type": {
1038610379
"kind": "pointer",
1038710380
"type": {
1038810381
"kind": "namedType",
10389-
"name": "oc_glyph_run"
10382+
"name": "oc_text_line"
1039010383
}
1039110384
}
10392-
},
10385+
}
10386+
]
10387+
},
10388+
{
10389+
"kind": "proc",
10390+
"name": "oc_text_line_get_metrics_for_range",
10391+
"doc": "Computes text metrics for a sub-range of a line of text.",
10392+
"return": {
10393+
"kind": "namedType",
10394+
"name": "oc_text_metrics"
10395+
},
10396+
"params": [
1039310397
{
10394-
"name": "fontSize",
10398+
"name": "line",
1039510399
"type": {
10396-
"kind": "f32"
10400+
"kind": "pointer",
10401+
"type": {
10402+
"kind": "namedType",
10403+
"name": "oc_text_line"
10404+
}
1039710405
}
1039810406
},
1039910407
{
@@ -10412,27 +10420,21 @@
1041210420
},
1041310421
{
1041410422
"kind": "proc",
10415-
"name": "oc_text_draw_run",
10416-
"doc": "Draws a shaped glyph run at a given size, starting at the current position.",
10423+
"name": "oc_text_line_draw",
10424+
"doc": "Draws a shaped line of text, starting at the current position.",
1041710425
"return": {
1041810426
"kind": "void"
1041910427
},
1042010428
"params": [
1042110429
{
10422-
"name": "run",
10430+
"name": "line",
1042310431
"type": {
1042410432
"kind": "pointer",
1042510433
"type": {
1042610434
"kind": "namedType",
10427-
"name": "oc_glyph_run"
10435+
"name": "oc_text_line"
1042810436
}
1042910437
}
10430-
},
10431-
{
10432-
"name": "fontSize",
10433-
"type": {
10434-
"kind": "f32"
10435-
}
1043610438
}
1043710439
]
1043810440
},

0 commit comments

Comments
 (0)