- return count;
-}
-
-
-LColor::color LyXFont::realColor() const
-{
- if (latex() == ON)
- return LColor::latex;
- if (color() == LColor::none)
- return LColor::foreground;
- return color();
-}
-
-
-// Convert logical attributes to concrete shape attribute
-LyXFont::FONT_SHAPE LyXFont::realShape() const
-{
- register FONT_SHAPE s = shape();
-
- if (emph() == ON) {
- if (s == UP_SHAPE)
- s = ITALIC_SHAPE;
- else
- s = UP_SHAPE;
- }
- if (noun() == ON)
- s = SMALLCAPS_SHAPE;
- return s;
-}
-
-
-XFontStruct * LyXFont::getXFontstruct() const
-{
- return fontloader.load(family(), series(), realShape(), size());
-}
-
-
-int LyXFont::maxAscent() const
-{
- return getXFontstruct()->ascent;
-}
-
-
-int LyXFont::maxDescent() const
-{
- return getXFontstruct()->descent;
-}
-
-
-int LyXFont::ascent(char c) const
-{
- XFontStruct * finfo = getXFontstruct();
- unsigned int uc = static_cast<unsigned char>(c);
- if (finfo->per_char
- && uc >= finfo->min_char_or_byte2
- && uc <= finfo->max_char_or_byte2)
- return finfo->per_char[uc - finfo->min_char_or_byte2].ascent;
- else
- return finfo->ascent;
-}
-
-
-int LyXFont::descent(char c) const
-{
- XFontStruct * finfo = getXFontstruct();
- unsigned int uc = static_cast<unsigned char>(c);
- if (finfo->per_char
- && uc >= finfo->min_char_or_byte2
- && uc <= finfo->max_char_or_byte2)
- return finfo->per_char[uc - finfo->min_char_or_byte2].descent;
- else
- return finfo->descent;
-}
-
-
-int LyXFont::lbearing(char c) const
-{
- XFontStruct * finfo = getXFontstruct();
- unsigned int uc = static_cast<unsigned char>(c);
- if (finfo->per_char
- && uc >= finfo->min_char_or_byte2
- && uc <= finfo->max_char_or_byte2)
- return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing;
- else
- return 0;
-}
-
-
-int LyXFont::rbearing(char c) const
-{
- XFontStruct * finfo = getXFontstruct();
- unsigned int uc = static_cast<unsigned char>(c);
- if (finfo->per_char
- && uc >= finfo->min_char_or_byte2
- && uc <= finfo->max_char_or_byte2)
- return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing;
- else
- return width(c);
-}
-
-
-// Specialized after profiling. (Asger)
-int LyXFont::width(char c) const
-{
- if (realShape() != LyXFont::SMALLCAPS_SHAPE){
- return lyxrc.use_gui ? XTextWidth(getXFontstruct(), &c, 1) : 1;
- } else {
- return textWidth(&c, 1);