- /** This cache adds 20Mo of memory to the LyX executable when
- * loading UserGuide.lyx which contains a good number of fonts. If
- * this turns out to be too much, we can switch to a \c QHash based
- * solution.
- **/
- mutable CharMetrics metrics_cache_[65536];
-#endif // USE_LYX_FONTCACHE
+ mutable QHash<char_type, int> width_cache_;
+
+ struct AscendDescend {
+ short int ascent;
+ short int descent;
+ };
+ /// Cache of char ascends and descends
+ mutable QHash<char_type, AscendDescend> metrics_cache_;
+ /// fill in \c metrics_cache_ at specified value.
+ AscendDescend const fillMetricsCache(char_type) const;
+
+ /// Cache of char right bearings
+ mutable QHash<char_type, int> rbearing_cache_;