From 353afcd464dd3200d7f9899ef97bc4ed5b8ccffa Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi <pietro10@mac.com> Date: Thu, 24 Dec 2015 22:31:32 -0500 Subject: [PATCH] Added the Language field to the text styles list. --- ui.h | 2 +- unix/draw.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ui.h b/ui.h index b9943160..e4463119 100644 --- a/ui.h +++ b/ui.h @@ -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 }; diff --git a/unix/draw.c b/unix/draw.c index 5d2490b2..006431b0 100644 --- a/unix/draw.c +++ b/unix/draw.c @@ -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);