Implement "text-align"
"text-align" allows setting the alignment of text, with respect to other lines and allocated space, without requiring a reference to the ClutterText (which is private for most widgets). If not specified, all text is left-aligned. https://bugzilla.gnome.org/show_bug.cgi?id=622447
This commit is contained in:

committed by
Florian Müllner

parent
3af4ca3fe9
commit
97f883b10e
@ -1761,6 +1761,53 @@ st_theme_node_get_text_decoration (StThemeNode *node)
|
||||
return 0;
|
||||
}
|
||||
|
||||
StTextAlign
|
||||
st_theme_node_get_text_align(StThemeNode *node)
|
||||
{
|
||||
int i;
|
||||
|
||||
ensure_properties(node);
|
||||
|
||||
for (i = node->n_properties - 1; i >= 0; i--)
|
||||
{
|
||||
CRDeclaration *decl = node->properties[i];
|
||||
|
||||
if (strcmp(decl->property->stryng->str, "text-align") == 0)
|
||||
{
|
||||
CRTerm *term = decl->value;
|
||||
|
||||
if (term->type != TERM_IDENT || term->next)
|
||||
continue;
|
||||
|
||||
if (strcmp(term->content.str->stryng->str, "inherit") == 0)
|
||||
{
|
||||
if (node->parent_node)
|
||||
return st_theme_node_get_text_align(node->parent_node);
|
||||
return ST_TEXT_ALIGN_LEFT;
|
||||
}
|
||||
else if (strcmp(term->content.str->stryng->str, "left") == 0)
|
||||
{
|
||||
return ST_TEXT_ALIGN_LEFT;
|
||||
}
|
||||
else if (strcmp(term->content.str->stryng->str, "right") == 0)
|
||||
{
|
||||
return ST_TEXT_ALIGN_RIGHT;
|
||||
}
|
||||
else if (strcmp(term->content.str->stryng->str, "center") == 0)
|
||||
{
|
||||
return ST_TEXT_ALIGN_CENTER;
|
||||
}
|
||||
else if (strcmp(term->content.str->stryng->str, "justify") == 0)
|
||||
{
|
||||
return ST_TEXT_ALIGN_JUSTIFY;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(node->parent_node)
|
||||
return st_theme_node_get_text_align(node->parent_node);
|
||||
return ST_TEXT_ALIGN_LEFT;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
font_family_from_terms (CRTerm *term,
|
||||
char **family)
|
||||
|
Reference in New Issue
Block a user