LINUX.ORG.RU

[GTK+, Cairo] Как установить шрифт GtkFontButton в cairo_set_font_face?


0

1

Получаю шрифт из GtkFontButton с помощью

const gchar* gtk_font_button_get_font_name (GtkFontButton *font_button);

и нужно каким-то образом установить его в

void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);

Как это можно осуществить?


Ответ на: комментарий от Deleted

пуфф... не работает так, шрифтокнопка возвращает мне «Sans 12» например, прийдётся парсить как-то

g-71
() автор топика
Ответ на: комментарий от g-71

зачем парсить. читай мануал...

gtk_font_button_get_font_name ()

const gchar*        gtk_font_button_get_font_name       (GtkFontButton *font_button);
Retrieves the name of the currently selected font. This name includes style and size information as well. If you want to render something with the font, use this string with pango_font_description_from_string() . If you're interested in peeking certain values (family name, style, size, weight) just query these properties from the PangoFontDescription object.

font_button :
a GtkFontButton
Returns :
an internal copy of the font name which must not be freed.

особливо внимательно почитай последнее предложение в дескрипшене.

Deleted
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.