// -*- C++ -*- /* This file is part of *====================================================== * *LyX,TheDocumentProcessor * *Copyright(C)1995MatthiasEttrich *
*======================================================*/ #ifndef _LYXFONT_H #define _LYXFONT_H
#ifdef __GNUG__ #pragma interface #endif
#include FORMS_H_LOCATION #include"LString.h"
// It might happen that locale.h defines ON and OFF. This is not good // for us, since we use these names below. But of course this is due // to some old compilers. Than is broken when it comes to C++ scoping. #include"gettext.h"// so that we are sure tht it won't be included // later. #ifdef ON #undef ON #endif
#ifdef OFF #undef OFF #endif
class LyXLex;
/// class LyXFont { public: /** The value INHERIT_* means that the font attribute is inheritedfromthelayout.Inthecaseoflayoutfonts,the attributeisinheritedfromthedefaultfont. ThevalueIGNORE_*isusedwithLyXFont::update()whenthe attributeshouldnotbechanged.
*/ enum FONT_FAMILY { ///
ROMAN_FAMILY, // fontstruct rely on this to be 0 ///
SANS_FAMILY, ///
TYPEWRITER_FAMILY, ///
SYMBOL_FAMILY, ///
INHERIT_FAMILY, ///
IGNORE_FAMILY
};
/// enum FONT_SERIES { ///
MEDIUM_SERIES, // fontstruct rely on this to be 0 ///
BOLD_SERIES, ///
INHERIT_SERIES, ///
IGNORE_SERIES
};
/// enum FONT_SHAPE { ///
UP_SHAPE, // fontstruct rely on this to be 0 ///
ITALIC_SHAPE, ///
SLANTED_SHAPE, ///
SMALLCAPS_SHAPE, ///
INHERIT_SHAPE, ///
IGNORE_SHAPE
};
/// Set family after LyX text format
LyXFont & setLyXFamily(LString const &);
/// Set series after LyX text format
LyXFont & setLyXSeries(LString const &);
/// Set shape after LyX text format
LyXFont & setLyXShape(LString const &);
/// Set size after LyX text format
LyXFont & setLyXSize(LString const &);
/// Returns misc flag after LyX text format
LyXFont::FONT_MISC_STATE setLyXMisc(LString const &);
/// Sets color after LyX text format
LyXFont & setLyXColor(LString const &);
/// Sets size after GUI name
LyXFont & setGUISize(LString const &);
/// Returns size of font in LaTeX text notation
LString latexSize() const;
/** Updates font settings according to request. If an
attribute is IGNORE, the attribute is left as it is. */ /* *Whentoggleall=true,allpropertiesthatmatchesthefontinuse *willhavetheeffectthatthepropertiesisresettothe *default.IfwehaveatextthatisTYPEWRITER_FAMILY,andis *update()'edwithTYPEWRITER_FAMILY,theoperationwillbeasif *aINHERIT_FAMILYwasaskedfor.Thisisnecessaryforthe *toggle-user-defined-stylebuttononthetoolbar.
*/ void update(LyXFont const & newfont, bool toggleall=false);
/** Reduce font to fall back to template where possible.
Equal fields are reduced to INHERIT */ void reduce(LyXFont const & tmplt);
/// Realize font from a template (INHERIT are realized)
LyXFont & realize(LyXFont const & tmplt);
/// Is a given font fully resolved? bool resolved() const;
/// Read a font specification from LyXLex. Used for layout files.
LyXFont & lyxRead(LyXLex&);
/// Writes the changes from this font to orgfont in .lyx format in file void lyxWriteChanges(LyXFont const & orgfont, FILE *) const;
/** Writes the head of the LaTeX needed to change to this font. Writestofile,theheadoftheLaTeXneededtochangetothisfont. Returnsnumberofcharswritten.Baseisthefontstateactivenow.
*/ int latexWriteStartChanges(FILE *, LyXFont const & base) const;
/** Writes to LString, the head of the LaTeX needed to change tothisfont.Returnsnumberofcharswritten.Baseisthe fontstateactivenow.
*/ int latexWriteStartChanges(LString &, LyXFont const & base) const;
/** Writes the tail of the LaTeX needd to change to this font. Returnsnumberofcharswritten.Baseisthefontstatewewant toachieve.
*/ int latexWriteEndChanges(FILE *, LyXFont const & base) const;
/** Writes tha tail of the LaTeX needed to chagne to this font. Returnsnumberofcharswritten.Baseisthefontstatewewant toachieve.
*/ int latexWriteEndChanges(LString &, LyXFont const & base) const;
/// Build GUI description of font state
LString stateText() const;
/// int maxAscent() const;
/// int maxDescent() const;
/// int ascent(char c) const;
/// int descent(char c) const;
/// int width(char c) const;
/// int textWidth(charconst *s, int n) const;
/// int stringWidth(LString const & s) const;
/// int signedStringWidth(LString const & s) const;
/// Draws text and returns width of text int drawText(charconst*, int n, Pixmap, int baseline, int x) const;
/// int drawString(LString const &, Pixmap pm, int baseline, int x) const;
// You don't have to understand the stuff below :-) // It works, and it's bloody fast. (Asger) inline LyXFont::FONT_FAMILY LyXFont::family() const
{ return LyXFont::FONT_FAMILY((bits >> Fam_Pos) & Fam_Mask);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.