2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1997 Asger Alstrup
10 * ====================================================== */
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(); }
39 ~FontInfo() { release(); }
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
69 /// Corresponding name list
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 /// Release allocated stuff
90 /// Ask X11 about this font pattern
93 /// Build newly sized font string
94 string const resize(string const &, int size) const;