[gnome-shell/issue154: 4/6] st-theme-node: Add new getter st_theme_node_get_letter_spacing
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/issue154: 4/6] st-theme-node: Add new getter st_theme_node_get_letter_spacing
- Date: Wed, 18 Apr 2018 00:14:42 +0000 (UTC)
commit 695d61968dfe1945ad63f8b8fd263f4724df4eb8
Author: Mario Sanchez Prada <mario endlessm com>
Date: Fri Apr 13 12:56:18 2018 +0100
st-theme-node: Add new getter st_theme_node_get_letter_spacing
This will be used by ClutterText-backed StWidgets to update their
list of PangoAttributes according to the letter-spacing property.
src/st/st-theme-node.c | 22 ++++++++++++++++++++++
src/st/st-theme-node.h | 2 ++
2 files changed, 24 insertions(+)
---
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index 3739b93b4..fd2cdb084 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -2545,6 +2545,28 @@ st_theme_node_get_text_align(StThemeNode *node)
return ST_TEXT_ALIGN_LEFT;
}
+/**
+ * st_theme_node_get_letter_spacing:
+ * @node: a #StThemeNode
+ *
+ * Gets the value for the letter-spacing style property, in pixels.
+ *
+ * Return value: the value of the letter-spacing property, if
+ * found, or zero if such property has not been found.
+ */
+gdouble
+st_theme_node_get_letter_spacing (StThemeNode *node)
+{
+ gdouble spacing = 0.;
+
+ g_return_val_if_fail (ST_IS_THEME_NODE (node), spacing);
+
+ ensure_properties (node);
+
+ st_theme_node_lookup_length (node, "letter-spacing", FALSE, &spacing);
+ return spacing;
+}
+
static gboolean
font_family_from_terms (CRTerm *term,
char **family)
diff --git a/src/st/st-theme-node.h b/src/st/st-theme-node.h
index 940b97a38..08648e68a 100644
--- a/src/st/st-theme-node.h
+++ b/src/st/st-theme-node.h
@@ -223,6 +223,8 @@ StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node);
StTextAlign st_theme_node_get_text_align (StThemeNode *node);
+double st_theme_node_get_letter_spacing (StThemeNode *node);
+
/* Font rule processing is pretty complicated, so we just hardcode it
* under the standard font/font-family/font-size/etc names. This means
* you can't have multiple separate styled fonts for a single item,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]