From a48a5301a4d8912d717dc6e393608b8abb55a086 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 1 Oct 2019 12:37:50 +0200 Subject: Support "lang" and "xml:lang" attributes. Partial fix for https://gitlab.com/inkscape/inbox/issues/951 --- src/libnrtype/Layout-TNG-Compute.cpp | 8 ++++++++ src/libnrtype/Layout-TNG.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libnrtype') diff --git a/src/libnrtype/Layout-TNG-Compute.cpp b/src/libnrtype/Layout-TNG-Compute.cpp index 03ccc62d7..aad2744b5 100644 --- a/src/libnrtype/Layout-TNG-Compute.cpp +++ b/src/libnrtype/Layout-TNG-Compute.cpp @@ -1148,6 +1148,14 @@ void Layout::Calculator::_buildPangoItemizationForPara(ParagraphInfo *para) con pango_attr_list_insert(attributes_list, attribute_font_features); #endif + // Set language + SPObject * object = static_cast(text_source->source_cookie); + if (!object->lang.empty()) { + PangoLanguage* language = pango_language_from_string(object->lang.c_str()); + PangoAttribute *attribute_language = pango_attr_language_new( language ); + pango_attr_list_insert(attributes_list, attribute_language); + } + // ownership of attribute is assumed by the list font->Unref(); } diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index 4f096abab..596e112b3 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -718,7 +718,8 @@ private: std::vector rotate; SVGLength textLength; LengthAdjust lengthAdjust; - + Glib::ustring lang; + // a few functions for some of the more complicated style accesses /// The return value must be freed with pango_font_description_free() PangoFontDescription *styleGetFontDescription() const; -- cgit v1.2.3