2021-11-13 21:56:53 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2020-08-05 20:14:17 +01:00
|
|
|
#ifndef __LABWC_FONT_H
|
|
|
|
|
#define __LABWC_FONT_H
|
|
|
|
|
|
2022-02-17 01:46:32 +01:00
|
|
|
struct lab_data_buffer;
|
2021-08-07 08:35:46 +01:00
|
|
|
|
2021-08-20 20:20:49 +01:00
|
|
|
struct font {
|
|
|
|
|
char *name;
|
|
|
|
|
int size;
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-07 20:21:14 +01:00
|
|
|
/**
|
2020-08-05 20:14:17 +01:00
|
|
|
* font_height - get font vertical extents
|
2021-08-20 20:20:49 +01:00
|
|
|
* @font: description of font including family name and size
|
2020-08-05 20:14:17 +01:00
|
|
|
*/
|
2021-08-20 20:20:49 +01:00
|
|
|
int font_height(struct font *font);
|
2020-08-05 20:14:17 +01:00
|
|
|
|
2022-06-15 01:16:32 +02:00
|
|
|
/**
|
|
|
|
|
* font_width - get font horizontal extents
|
|
|
|
|
* @font: description of font including family name and size
|
|
|
|
|
*/
|
|
|
|
|
int font_width(struct font *font, const char *string);
|
|
|
|
|
|
2021-08-07 08:35:46 +01:00
|
|
|
/**
|
2022-02-17 01:46:32 +01:00
|
|
|
* font_buffer_create - Create ARGB8888 lab_data_buffer using pango
|
|
|
|
|
* @buffer: buffer pointer
|
2021-08-07 08:35:46 +01:00
|
|
|
* @max_width: max allowable width; will be ellipsized if longer
|
|
|
|
|
* @text: text to be generated as texture
|
|
|
|
|
* @font: font description
|
|
|
|
|
* @color: foreground color in rgba format
|
|
|
|
|
*/
|
2022-02-17 01:46:32 +01:00
|
|
|
void font_buffer_create(struct lab_data_buffer **buffer, int max_width,
|
2022-06-12 21:16:44 +02:00
|
|
|
const char *text, struct font *font, float *color, double scale);
|
2022-02-17 01:46:32 +01:00
|
|
|
|
2020-10-31 15:41:06 +00:00
|
|
|
/**
|
|
|
|
|
* font_finish - free some font related resources
|
|
|
|
|
* Note: use on exit
|
|
|
|
|
*/
|
|
|
|
|
void font_finish(void);
|
|
|
|
|
|
2020-08-05 20:14:17 +01:00
|
|
|
#endif /* __LABWC_FONT_H */
|