From 53fe022959ca3f120d07401366bb2a9e5618f262 Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 4 Jul 2012 09:48:30 +0900 Subject: Fix for 168658 : Font substitution warning dialog (bzr r11522) --- src/libnrtype/Layout-TNG-Output.cpp | 12 ++++++++++++ src/libnrtype/Layout-TNG.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src/libnrtype') 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. */ -- cgit v1.2.3