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.
16 #include <boost/scoped_array.hpp>
20 /** This class manages a font.
21 The idea is to create a FontInfo object with a font name pattern with a
22 wildcard at the size field. Then this object can host request for font-
23 instances of any given size. If no exact match is found, the closest size
24 is chosen instead. If the font is scalable, the flag
25 lyxrc.use_scalable_fonts determines whether to allow scalable fonts to
31 FontInfo() { init(); }
34 explicit FontInfo(std::string const & pat)
35 : pattern(pat) { init(); }
37 /// Does any font match our pattern?
43 /// Is this font scalable?
49 /// Get existing pattern
50 std::string const & getPattern() const { return pattern; }
53 void setPattern(std::string const & pat);
55 /** Return full name of font close to this size.
56 If impossible, result is the empty string */
57 std::string const getFontname(int size);
59 /// Font pattern (with wildcard for size)
62 /// Available size list
63 boost::scoped_array<int> sizes;
65 /// Corresponding name list
66 boost::scoped_array<std::string> strings;
71 /// Did we query X about this font?
74 /// Is this font scalable?
77 /// Which index points to scalable font entry?
80 /// Initialize empty record
83 /// Ask X11 about this font pattern
86 /// Build newly sized font string
87 std::string const resize(std::string const &, int size) const;