2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1997 Asger Alstrup
10 * ====================================================== */
21 #include <boost/scoped_array.hpp>
23 /** This class manages a font.
24 The idea is to create a FontInfo object with a font name pattern with a
25 wildcard at the size field. Then this object can host request for font-
26 instances of any given size. If no exact match is found, the closest size
27 is chosen instead. If the font is scalable, the flag
28 lyxrc.use_scalable_fonts determines whether to allow scalable fonts to
34 FontInfo() { init(); }
37 explicit FontInfo(string const & pat)
38 : pattern(pat) { init(); }
40 /// Does any font match our pattern?
46 /// Is this font scalable?
52 /// Get existing pattern
53 string const & getPattern() const { return pattern; }
56 void setPattern(string const & pat);
58 /** Return full name of font close to this size.
59 If impossible, result is the empty string */
60 string const getFontname(int size);
62 /// Font pattern (with wildcard for size)
65 /// Available size list
66 boost::scoped_array<int> sizes;
68 /// Corresponding name list
69 boost::scoped_array<string> strings;
74 /// Did we query X about this font?
77 /// Is this font scalable?
80 /// Which index points to scalable font entry?
83 /// Initialize empty record
86 /// Ask X11 about this font pattern
89 /// Build newly sized font string
90 string const resize(string const &, int size) const;