| 2848 | } |
| 2849 | |
| 2850 | void lf_text(const char* text) { |
| 2851 | // Retrieving the property data of the text |
| 2852 | LfUIElementProps props = get_props_for(state.theme.text_props); |
| 2853 | float padding = props.padding; |
| 2854 | float margin_left = props.margin_left, margin_right = props.margin_right, |
| 2855 | margin_top = props.margin_top, margin_bottom = props.margin_bottom; |
| 2856 | |
| 2857 | LfColor text_color = props.text_color; |
| 2858 | LfColor color = props.color; |
| 2859 | LfFont font = get_current_font(); |
| 2860 | |
| 2861 | // Advancing to the next line if the the text does not fit on the current div |
| 2862 | LfTextProps text_props = lf_text_render(state.pos_ptr, text, font, text_color, |
| 2863 | state.text_wrap ? |
| 2864 | (state.current_div.aabb.size.x + state.current_div.aabb.pos.x) - margin_right - margin_left |
| 2865 | : |
| 2866 | -1, |
| 2867 | (vec2s){-1, -1}, true, false, -1, -1); |
| 2868 | next_line_on_overflow( |
| 2869 | (vec2s){text_props.width + padding * 2.0f + margin_left + margin_right, |
| 2870 | text_props.height + padding * 2.0f + margin_top + margin_bottom}, |
| 2871 | state.div_props.border_width); |
| 2872 | |
| 2873 | // Advancing the position pointer by the margins |
| 2874 | state.pos_ptr.x += margin_left; |
| 2875 | state.pos_ptr.y += margin_top; |
| 2876 | |
| 2877 | // Rendering a colored text box if a color is specified |
| 2878 | // Rendering the text |
| 2879 | lf_text_render((vec2s){state.pos_ptr.x + padding, state.pos_ptr.y + padding}, text, font, text_color, |
| 2880 | state.text_wrap ? |
| 2881 | (state.current_div.aabb.size.x + state.current_div.aabb.pos.x) - margin_right - margin_left |
| 2882 | : |
| 2883 | -1, (vec2s){-1, -1}, false, false, -1, -1); |
| 2884 | |
| 2885 | // Advancing the position pointer by the width of the text |
| 2886 | state.pos_ptr.x += text_props.width + margin_right + padding; |
| 2887 | state.pos_ptr.y -= margin_top; |
| 2888 | } |
| 2889 | |
| 2890 | void lf_text_wide(const wchar_t* text) { |
| 2891 | // Retrieving the property data of the text |
no test coverage detected