4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup
10 * Full author contact details are available in file CREDITS.
19 #include <boost/scoped_array.hpp>
21 /** This class manages a font.
22 The idea is to create a FontInfo object with a font name pattern with a
23 wildcard at the size field. Then this object can host request for font-
24 instances of any given size. If no exact match is found, the closest size
25 is chosen instead. If the font is scalable, the flag
26 lyxrc.use_scalable_fonts determines whether to allow scalable fonts to
32 FontInfo() { init(); }
35 explicit FontInfo(string const & pat)
36 : pattern(pat) { init(); }
38 /// Does any font match our pattern?
44 /// Is this font scalable?
50 /// Get existing pattern
51 string const & getPattern() const { return pattern; }
54 void setPattern(string const & pat);
56 /** Return full name of font close to this size.
57 If impossible, result is the empty string */
58 string const getFontname(int size);
60 /// Font pattern (with wildcard for size)
63 /// Available size list
64 boost::scoped_array<int> sizes;
66 /// Corresponding name list
67 boost::scoped_array<string> strings;
72 /// Did we query X about this font?
75 /// Is this font scalable?
78 /// Which index points to scalable font entry?
81 /// Initialize empty record
84 /// Ask X11 about this font pattern
87 /// Build newly sized font string
88 string const resize(string const &, int size) const;