summaryrefslogtreecommitdiffstats
path: root/src/libnrtype
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnrtype')
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp12
-rw-r--r--src/libnrtype/Layout-TNG.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index 0ce00e43b..bf6516b42 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -340,6 +340,18 @@ static char const *weight_to_text(PangoWeight w)
return "???";
}
+Glib::ustring Layout::getFontFamily(unsigned span_index) const
+{
+ if (span_index < 0 || span_index >= _spans.size())
+ return "";
+
+ if (_spans[span_index].font) {
+ return pango_font_description_get_family(_spans[span_index].font->descr);
+ }
+
+ return "";
+}
+
Glib::ustring Layout::dumpAsText() const
{
Glib::ustring result;
diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h
index 4406d9f93..f4a09f25b 100644
--- a/src/libnrtype/Layout-TNG.h
+++ b/src/libnrtype/Layout-TNG.h
@@ -353,6 +353,9 @@ public:
void showGlyphs(CairoRenderContext *ctx) const;
#endif
+ /** Returns the font family of the indexed span */
+ Glib::ustring getFontFamily(unsigned span_index) const;
+
/** debug and unit test method. Creates a textual representation of the
contents of this object. The output is designed to be both human-readable
and comprehensible when diffed with a known-good dump. */