mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
Fix 'lyx -e' with the QT frontend.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6113 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
84f1457439
commit
c0cebba1d7
@ -1,3 +1,8 @@
|
|||||||
|
2003-02-12 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
|
* qfont_metrics.C: Add checks for lyxrc.use_gui.
|
||||||
|
This fixes 'lyx -e' with the QT frontend.
|
||||||
|
|
||||||
2003-02-10 João Luis Meloni Assirati <assirati@fma.if.usp.br>
|
2003-02-10 João Luis Meloni Assirati <assirati@fma.if.usp.br>
|
||||||
|
|
||||||
* ui/QMathMatrixDialogBase.ui: Fix horizontal alignment tooltip
|
* ui/QMathMatrixDialogBase.ui: Fix horizontal alignment tooltip
|
||||||
|
@ -35,6 +35,8 @@ QFontMetrics const & metrics(LyXFont const & f)
|
|||||||
|
|
||||||
int charwidth(Uchar val, LyXFont const & f)
|
int charwidth(Uchar val, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
return fontloader.charwidth(f, val);
|
return fontloader.charwidth(f, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +47,16 @@ namespace font_metrics {
|
|||||||
|
|
||||||
int maxAscent(LyXFont const & f)
|
int maxAscent(LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
return metrics(f).ascent();
|
return metrics(f).ascent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int maxDescent(LyXFont const & f)
|
int maxDescent(LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
// We add 1 as the value returned by QT is different than X
|
// We add 1 as the value returned by QT is different than X
|
||||||
// See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
|
// See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
|
||||||
return metrics(f).descent() + 1;
|
return metrics(f).descent() + 1;
|
||||||
@ -59,6 +65,8 @@ int maxDescent(LyXFont const & f)
|
|||||||
|
|
||||||
int ascent(char c, LyXFont const & f)
|
int ascent(char c, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
QRect const & r = metrics(f).boundingRect(c);
|
QRect const & r = metrics(f).boundingRect(c);
|
||||||
return -r.top();
|
return -r.top();
|
||||||
}
|
}
|
||||||
@ -66,6 +74,8 @@ int ascent(char c, LyXFont const & f)
|
|||||||
|
|
||||||
int descent(char c, LyXFont const & f)
|
int descent(char c, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
QRect const & r = metrics(f).boundingRect(c);
|
QRect const & r = metrics(f).boundingRect(c);
|
||||||
return r.bottom()+1;
|
return r.bottom()+1;
|
||||||
}
|
}
|
||||||
@ -73,12 +83,16 @@ int descent(char c, LyXFont const & f)
|
|||||||
|
|
||||||
int lbearing(char c, LyXFont const & f)
|
int lbearing(char c, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
return metrics(f).leftBearing(c);
|
return metrics(f).leftBearing(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int rbearing(char c, LyXFont const & f)
|
int rbearing(char c, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
QFontMetrics const & m(metrics(f));
|
QFontMetrics const & m(metrics(f));
|
||||||
|
|
||||||
// Qt rbearing is from the right edge of the char's width().
|
// Qt rbearing is from the right edge of the char's width().
|
||||||
@ -97,6 +111,8 @@ Encoding const * fontencoding(LyXFont const & f)
|
|||||||
|
|
||||||
int smallcapswidth(char const * s, size_t ls, LyXFont const & f)
|
int smallcapswidth(char const * s, size_t ls, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return 1;
|
||||||
// handle small caps ourselves ...
|
// handle small caps ourselves ...
|
||||||
|
|
||||||
LyXFont smallfont(f);
|
LyXFont smallfont(f);
|
||||||
@ -123,6 +139,9 @@ int smallcapswidth(char const * s, size_t ls, LyXFont const & f)
|
|||||||
|
|
||||||
int width(char const * s, size_t ls, LyXFont const & f)
|
int width(char const * s, size_t ls, LyXFont const & f)
|
||||||
{
|
{
|
||||||
|
if (!lyxrc.use_gui)
|
||||||
|
return ls;
|
||||||
|
|
||||||
if (f.realShape() == LyXFont::SMALLCAPS_SHAPE) {
|
if (f.realShape() == LyXFont::SMALLCAPS_SHAPE) {
|
||||||
return smallcapswidth(s, ls, f);
|
return smallcapswidth(s, ls, f);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user