You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I integrated harfbuzz into orca to handle glyph shaping (see #81). This allows shaping unicode strings to glyph runs that can then be used for measuring and rendering text.
Now glyph runs only handle a single script / language / direction and don't have styling (beyond the font with which they were shaped, obviously). This is enough for the simplest use cases, but even UI labels might have two scripts, so we need an API to shape a line of text that can be composed of several styles and scripts (note: it might be tempting to keep style separate from the shaping and layout of a line, but style changes sometimes must split text into separate runs, e.g. to avoid having a style change in the middle of a ligature).
Here's the kind of API I'm going to try next:
typedefstructoc_text_attributes
{
oc_fontfont;
f32fontSize;
oc_colorcolor;
oc_colorbgColor;
//...
} oc_text_attributes;
// make text line from (possibly) multilingual text (but with a single style). Later we can have an API to construct multi-style text.oc_text_line*oc_text_line_from_utf8(oc_arena*arena, oc_str8string, oc_text_attributes*attributes);
oc_text_line*oc_text_line_from_utf32(oc_arena*arena, oc_str32string, oc_text_attributes*attributes);
oc_text_metricsoc_text_line_get_metrics(oc_text_line*line);
u64oc_text_line_codepoint_index_for_position(oc_text_line*line, oc_vec2position);
oc_vec2oc_text_line_position_for_codepoint_index(oc_text_line*line, u64index);
voidoc_text_line_draw(oc_text_line*line);
//...
At our last meeting @martinfouilleul expressed a desire to rework the text API. Specifically:
The text was updated successfully, but these errors were encountered: