2016-08-02 17:00:08 +03:00
|
|
|
/*
|
2016-08-18 03:28:42 +03:00
|
|
|
* gfx/text.h - FIG text object
|
2016-08-02 17:00:08 +03:00
|
|
|
*
|
|
|
|
* Written 2016 by Werner Almesberger
|
|
|
|
* Copyright 2016 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2016-08-18 03:28:42 +03:00
|
|
|
#ifndef GFX_TEXT_H
|
|
|
|
#define GFX_TEXT_H
|
2016-08-02 17:00:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* use constants of FIG text sub_type */
|
|
|
|
|
|
|
|
enum text_align {
|
|
|
|
text_min = 0, // left or bottom
|
|
|
|
text_mid = 1, // center
|
|
|
|
text_max = 2, // right or top
|
|
|
|
};
|
|
|
|
|
|
|
|
enum text_style {
|
|
|
|
text_normal,
|
2016-08-16 07:00:20 +03:00
|
|
|
text_italic,
|
2016-08-02 17:00:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct text {
|
2016-08-05 01:25:31 +03:00
|
|
|
const char *s;
|
2016-08-02 17:00:08 +03:00
|
|
|
int size;
|
2016-08-05 01:25:31 +03:00
|
|
|
int x, y;
|
|
|
|
int rot;
|
|
|
|
enum text_align hor;
|
2016-08-02 17:00:08 +03:00
|
|
|
enum text_align vert;
|
|
|
|
};
|
|
|
|
|
|
|
|
void text_init(struct text *txt);
|
|
|
|
void text_free(struct text *txt);
|
|
|
|
|
|
|
|
void text_set(struct text *txt, const char *s);
|
|
|
|
void text_rot(struct text *txt, int deg);
|
|
|
|
void text_flip_x(struct text *txt);
|
|
|
|
enum text_align text_flip(enum text_align align);
|
|
|
|
|
|
|
|
void text_fig(const struct text *txt, int color, unsigned layer);
|
|
|
|
|
|
|
|
void text_rel(const struct text *txt, enum text_align xr, enum text_align yr,
|
|
|
|
int dx, int dy, int *res_x, int *res_y);
|
|
|
|
void text_shift(struct text *txt, enum text_align xr, enum text_align yr,
|
|
|
|
int dx, int dy);
|
|
|
|
int text_rel_x(const struct text *txt, enum text_align xr, enum text_align yr,
|
|
|
|
int dx, int dy);
|
|
|
|
int text_rel_y(const struct text *txt, enum text_align xr, enum text_align yr,
|
|
|
|
int dx, int dy);
|
|
|
|
|
2016-08-18 03:28:42 +03:00
|
|
|
#endif /* !GFX_TEXT_H */
|