Functions and types related to renderings result (after calling fc_render)
More...
|
enum | fc_alignment { fc_align_left = 0,
fc_align_center,
fc_align_right
} |
| Specifies an aligment to be used when rendering wrapped text. More...
|
|
Functions and types related to renderings result (after calling fc_render)
◆ fc_alignment
◆ fc_text_bounds()
Calculates a bounding box for the rendered text.
- Parameters
-
mapping | The rendering mapping (result of fc_render) |
length | How many characters were mapped |
- Returns
- A
fc_rect
value with left, top, right and bottom values enclosing the text area
◆ fc_wrap()
Word-wraps characters in an array of fc_character_mapping.
This functions identifies words and then uses a greedy algorithm to wrap lines. Keep in mind that calling fc_wrap on an already wrapped array will produce weird results. line_height
and space_width
can be obtained by calling fc_get_space_metrics, which returns both how tall and how wide a space is. You can multiply line_height
to increase between each line.
- Parameters
-
mapping | The array of character mappings to wrap |
count | How many mappings are in the array |
line_width | The maximum line width, in target/screen size (e.g, pixels) |
line_height | The space between the topmost pixel in the line to the bottomost pixel in the line (this includes characters in the line itself) |
space_width | The width of a space character |
alignment | Which aligment should lines follow |
- Returns
- The line count in the text
- See also
- fc_render_wrapped
-
fc::render_result::wrap
-
fc_get_space_metrics
◆ fc_move()
Moves all the target rectangles by left
pixels horizontally and baseline
pixels vertically.
You should use this to position the text where it should start rendering in your screen.
- Warning
- Text rendered by fc_render has a baseline set at
0
(see fc_render for a discussion about that), so most target rectangles will start rendering at negative y
positions. Moving them by baseline
pixels means you're moving its baseline and consequentially the y
position. But you should think in terms of baseline.
- Parameters
-
mapping | The array of character mappings to move |
count | How many mappings are in the array |
left | Left position where the text should start rendering |
baseline | Amount to add to the text baseline |
- Examples
- main.c.