+
+int GuiFontMetrics::descent(char_type c) const
+{
+ QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
+ return r.bottom() + 1;
+}
+
+#else
+
+void GuiFontMetrics::fillMetricsCache(char_type c) const
+{
+ QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
+ AscendDescend ad = { -r.top(), r.bottom() + 1};
+ // We could as well compute the width but this is not really
+ // needed for now as it is done directly in width() below.
+ metrics_cache_.insert(c, ad);
+}
+
+
+int GuiFontMetrics::width(char_type c) const
+{
+ if (!width_cache_.contains(c)) {
+ width_cache_.insert(c, metrics_.width(ucs4_to_qchar(c)));
+ }
+
+ return width_cache_.value(c);