1fcft_rasterize_char_utf32(3) fcft fcft_rasterize_char_utf32(3)
2
3
4
6 fcft_rasterize_char_utf32 - rasterize a glyph for a single UTF-32 code‐
7 point
8
10 #include <fcft/fcft.h>
11
12 const struct fcft_glyph *fcft_rasterize_char_utf32(
13 struct fcft_font *font, uint32_t cp, enum fcft_subpixel subpixel);
14
16 fcft_rasterize_char_utf32() rasterizes the UTF-32 encoded Unicode code‐
17 point cp using the primary font, or one of the fallback fonts, in font.
18
19 cp is first searched for in the primary font. If not found, the fall‐
20 back fonts are searched (in the order they were specified in
21 fcft_from_name()). If not found in any of the fallback fonts, the Font‐
22 Config fallback list for the primary font is searched.
23
24 subpixel allows you to specify which subpixel mode to use. It is one
25 of:
26
27 enum fcft_subpixel {
28 FCFT_SUBPIXEL_DEFAULT,
29 FCFT_SUBPIXEL_NONE,
30 FCFT_SUBPIXEL_HORIZONTAL_RGB,
31 FCFT_SUBPIXEL_HORIZONTAL_BGR,
32 FCFT_SUBPIXEL_VERTICAL_RGB,
33 FCFT_SUBPIXEL_VERTICAL_BGR,
34 };
35
36 If FCFT_SUBPIXEL_DEFAULT is specified, the subpixel mode configured in
37 FontConfig is used. If FCFT_SUBPIXEL_NONE is specified, grayscale an‐
38 tialiasing will be used. For all other values, the specified mode is
39 used.
40
41 Note that if antialiasing has been disabled (in FontConfig, either
42 globally, or specifically for the current font), then subpixel is ig‐
43 nored.
44
45 The intention is to enable programs to use per-monitor subpixel modes.
46 Incidentally, enum fcft_subpixel matches enum wl_output_subpixel, the
47 enum used in Wayland.
48
49 Note: you probably do not want to use anything other than FCFT_SUB‐
50 PIXEL_NONE if blending with a transparent background.
51
53 On error, NULL is returned.
54
55 On success, a pointer to a rasterized glyph is returned. The glyph is
56 cached in fcft, making subsequent calls with the same arguments very
57 fast (i.e. there is no need for programs to cache glyphs by them‐
58 selves).
59
60 The glyph object is managed by font. There is no need to explicitly
61 free it; it is freed when font is destroyed (with fcft_destroy()).
62
63 struct fcft_glyph {
64 uint32_t cp;
65 int cols;
66
67 pixman_image_t *pix;
68
69 int x;
70 int y;
71 int width;
72 int height;
73
74 struct {
75 int x;
76 int y;
77 } advance;
78 };
79
80 cp is the same cp from the fcft_rasterize_char_utf32() call.
81
82 cols is the number of "columns" the glyph occupies (effectively,
83 wcwidth(cp)). Note that this value will be incorrect if wide characters
84 (wchar_t) is not UTF-32 encoded in the current locale.
85
86 pix is the rasterized glyph. Its format depends on a number of factors,
87 but will be one of PIXMAN_a1, PIXMAN_a8, PIXMAN_x8r8g8b8, PIX‐
88 MAN_a8r8g8b8. Use pixman_image_get_format() to find out which one it
89 is.
90
91 PIXMAN_a1 corresponds to FT_PIXEL_MODE_MONO. I.e. the glyph is an
92 un-antialiased bitmask. Use as a mask when blending.
93
94 PIXMAN_a8 corresponds to FT_PIXEL_MODE_GRAY. I.e. the glyph is a
95 grayscale antialiased bitmask. use as a mask when blending.
96
97 PIXMAN_x8r8g8b8 corresponds to either FT_PIXEL_MODE_LCD or
98 FT_PIXEL_MODE_LCD_V. pixman_image_set_component_alpha() has been
99 called by fcft for you. Use as a mask when blending.
100
101 PIXMAN_a8r8g8b8 corresponds to FT_PIXEL_MODE_BGRA. I.e. the glyph
102 is a plain RGBA image. Use as source when blending.
103
104 x is the glyph's horizontal offset, in pixels. Add this to the current
105 pen position when blending.
106
107 y is the glyph's vertical offset, in pixels. Add this to the current
108 pen position when blending.
109
110 width is the glyph's width, in pixels. Use as 'width' argument when
111 blending.
112
113 height is the glyph's height, in pixels. Use as 'height' argument when
114 blending.
115
116 advance is the glyph's 'advance', in pixels. Add this to the pen posi‐
117 tion after blending; x for a horizontal layout and y for a vertical
118 layout.
119
121 See fcft_from_name()
122
124 fcft_destroy(), fcft_kerning(), fcft_rasterize_grapheme_utf32(),
125 fcft_rasterize_text_run_utf32()
126
127
128
1293.1.2 2022-05-20 fcft_rasterize_char_utf32(3)