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
22 #include <boost/scoped_array.hpp>
24 /** This class manages a font.
25 The idea is to create a FontInfo object with a font name pattern with a
26 wildcard at the size field. Then this object can host request for font-
27 instances of any given size. If no exact match is found, the closest size
28 is chosen instead. If the font is scalable, the flag
29 lyxrc.use_scalable_fonts determines whether to allow scalable fonts to
35 FontInfo() { init(); }
38 explicit FontInfo(string const & pat)
39 : pattern(pat) { init(); }
41 /// Does any font match our pattern?
47 /// Is this font scalable?
53 /// Get existing pattern
54 string const & getPattern() const { return pattern; }
57 void setPattern(string const & pat);
59 /** Return full name of font close to this size.
60 If impossible, result is the empty string */
61 string const getFontname(int size);
63 /// Font pattern (with wildcard for size)
66 /// Available size list
67 boost::scoped_array<int> sizes;
69 /// Corresponding name list
70 boost::scoped_array<string> strings;
75 /// Did we query X about this font?
78 /// Is this font scalable?
81 /// Which index points to scalable font entry?
84 /// Initialize empty record
87 /// Ask X11 about this font pattern
90 /// Build newly sized font string
91 string const resize(string const &, int size) const;