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);
51 /// Called before QApplication is initialized
52 static void initFontPath();
54 /// Called the first time when available() can't load a symbol font
55 static void addToFontPath();
58 /// hold info about a particular font
60 font_info(LyXFont const & f);
64 /// metrics on the font
67 typedef std::map<Uchar, int> WidthCache;
68 /// cache of char widths
69 WidthCache widthcache;
72 /// get font info (font + metrics) for the given LyX font. Does not fail.
73 font_info * getfontinfo(LyXFont const & f);
76 font_info * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
79 extern qfont_loader fontloader;
81 #endif // QFONT_LOADER_H