X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FFontInfo.h;h=13e34708979c85b30a9b47b3414cd65288c12e4e;hb=27652900a60fd078f161ce866ddaed21dba21eff;hp=338733eea23b0e92ae24f5762c93fac95a725034;hpb=27de1486ca34aaad446adb798d71a77d6f6304da;p=lyx.git diff --git a/src/FontInfo.h b/src/FontInfo.h index 338733eea2..13e3470897 100644 --- a/src/FontInfo.h +++ b/src/FontInfo.h @@ -4,13 +4,13 @@ * * LyX, The Document Processor * - * Copyright (C) 1997 Asger Alstrup + * Copyright 1997 Asger Alstrup * and the LyX Team. * - *======================================================*/ + * ====================================================== */ -#ifndef _FONTINFO_H_ -#define _FONTINFO_H_ +#ifndef FONTINFO_H +#define FONTINFO_H #ifdef __GNUG__ #pragma interface @@ -18,23 +18,24 @@ #include "LString.h" +#include + /** This class manages a font. -The idea is to create a FontInfo object with a font name pattern with a -wildcard at the size field. Then this object can host request for font- -instances of any given size. If no exact match is found, the closest size -is chosen instead. If the font is scalable, the flag lyxrc->use_scalable_fonts -determines whether to allow scalable fonts to give an exact match. */ + The idea is to create a FontInfo object with a font name pattern with a + wildcard at the size field. Then this object can host request for font- + instances of any given size. If no exact match is found, the closest size + is chosen instead. If the font is scalable, the flag + lyxrc.use_scalable_fonts determines whether to allow scalable fonts to + give an exact match. +*/ class FontInfo { public: /// FontInfo() { init(); } /// - FontInfo(LString const & pat) - : pattern(pat) { init(); } - - /// Destructor - ~FontInfo() { release(); } + explicit FontInfo(string const & pat) + : pattern(pat) { init(); } /// Does any font match our pattern? bool exist() { @@ -49,23 +50,23 @@ public: } /// Get existing pattern - LString getPattern() const { return pattern; } + string const & getPattern() const { return pattern; } /// Set new pattern - void setPattern(LString const & pat); + void setPattern(string const & pat); /** Return full name of font close to this size. If impossible, result is the empty string */ - LString getFontname(int size); + string const getFontname(int size); private: /// Font pattern (with wildcard for size) - LString pattern; + string pattern; /// Available size list - int * sizes; + boost::scoped_array sizes; /// Corresponding name list - LString * strings; + boost::scoped_array strings; /// Number of matches int matches; @@ -80,23 +81,12 @@ private: int scaleindex; /// Initialize empty record - void init() - { - sizes = 0; - strings = 0; - matches = 0; - queried = false; - scalable = false; - scaleindex = -1; - } - - /// Release allocated stuff - void release(); + void init(); /// Ask X11 about this font pattern void query(); /// Build newly sized font string - LString resize(LString const &, int size) const; + string const resize(string const &, int size) const; }; #endif