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; } uiDrawTextStretch;
struct uiDrawTextStyle { struct uiDrawTextStyle {
// TODO Language attribute
const char *Family; const char *Family;
double Size; double Size;
uiDrawTextWeight Weight; uiDrawTextWeight Weight;
@ -522,6 +521,7 @@ struct uiDrawTextStyle {
double UnderlineG; double UnderlineG;
double UnderlineB; double UnderlineB;
double UnderlineA; // TODO Pango double UnderlineA; // TODO Pango
const char *Language; // RFC 3066; NULL for default
// TODO other Pango attributes // 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) { if (style->HasUnderline) {
// TODO // 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); layout = pango_cairo_create_layout(c->cr);
pango_layout_set_text(layout, text, -1); pango_layout_set_text(layout, text, -1);