4 * Copyright 1997-2002 the LyX Team
5 * Read the file COPYING
7 * \author Asger Alstrup
8 * \author John Levon <moz@compsoc.man.ac.uk>
20 #include <boost/scoped_array.hpp>
22 /** This class manages a font.
23 The idea is to create a FontInfo object with a font name pattern with a
24 wildcard at the size field. Then this object can host request for font-
25 instances of any given size. If no exact match is found, the closest size
26 is chosen instead. If the font is scalable, the flag
27 lyxrc.use_scalable_fonts determines whether to allow scalable fonts to
33 FontInfo() { init(); }
36 explicit FontInfo(string const & pat)
37 : pattern(pat) { init(); }
39 /// Does any font match our pattern?
45 /// Is this font scalable?
51 /// Get existing pattern
52 string const & getPattern() const { return pattern; }
55 void setPattern(string const & pat);
57 /** Return full name of font close to this size.
58 If impossible, result is the empty string */
59 string const getFontname(int size);
61 /// Font pattern (with wildcard for size)
64 /// Available size list
65 boost::scoped_array<int> sizes;
67 /// Corresponding name list
68 boost::scoped_array<string> strings;
73 /// Did we query X about this font?
76 /// Is this font scalable?
79 /// Which index points to scalable font entry?
82 /// Initialize empty record
85 /// Ask X11 about this font pattern
88 /// Build newly sized font string
89 string const resize(string const &, int size) const;