mirror of
https://github.com/labwc/labwc.git
synced 2026-02-10 04:27:47 -05:00
74 lines
1.7 KiB
C
74 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef LABWC_FONT_H
|
|
#define LABWC_FONT_H
|
|
|
|
struct lab_data_buffer;
|
|
|
|
enum font_slant {
|
|
FONT_SLANT_NORMAL = 0,
|
|
FONT_SLANT_ITALIC,
|
|
FONT_SLANT_OBLIQUE
|
|
};
|
|
|
|
enum font_weight {
|
|
FONT_WEIGHT_NORMAL = 0,
|
|
FONT_WEIGHT_THIN,
|
|
FONT_WEIGHT_ULTRALIGHT,
|
|
FONT_WEIGHT_LIGHT,
|
|
FONT_WEIGHT_SEMILIGHT,
|
|
FONT_WEIGHT_BOOK,
|
|
FONT_WEIGHT_MEDIUM,
|
|
FONT_WEIGHT_SEMIBOLD,
|
|
FONT_WEIGHT_BOLD,
|
|
FONT_WEIGHT_ULTRABOLD,
|
|
FONT_WEIGHT_HEAVY,
|
|
FONT_WEIGHT_ULTRAHEAVY
|
|
};
|
|
|
|
struct font {
|
|
char *name;
|
|
int size;
|
|
enum font_slant slant;
|
|
enum font_weight weight;
|
|
};
|
|
|
|
struct _PangoFontDescription *font_to_pango_desc(struct font *font);
|
|
|
|
/**
|
|
* font_height - get font vertical extents
|
|
* @font: description of font including family name and size
|
|
*/
|
|
int font_height(struct font *font);
|
|
|
|
/**
|
|
* font_width - get font horizontal extents
|
|
* @font: description of font including family name and size
|
|
*/
|
|
int font_width(struct font *font, const char *string);
|
|
|
|
/**
|
|
* font_get_buffer_size - dry-run font_buffer_create() to get buffer size
|
|
*/
|
|
void font_get_buffer_size(int max_width, const char *text, struct font *font,
|
|
int *width, int *height);
|
|
|
|
/**
|
|
* font_buffer_create - Create ARGB8888 lab_data_buffer using pango
|
|
* @buffer: buffer pointer
|
|
* @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
|
|
* @bg_color: background color in rgba format
|
|
*/
|
|
void font_buffer_create(struct lab_data_buffer **buffer, int max_width,
|
|
const char *text, struct font *font, const float *color,
|
|
const float *bg_color, double scale);
|
|
|
|
/**
|
|
* font_finish - free some font related resources
|
|
* Note: use on exit
|
|
*/
|
|
void font_finish(void);
|
|
|
|
#endif /* LABWC_FONT_H */
|