1.1.0
character-mapping.h
1 #ifndef FONT_CHEF_CHARACTER_MAPPING_H
2 #define FONT_CHEF_CHARACTER_MAPPING_H
3 
4 #include "font-chef/size.h"
5 #include "font-chef/rect.h"
6 
18 #include "font-chef/font-chef-export.h"
19 #include <stddef.h>
20 #include <stdint.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
38  struct fc_rect source;
42  struct fc_rect target;
43 
47  uint32_t codepoint;
48 };
49 
58  fc_align_left = 0,
59  fc_align_center,
60  fc_align_right
61 };
62 
70 FONT_CHEF_EXPORT struct fc_rect fc_text_bounds(struct fc_character_mapping const mapping[], size_t length);
71 
92 FONT_CHEF_EXPORT extern uint32_t fc_wrap(
93  struct fc_character_mapping mapping[],
94  size_t count,
95  float line_width,
96  float line_height,
97  float space_width,
98  enum fc_alignment alignment
99 );
100 
116 FONT_CHEF_EXPORT void fc_move(struct fc_character_mapping * mapping, size_t count, float left, float baseline);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* FONT_CHEF_CHARACTER_MAPPING_H */
fc_alignment
fc_alignment
Specifies an aligment to be used when rendering wrapped text.
Definition: character-mapping.h:57
fc_text_bounds
struct fc_rect fc_text_bounds(struct fc_character_mapping const mapping[], size_t length)
Calculates a bounding box for the rendered text.
fc_character_mapping::source
struct fc_rect source
The source rectangle that should be used to clip the texture/surface.
Definition: character-mapping.h:38
fc_character_mapping::target
struct fc_rect target
The target rectangle, or where in the target coordinates you should render the clipped texture.
Definition: character-mapping.h:42
fc_rect::left
float left
Left value.
Definition: rect.h:35
fc_wrap
uint32_t fc_wrap(struct fc_character_mapping mapping[], size_t count, float line_width, float line_height, float space_width, enum fc_alignment alignment)
Word-wraps characters in an array of fc_character_mapping.
fc_rect
Represents a rectangle with left, top, right and bottom float values.
Definition: rect.h:33
fc_character_mapping::codepoint
uint32_t codepoint
Which unicode codepoint this mapping represents.
Definition: character-mapping.h:47
fc_character_mapping
Specifies source and target rectangles to render the specified codepoint.
Definition: character-mapping.h:34
fc_move
void fc_move(struct fc_character_mapping *mapping, size_t count, float left, float baseline)
Moves all the target rectangles by left pixels horizontally and baseline pixels vertically.