<< font.pointSizeFloat() << endl;
// Is this an exact match?
- if (font.exactMatch()) {
+ if (font.exactMatch())
lyxerr[Debug::FONT] << "This font is an exact match" << endl;
- } else {
+ else
lyxerr[Debug::FONT] << "This font is NOT an exact match"
<< endl;
- }
lyxerr[Debug::FONT] << "XFLD: " << font.rawName() << endl;
// Starting with version 3.1.0, Qt/X11 does its own caching of
// character width, so it is not necessary to provide ours.
#if defined (USE_LYX_FONTCACHE)
-#error xxx
FontInfo::WidthCache::const_iterator cit = widthcache.find(val);
if (cit != widthcache.end())
return cit->second;
public:
FontInfo(LyXFont const & f);
- /// return pixel width for the given unicode char
+ /// Return pixel width for the given unicode char
int width(Uchar val) const;
- /// the font instance
+ /// The font instance
QFont font;
- /// metrics on the font
+ /// Metrics on the font
QFontMetrics metrics;
#if defined(USE_LYX_FONTCACHE)
typedef std::map<Uchar, int> WidthCache;
- /// cache of char widths
+ /// Cache of char widths
WidthCache widthcache;
#endif
};
+/// Hold info about a particular font
class FontLoader {
public:
- /// hold info about a particular font
///
FontLoader();
- /// update fonts after zoom, dpi, font names, or norm change
+ /// Update fonts after zoom, dpi, font names, or norm change
void update();
- /// do we have anything matching?
+ /// Do we have anything matching?
bool available(LyXFont const & f);
- /// get the QFont for this LyXFont
+ /// Get the QFont for this LyXFont
QFont const & get(LyXFont const & f) {
return fontinfo(f).font;
}
- /// get the QFont metrics for this LyXFont
+ /// Get the QFont metrics for this LyXFont
QFontMetrics const & metrics(LyXFont const & f) {
return fontinfo(f).metrics;
}
/// Called the first time when available() can't load a symbol font
static void addToFontPath();
- /// get font info (font + metrics) for the given LyX font. Does not fail.
+ /// Get font info (font + metrics) for the given LyX font.
FontInfo & fontinfo(LyXFont const & f) {
FontInfo * & fi =
fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
row_type rs, re;
col_type cs, ce;
getSelection(cur, rs, re, cs, ce);
- for (row_type i = rs; i <= re; ++i)
+ for (row_type i = rs; i <= re; ++i) {
for (col_type j = cs; j <= ce; ++j) {
// cursor follows cell:
cur.idx() = tabular.getCellNumber(i, j);
// select this cell only:
cur.pos() = 0;
- cur.resetAnchor();
+ cur.resetAnchor();
cur.pos() = cur.top().lastpos();
- cur.setCursor(cur);
- cur.setSelection();
+ cur.setCursor(cur);
+ cur.setSelection();
cell(cur.idx())->dispatch(cur, cmd);
}
+ }
// Restore original selection
cur.idx() = tabular.getCellNumber(rs, cs);
cur.pos() = 0;
}
-Language const * LyXFont::language() const
-{
- return lang;
-}
-
-
bool LyXFont::isRightToLeft() const
{
return lang->RightToLeft();
}
-// 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;
-}
-
-
ostream & operator<<(ostream & os, LyXFont::FONT_MISC_STATE fms)
{
return os << int(fms);
///
LColor_color color() const;
///
- Language const * language() const;
+ Language const * language() const { return lang; }
///
bool isRightToLeft() const;
///
std::ostream & operator<<(std::ostream & os, LyXFont const & font);
/// Converts logical attributes to concrete shape attribute
- LyXFont::FONT_SHAPE realShape() const;
+ // Try hard to inline this as it shows up with 4.6 % in the profiler.
+ LyXFont::FONT_SHAPE realShape() const {
+ if (bits.noun == ON)
+ return SMALLCAPS_SHAPE;
+ if (bits.emph == ON)
+ return (bits.shape == UP_SHAPE) ? ITALIC_SHAPE : UP_SHAPE;
+ return bits.shape;
+ }
+
/** Compaq cxx 6.5 requires that the definition be public so that
it can compile operator==()
LyXFont const & font);
///
void insertChar(lyx::pos_type pos, value_type c,
- Change change = Change(Change::INSERTED));
+ Change change = Change::INSERTED);
///
void insertChar(lyx::pos_type pos, value_type c,
- LyXFont const &, Change change = Change(Change::INSERTED));
- ///
- bool checkInsertChar(LyXFont &);
+ LyXFont const &, Change change = Change::INSERTED);
///
void insertInset(lyx::pos_type pos, InsetBase * inset,
- Change change = Change(Change::INSERTED));
+ Change change = Change::INSERTED);
///
void insertInset(lyx::pos_type pos, InsetBase * inset,
- LyXFont const &, Change change = Change(Change::INSERTED));
+ LyXFont const &, Change change = Change::INSERTED);
///
bool insetAllowed(InsetBase_code code);
///
///
bool isHfill(lyx::pos_type pos) const;
/// hinted by profiler
- bool isInset(lyx::pos_type pos) const { return getChar(pos) == static_cast<value_type>(META_INSET); }
+ bool isInset(lyx::pos_type pos) const {
+ return getChar(pos) == static_cast<value_type>(META_INSET);
+ }
///
bool isNewline(lyx::pos_type pos) const;
///
unsigned int height() const { return dim_.height(); }
/// total width of paragraph, may differ from workwidth
unsigned int width() const { return dim_.width(); }
+ /// ascend of paragraph above baseline
unsigned int ascent() const { return dim_.ascent(); }
+ /// descend of paragraph below baseline
unsigned int descent() const { return dim_.descent(); }
/// LyXText updates the rows using this access point
RowList & rows() { return rows_; }