1fcft_text_run_rasterize(3) fcft fcft_text_run_rasterize(3)
2
3
4
6 fcft_text_run_rasterize - rasterize a series of glyphs for a text
7 string
8
10 #include <fcft/fcft.h>
11
12 struct fcft_text_run *fcft_text_run_rasterize(
13 struct fcft_font *font, size_t len, const wchar_t text[static len],
14 enum fcft_subpixel subpixel);
15
17 fcft_text_run_rasterize() shapes and rasterizes the string text into a
18 series of glyphs using the primary font, and possibly one or more fall‐
19 back fonts, in font.
20
21 subpixel allows you to specify which subpixel mode to use. See
22 fcft_glyph_rasterize() for details.
23
24 The string is passed to HarfBuzz for shaping, initially using the pri‐
25 mary font. The shaping data is parsed, and when an unshaped codepoint
26 is encountered, it is retried with the first fallback font. If that
27 fails too, the next fallback font is tried. After successfully shaping
28 the failed codepoint, the primary font is used to shape the rest of the
29 string. This continues until the entire string has been shaped.
30
31 There is limited support for right-to-left scripts. hb_buf‐
32 fer_guess_segment_properties() is used to guess whether to use left-to-
33 right, or right-to-left, logic, and this is done each time we try to
34 shape a part of the string.
35
36 As a consequence, the result of mixed LTR and RTL strings depends on
37 the font; if the font has glyphs for all characters in the string,
38 hb_buffer_guess_segment_properties() is only called once, on the entire
39 string. Meaning the entire string is subject to either LTR, or RTL
40 logic, but not both.
41
42 If the (primary) font does not have glyphs for all characters, then
43 hb_buffer_guess_segment_properties() will be called for each segment
44 where shaping failed. In this case, parts of the string may be treated
45 as LTR while others are treated as RTL.
46
48 On error, NULL is returned.
49
50 On success, a pointer to a dynamically allocated text-run is returned:
51
52 struct fcft_text_run {
53 const struct fcft_glyph **glyphs;
54 int *cluster;
55 size_t count;
56 };
57
58 Both glyphs and cluster are arrays with count elements. cluster con‐
59 tains the character offsets (in the original string) of each corre‐
60 sponding glyph.
61
62 Note that the glyphs' cols member are invalid.
63
64 The text-run is not cached in fcft. The calling application may cache
65 it for as long as it likes, including after the font has been de‐
66 stroyed.
67
68 The text-run must be free:d with fcft_text_run_destroy().
69
71 fcft_text_run_destroy(), fcft_grapheme_rasterize(), fcft_glyph_raster‐
72 ize()
73
74
75
762.5.0 2021-11-13 fcft_text_run_rasterize(3)