4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS
22 #include <qfontmetrics.h>
25 * Qt font loader for LyX. Matches LyXFonts against
26 * actual QFont instances, and also caches metrics.
34 /// update fonts after zoom, dpi, font names, or norm change
37 /// do we have anything matching?
38 bool available(LyXFont const & f);
40 /// get the QFont for this LyXFont
41 QFont const & get(LyXFont const & f);
43 /// get the QFont metrics for this LyXFont
44 QFontMetrics const & metrics(LyXFont const & f) {
45 return getfontinfo(f)->metrics;
48 /// return pixel width for the given unicode char
49 int charwidth(LyXFont const & f, Uchar val);
52 /// hold info about a particular font
54 font_info(LyXFont const & f);
58 /// metrics on the font
61 typedef std::map<Uchar, int> WidthCache;
62 /// cache of char widths
63 WidthCache widthcache;
66 /// get font info (font + metrics) for the given LyX font. Does not fail.
67 font_info * getfontinfo(LyXFont const & f);
70 font_info * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
73 extern qfont_loader fontloader;
75 #endif // QFONT_LOADER_H