[librsvg] Bind rsvg_state_get_letter_spacing()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Bind rsvg_state_get_letter_spacing()
- Date: Fri, 15 Dec 2017 18:53:47 +0000 (UTC)
commit be9eec634e6138e4ce686a1652b70c02e9832aa3
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Dec 15 10:58:44 2017 -0600
Bind rsvg_state_get_letter_spacing()
rsvg-styles.c | 7 +++++++
rsvg-styles.h | 2 ++
rsvg-text.c | 4 +++-
rust/src/state.rs | 25 ++++++++++++++++---------
4 files changed, 28 insertions(+), 10 deletions(-)
---
diff --git a/rsvg-styles.c b/rsvg-styles.c
index 7a9e895..5b2fb07 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -1822,3 +1822,10 @@ rsvg_state_get_font_stretch (RsvgState *state)
{
return state->font_stretch;
}
+
+RsvgLength
+rsvg_state_get_letter_spacing (RsvgState *state)
+{
+ return state->letter_spacing;
+}
+
diff --git a/rsvg-styles.h b/rsvg-styles.h
index 1f4869c..83738ed 100644
--- a/rsvg-styles.h
+++ b/rsvg-styles.h
@@ -281,6 +281,8 @@ PangoWeight rsvg_state_get_font_weight (RsvgState *state);
G_GNUC_INTERNAL
PangoStretch rsvg_state_get_font_stretch (RsvgState *state);
+G_GNUC_INTERNAL
+RsvgLength rsvg_state_get_letter_spacing (RsvgState *state);
G_END_DECLS
diff --git a/rsvg-text.c b/rsvg-text.c
index 1e00eda..ee52b98 100644
--- a/rsvg-text.c
+++ b/rsvg-text.c
@@ -561,6 +561,7 @@ rsvg_text_create_layout (RsvgDrawingCtx *ctx, const char *text)
double dpi_y;
const char *lang;
UnicodeBidi unicode_bidi;
+ RsvgLength letter_spacing;
state = rsvg_current_state (ctx);
@@ -597,7 +598,8 @@ rsvg_text_create_layout (RsvgDrawingCtx *ctx, const char *text)
pango_font_description_free (font_desc);
attr_list = pango_attr_list_new ();
- attribute = pango_attr_letter_spacing_new (rsvg_length_normalize (&state->letter_spacing, ctx) *
PANGO_SCALE);
+ letter_spacing = rsvg_state_get_letter_spacing (state);
+ attribute = pango_attr_letter_spacing_new (rsvg_length_normalize (&letter_spacing, ctx) * PANGO_SCALE);
attribute->start_index = 0;
attribute->end_index = G_MAXINT;
pango_attr_list_insert (attr_list, attribute);
diff --git a/rust/src/state.rs b/rust/src/state.rs
index 5e60eb3..8c88f82 100644
--- a/rust/src/state.rs
+++ b/rust/src/state.rs
@@ -3,6 +3,8 @@ use glib::translate::*;
use pango;
use pango_sys;
+use length::RsvgLength;
+
pub enum RsvgState {}
// Keep in sync with rsvg-styles.h:UnicodeBidi
@@ -14,15 +16,16 @@ pub enum UnicodeBidi {
}
extern "C" {
- fn rsvg_state_get_language (state: *const RsvgState) -> *const libc::c_char;
- fn rsvg_state_get_unicode_bidi (state: *const RsvgState) -> UnicodeBidi;
- fn rsvg_state_get_text_dir (state: *const RsvgState) -> pango_sys::PangoDirection;
- fn rsvg_state_get_text_gravity (state: *const RsvgState) -> pango_sys::PangoGravity;
- fn rsvg_state_get_font_family (state: *const RsvgState) -> *const libc::c_char;
- fn rsvg_state_get_font_style (state: *const RsvgState) -> pango_sys::PangoStyle;
- fn rsvg_state_get_font_variant (state: *const RsvgState) -> pango_sys::PangoVariant;
- fn rsvg_state_get_font_weight (state: *const RsvgState) -> pango_sys::PangoWeight;
- fn rsvg_state_get_font_stretch (state: *const RsvgState) -> pango_sys::PangoStretch;
+ fn rsvg_state_get_language (state: *const RsvgState) -> *const libc::c_char;
+ fn rsvg_state_get_unicode_bidi (state: *const RsvgState) -> UnicodeBidi;
+ fn rsvg_state_get_text_dir (state: *const RsvgState) -> pango_sys::PangoDirection;
+ fn rsvg_state_get_text_gravity (state: *const RsvgState) -> pango_sys::PangoGravity;
+ fn rsvg_state_get_font_family (state: *const RsvgState) -> *const libc::c_char;
+ fn rsvg_state_get_font_style (state: *const RsvgState) -> pango_sys::PangoStyle;
+ fn rsvg_state_get_font_variant (state: *const RsvgState) -> pango_sys::PangoVariant;
+ fn rsvg_state_get_font_weight (state: *const RsvgState) -> pango_sys::PangoWeight;
+ fn rsvg_state_get_font_stretch (state: *const RsvgState) -> pango_sys::PangoStretch;
+ fn rsvg_state_get_letter_spacing (state: *const RsvgState) -> RsvgLength;
}
pub fn get_language(state: *const RsvgState) -> Option<String> {
@@ -62,3 +65,7 @@ pub fn get_font_weight(state: *const RsvgState) -> pango::Weight {
pub fn get_font_stretch(state: *const RsvgState) -> pango::Stretch {
unsafe { from_glib(rsvg_state_get_font_stretch(state)) }
}
+
+pub fn get_letter_spacing(state: *const RsvgState) -> RsvgLength {
+ unsafe { rsvg_state_get_letter_spacing(state) }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]