mirror of
https://github.com/labwc/labwc.git
synced 2026-04-11 08:21:13 -04:00
src/common/font.c: Add font_width()
This commit is contained in:
parent
5f30773a6e
commit
dfb25657cc
2 changed files with 13 additions and 0 deletions
|
|
@ -15,6 +15,12 @@ struct font {
|
||||||
*/
|
*/
|
||||||
int font_height(struct font *font);
|
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_buffer_create - Create ARGB8888 lab_data_buffer using pango
|
* font_buffer_create - Create ARGB8888 lab_data_buffer using pango
|
||||||
* @buffer: buffer pointer
|
* @buffer: buffer pointer
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,13 @@ font_height(struct font *font)
|
||||||
return rectangle.height;
|
return rectangle.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
font_width(struct font *font, const char *string)
|
||||||
|
{
|
||||||
|
PangoRectangle rectangle = font_extents(font, string);
|
||||||
|
return rectangle.width;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
font_buffer_update(struct lab_data_buffer **buffer, int max_width,
|
font_buffer_update(struct lab_data_buffer **buffer, int max_width,
|
||||||
const char *text, struct font *font, float *color, double scale)
|
const char *text, struct font *font, float *color, double scale)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue