Added the Language field to the text styles list.

This commit is contained in:
Pietro Gagliardi 2015-12-24 22:31:32 -05:00
parent 6ef404c2dd
commit 353afcd464
2 changed files with 4 additions and 1 deletions

2
ui.h
View File

@ -496,7 +496,6 @@ typedef enum uiDrawTextStretch {
} uiDrawTextStretch;
struct uiDrawTextStyle {
// TODO Language attribute
const char *Family;
double Size;
uiDrawTextWeight Weight;
@ -522,6 +521,7 @@ struct uiDrawTextStyle {
double UnderlineG;
double UnderlineB;
double UnderlineA; // TODO Pango
const char *Language; // RFC 3066; NULL for default
// TODO other Pango attributes
};

View File

@ -560,6 +560,9 @@ void uiDrawText(uiDrawContext *c, double x, double y, const char *text, uiDrawTe
if (style->HasUnderline) {
// TODO
}
if (style->Language != NULL)
pango_attr_list_insert(attrs,
pango_attr_language_new(pango_language_from_string(style->Language)));
layout = pango_cairo_create_layout(c->cr);
pango_layout_set_text(layout, text, -1);