1fcft_glyph_rasterize(3)              fcft              fcft_glyph_rasterize(3)
2
3
4

NAME

6       fcft_glyph_rasterize - rasterize a glyph for a wide character
7

SYNOPSIS

9       #include <fcft/fcft.h>
10
11       const struct fcft_glyph *fcft_glyph_rasterize(
12           struct fcft_font *font, wchar_t wc, enum fcft_subpixel subpixel);
13

DESCRIPTION

15       fcft_glyph_rasterize() rasterizes the wide character wc using the pri‐
16       mary font, or one of the fallback fonts, in font.
17
18       wc is first searched for in the primary font. If not found, the fall‐
19       back fonts are searched (in the order they were specified in
20       fcft_from_name(3)). If not found in any of the fallback fonts, the
21       FontConfig fallback list for the primary font is searched.
22
23       subpixel allows you to specify which subpixel mode to use. It is one
24       of:
25
26           enum fcft_subpixel {
27               FCFT_SUBPIXEL_DEFAULT,
28               FCFT_SUBPIXEL_NONE,
29               FCFT_SUBPIXEL_HORIZONTAL_RGB,
30               FCFT_SUBPIXEL_HORIZONTAL_BGR,
31               FCFT_SUBPIXEL_VERTICAL_RGB,
32               FCFT_SUBPIXEL_VERTICAL_BGR,
33           };
34
35       If FCFT_SUBPIXEL_DEFAULT is specified, the subpixel mode configured in
36       FontConfig is used. If FCFT_SUBPIXEL_NONE is specified, grayscale
37       antialiasing will be used. For all other values, the specified mode is
38       used.
39
40       Note that if antialiasing has been disabled (in FontConfig, either
41       globally, or specifically for the current font), then subpixel is
42       ignored.
43
44       The intention is to enable programs to use per-monitor subpixel modes.
45       Incidentally, enum fcft_subpixel matches enum wl_output_subpixel, the
46       enum used in Wayland.
47
48       Note: you probably do not want anything by FCFT_SUBPIXEL_NONE if blend‐
49       ing with a transparent background.
50

RETURN VALUE

52       On error, NULL is returned.
53
54       On success, a pointer to a rasterized glyph is returned. The glyph is
55       cached in fcft, making subsequent calls with the same arguments very
56       fast (i.e. there is no need for programs to cache glyphs by them‐
57       selves).
58
59       The glyph object is managed by font. There is no need to explicitly
60       free it; it is freed when font is destroyed (with fcft_destroy(3)).
61
62           struct fcft_glyph {
63               wchar_t wc;
64               int cols;
65
66               pixman_image_t *pix;
67
68               int x;
69               int y;
70               int width;
71               int height;
72
73               struct {
74                   int x;
75                   int y;
76               } advance;
77           };
78
79       wc is the same wc from the fcft_glyph_rasterize() call.
80
81       cols is the number of "columns" the glyph occupies (effectively,
82       wcwidth(wc)).
83
84       pix is the rasterized glyph. Its format depends on a number of factors,
85       but will be one of PIXMAN_a1, PIXMAN_a8, PIXMAN_x8r8g8b8, PIX‐
86       MAN_a8r8g8b8. Use pixman_image_get_format() to find out which one it
87       is.
88
89           PIXMAN_a1 corresponds to FT_PIXEL_MODE_MONO. I.e. the glyph is an
90           un-antialiased bitmask. Use as a mask when blending.
91
92           PIXMAN_a8 corresponds to FT_PIXEL_MODE_GRAY. I.e. the glyph is a
93           grayscale antialiased bitmask. use as a mask when blending.
94
95           PIXMAN_x8r8g8b8 corresponds to either FT_PIXEL_MODE_LCD or
96           FT_PIXEL_MODE_LCD_V. pixman_image_set_component_alpha() has been
97           called by fcft for you. Use as a mask when blending.
98
99           PIXMAN_a8r8g8b8 corresponds to FT_PIXEL_MODE_BGRA. I.e. the glyph
100           is a plain RGBA image. Use as source when blending.
101
102       x is the glyph's horizontal offset, in pixels. Add this to the current
103       pen position when blending.
104
105       y is the glyph's vertical offset, in pixels. Add this to the current
106       pen position when blending.
107
108       width is the glyph's width, in pixels. Use as 'width' argument when
109       blending.
110
111       height is the glyph's height, in pixels. Use as 'height' argument when
112       blending.
113
114       advance is the glyph's 'advance', in pixels. Add this to the pen posi‐
115       tion after blending; x for a horizontal layout and y for a vertical
116       layout.
117

EXAMPLE

119       See fcft_from_name(3)
120

SEE ALSO

122       fcft_destroy(3), fcft_kerning(3)
123
124
125
1262.3.2                             2021-03-08           fcft_glyph_rasterize(3)
Impressum