# Documentation of the MLV-2.0.2 library

- Presentation
- Downloads
- Installation
- Compilation
- Examples
- API
- List of functions
- bugs
- FAQ
- contacts

MLV_text.h
1 /*
2 * This file is part of the MLV Library.
3 *
4 * Copyright (C) 2010,2011,2012 Adrien Boussicault, Marc Zipstein
5 *
6 *
7 * This Library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This Library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this Library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
31 #ifndef __MLV__MLV_TEXT_H__
32 #define __MLV__MLV_TEXT_H__
33
34 #include "MLV_color.h"
35 #include "MLV_image.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
44 typedef enum {
45 MLV_TEXT_CENTER,
46 MLV_TEXT_LEFT,
47 MLV_TEXT_RIGHT
48 } MLV_Text_justification;
49
53 typedef enum {
54 MLV_HORIZONTAL_CENTER,
56 MLV_HORIZONTAL_LEFT,
58 MLV_HORIZONTAL_RIGHT
60 } MLV_Horizontal_position;
61
65 typedef enum {
66 MLV_VERTICAL_CENTER,
68 MLV_VERTICAL_TOP,
70 MLV_VERTICAL_BOTTOM
72 } MLV_Vertical_position;
73
77 typedef struct _MLV_Font MLV_Font;
78
91 MLV_Font* MLV_load_font( const char* file_font, int size );
92
99 void MLV_free_font( MLV_Font* font );
100
109 void MLV_get_size_of_text( const char *text, int *width, int *height, ... );
110
120 void MLV_get_size_of_text_with_font(
121 const char *text, int *width, int *height, const MLV_Font* font, ...
122 );
123
135 void MLV_draw_text( int x, int y, const char *text, MLV_Color color, ... );
136
147 void MLV_draw_text_with_font(
148 int x, int y, const char *text, const MLV_Font* font, MLV_Color color, ...
149 );
150
164 void MLV_draw_text_on_image(
165 int x, int y, const char *text, MLV_Color color, MLV_Image* image, ...
166 );
167
179 void MLV_draw_text_with_font_on_image(
180 int x, int y, const char *text, const MLV_Font* font, MLV_Color color,
181 MLV_Image* image, ...
182 );
183
205 void MLV_draw_adapted_text_box(
206 int x, int y,
207 const char* message,
208 int sizeInterligne,
209 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
210 MLV_Text_justification text_justification, ...
211 );
212
227 void MLV_draw_adapted_text_box_on_image(
228 int x, int y,
229 const char* message,
230 int sizeInterligne,
231 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
232 MLV_Text_justification text_justification,
233 MLV_Image* image, ...
234 );
235
250 int MLV_get_size_of_adapted_text_box(
251 const char* message,
252 int sizeInterligne,
253 int *result_width, int *result_height,
254 ...
255 );
256
271 void MLV_draw_adapted_text_box_with_font(
272 int x, int y,
273 const char* message,
274 const MLV_Font* font,
275 int sizeInterligne,
276 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
277 MLV_Text_justification text_justification, ...
278 );
279
295 void MLV_draw_adapted_text_box_with_font_on_image(
296 int x, int y,
297 const char* message,
298 const MLV_Font* font,
299 int sizeInterligne,
300 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
301 MLV_Text_justification text_justification,
302 MLV_Image* image, ...
303 );
304
305
322 int MLV_get_size_of_adapted_text_box_with_font(
323 const char* message,
324 const MLV_Font* font,
325 int sizeInterligne,
326 int *result_width, int *result_height,
327 ...
328 );
329
362 void MLV_draw_text_box(
363 int x, int y,
364 int width, int height,
365 const char* message ,
366 int sizeInterligne,
367 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
368 MLV_Text_justification text_justification,
369 MLV_Horizontal_position horizontal_position,
370 MLV_Vertical_position vertical_position,
371 ...
372 );
373
392 void MLV_draw_text_box_on_image(
393 int x, int y,
394 int width, int height,
395 const char* message ,
396 int sizeInterligne,
397 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
398 MLV_Text_justification text_justification,
399 MLV_Horizontal_position horizontal_position,
400 MLV_Vertical_position vertical_position,
401 MLV_Image* image,
402 ...
403 );
404
424 void MLV_draw_text_box_with_font(
425 int x, int y,
426 int width, int height,
427 const char* message ,
428 const MLV_Font* font,
429 int sizeInterligne,
430 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
431 MLV_Text_justification text_justification,
432 MLV_Horizontal_position horizontal_position,
433 MLV_Vertical_position vertical_position,
434 ...
435 );
436
457 void MLV_draw_text_box_with_font_on_image(
458 int x, int y,
459 int width, int height,
460 const char* message ,
461 MLV_Font* font,
462 int sizeInterligne,
463 MLV_Color borderColor, MLV_Color textColor, MLV_Color backgroundColor,
464 MLV_Text_justification text_justification,
465 MLV_Horizontal_position horizontal_position,
466 MLV_Vertical_position vertical_position,
467 MLV_Image* image,
468 ...
469 );
470
482 char* MLV_convert_unicode_to_string( int unicode );
483
484 #ifdef __cplusplus
485 }
486 #endif
487
488 #endif
489