Functions | |
| int | maxAscent (LyXFont const &f) |
| return the maximum ascent of the font. More... | |
| int | maxDescent (LyXFont const &f) |
| return the maximum descent of the font. More... | |
| int | ascent (char c, LyXFont const &f) |
| return the ascent of the char in the font. More... | |
| int | descent (char c, LyXFont const &f) |
| return the descent of the char in the font. More... | |
| int | lbearing (char c, LyXFont const &f) |
| return the left bearing of the char in the font. More... | |
| int | rbearing (char c, LyXFont const &f) |
| return the right bearing of the char in the font. More... | |
| int | width (char const *s, size_t n, LyXFont const &f) |
| return the width of the string in the font. More... | |
| int | width (char c, LyXFont const &f) |
| return the width of the char in the font. More... | |
| int | width (string const &s, LyXFont const &f) |
| return the width of the string in the font. More... | |
| int | signedWidth (string const &s, LyXFont const &f) |
| FIXME ?? More... | |
| void | rectText (string const &str, LyXFont const &font, int &width, int &ascent, int &descent) |
| fill in width,ascent,descent with the values for the given string in the font. More... | |
| void | buttonText (string const &str, LyXFont const &font, int &width, int &ascent, int &descent) |
| fill in width,ascent,descent with the values for the given string in the font for a button. More... | |
| Encoding const * | fontencoding (LyXFont const &f) |
| int | smallcapswidth (char const *s, size_t ls, LyXFont const &f) |
The geometry is the standard typographical geometry, as follows :
--------------+------------------<maxAscent | | <-------> (right bearing) <-> (left bearing) char ascent>___ | ^ oooo | oooo origin>____ | oo oo | oo oo \| oo oo | oo oo --------------+---ooooo--|--oooo-<baseline | oo | char | oo oo | descent>______| oooo | <- width -> --------------+----------+-------<maxDescent
|
||||||||||||
|
return the ascent of the char in the font.
Definition at line 63 of file qfont_metrics.C. Referenced by Painter::buttonText, MathXYArrowInset::draw, MathNestInset::draw, MathFracInset::draw, MathBinomInset::draw, InsetSpecialChar::draw, InsetSpace::draw, InsetLatexAccent::draw, MathSqrtInset::drawT, MathFracInset::drawT, getFontID, mathed_char_ascent, mathed_char_dim, MathRootInset::metrics, MathMacroTemplate::metrics, MathDelimInset::metrics, MathBraceInset::metrics, InsetLatexAccent::metrics, RowPainter::paintFirst, RowPainter::paintLast, Painter::rectText, setAscentFractions, LyXText::setHeightOfRow, and LyXScreen::showCursor.
00064 {
00065 if (!lyx_gui::use_gui)
00066 return 1;
00067 QRect const & r = metrics(f).boundingRect(c);
00068 return -r.top();
00069 }
|
|
||||||||||||||||||||||||
|
fill in width,ascent,descent with the values for the given string in the font for a button.
Definition at line 187 of file qfont_metrics.C. Referenced by Painter::buttonText, InsetCollapsable::dimension_collapsed, getFontID, InsetCollapsable::height_collapsed, and ButtonRenderer::metrics.
|
|
||||||||||||
|
return the descent of the char in the font.
Definition at line 72 of file qfont_metrics.C. Referenced by Painter::buttonText, MathXYArrowInset::draw, MathRootInset::draw, MathFracInset::draw, MathBinomInset::draw, MathSqrtInset::drawT, MathFracInset::drawT, getFontID, mathed_char_descent, mathed_char_dim, MathRootInset::metrics, MathMacroTemplate::metrics, MathDelimInset::metrics, MathBraceInset::metrics, InsetLatexAccent::metrics, Painter::rectText, setAscentFractions, and LyXScreen::showCursor.
00073 {
00074 if (!lyx_gui::use_gui)
00075 return 1;
00076 QRect const & r = metrics(f).boundingRect(c);
00077 return r.bottom()+1;
00078 }
|
|
|
Definition at line 100 of file qfont_metrics.C.
00101 {
00102 Encoding const * encoding = f.language()->encoding();
00103 if (f.isSymbolFont())
00104 encoding = encodings.symbol_encoding();
00105 return encoding;
00106 }
|
|
||||||||||||
|
return the left bearing of the char in the font.
Definition at line 81 of file qfont_metrics.C. Referenced by getFontID, and InsetLatexAccent::lbearing.
00082 {
00083 if (!lyx_gui::use_gui)
00084 return 1;
00085 return metrics(f).leftBearing(c);
00086 }
|
|
|
return the maximum ascent of the font.
Definition at line 45 of file qfont_metrics.C. Referenced by Dimension::clear, InsetNewline::draw, InsetText::fitInsetCursor, InsetTabular::fitInsetCursor, getFontID, math_font_max_dim, mathed_string_dim, InsetSpecialChar::metrics, InsetSpace::metrics, InsetQuotes::metrics, InsetNewline::metrics, InsetLatexAccent::metrics, LyXText::setHeightOfRow, and LyXScreen::showCursor.
00046 {
00047 if (!lyx_gui::use_gui)
00048 return 1;
00049 return metrics(f).ascent();
00050 }
|
|
|
return the maximum descent of the font.
Definition at line 53 of file qfont_metrics.C. Referenced by Dimension::clear, InsetLatexAccent::draw, InsetText::fitInsetCursor, InsetTabular::fitInsetCursor, getFontID, math_font_max_dim, mathed_string_dim, InsetSpecialChar::metrics, InsetSpace::metrics, InsetQuotes::metrics, InsetNewline::metrics, InsetLatexAccent::metrics, LyXText::setHeightOfRow, and LyXScreen::showCursor.
00054 {
00055 if (!lyx_gui::use_gui)
00056 return 1;
00057 // We add 1 as the value returned by QT is different than X
00058 // See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
00059 return metrics(f).descent() + 1;
00060 }
|
|
||||||||||||
|
return the right bearing of the char in the font.
Definition at line 89 of file qfont_metrics.C. Referenced by getFontID, and InsetLatexAccent::rbearing.
00090 {
00091 if (!lyx_gui::use_gui)
00092 return 1;
00093 QFontMetrics const & m(metrics(f));
00094
00095 // Qt rbearing is from the right edge of the char's width().
00096 return (m.width(c) - m.rightBearing(c));
00097 }
|
|
||||||||||||||||||||||||
|
fill in width,ascent,descent with the values for the given string in the font.
Definition at line 171 of file qfont_metrics.C. Referenced by getFontID, ButtonRenderer::metrics, RowPainter::paintAppendixStart, RowPainter::paintLengthMarker, RowPainter::paintPageBreak, and Painter::rectText.
|
|
||||||||||||
|
FIXME ??
Definition at line 162 of file qfont_metrics.C. Referenced by getFontID, LyXText::leftMargin, and LyXText::rightMargin.
|
|
||||||||||||||||
|
Definition at line 109 of file qfont_metrics.C.
00110 {
00111 if (!lyx_gui::use_gui)
00112 return 1;
00113 // handle small caps ourselves ...
00114
00115 LyXFont smallfont(f);
00116 smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
00117
00118 QFontMetrics const & qm = fontloader.metrics(f);
00119 QFontMetrics const & qsmallm = fontloader.metrics(smallfont);
00120
00121 Encoding const * encoding(fontencoding(f));
00122
00123 int w = 0;
00124
00125 for (size_t i = 0; i < ls; ++i) {
00126 QChar const c = QChar(encoding->ucs(s[i]));
00127 QChar const uc = c.upper();
00128 if (c != uc)
00129 w += qsmallm.width(uc);
00130 else
00131 w += qm.width(c);
00132 }
00133 return w;
00134 }
|
|
||||||||||||
|
return the width of the string in the font.
Definition at line 63 of file font_metrics.h.
00063 {
00064 if (s.empty()) return 0;
00065 return width(s.data(), s.length(), f);
00066 }
|
|
||||||||||||
|
return the width of the char in the font.
Definition at line 59 of file font_metrics.h.
00059 {
00060 return width(&c, 1, f);
00061 }
|
|
||||||||||||||||
1.2.14 written by Dimitri van Heesch,
© 1997-2002