// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich *
*======================================================*/ #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 inherited from the layout. In the case of layout fonts, the attribute is inherited from the default font. The value IGNORE_* is used with LyXFont::update() when the attribute should not be changed.
*/ 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. */ /* * When toggleall=true, all properties that matches the font in use * will have the effect that the properties is reset to the * default. If we have a text that is TYPEWRITER_FAMILY, and is * update()'ed with TYPEWRITER_FAMILY, the operation will be as if * a INHERIT_FAMILY was asked for. This is necessary for the * toggle-user-defined-style button on the toolbar.
*/ 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. Writes to file, the head of the LaTeX needed to change to this font. Returns number of chars written. Base is the font state active now.
*/ int latexWriteStartChanges(FILE *, LyXFont const & base) const;
/** Writes to LString, the head of the LaTeX needed to change to this font. Returns number of chars written. Base is the font state active now.
*/ int latexWriteStartChanges(LString &, LyXFont const & base) const;
/** Writes the tail of the LaTeX needd to change to this font. Returns number of chars written. Base is the font state we want to achieve.
*/ int latexWriteEndChanges(FILE *, LyXFont const & base) const;
/** Writes tha tail of the LaTeX needed to chagne to this font. Returns number of chars written. Base is the font state we want to achieve.
*/ 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.0.1Bemerkung:
(vorverarbeitet)
¤
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.