Juergen Spitzmueller wrote:
> The result of the attached patch looks o.k. to me (also wrt bug 1804).
And this one also fixes the metrics of charstyle insets.
OK?
Jürgen
Index: insetcharstyle.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcharstyle.C,v
retrieving revision 1.29
diff -u -r1.29 insetcharstyle.C
--- insetcharstyle.C 24 Nov 2004 21:58:39 - 1.29
+++ insetcharstyle.C 20 Feb 2005 18:56:57 -
@@ -102,8 +102,13 @@
{
LyXFont tmpfont = mi.base.font;
getDrawFont(mi.base.font);
+ mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
InsetText::metrics(mi, dim);
mi.base.font = tmpfont;
+ dim.asc += TEXT_TO_INSET_OFFSET;
+ dim.des += TEXT_TO_INSET_OFFSET;
+ dim.wid += 2 * TEXT_TO_INSET_OFFSET;
+ mi.base.textwidth += 2 * TEXT_TO_INSET_OFFSET;
dim_ = dim;
if (has_label_)
dim_.des += ascent();
@@ -124,9 +129,9 @@
desc -= ascent();
pi.pain.line(x, y + desc - 4, x, y + desc, params_.labelfont.color());
- pi.pain.line(x, y + desc, x + dim_.wid - 2, y + desc,
+ pi.pain.line(x, y + desc, x + dim_.wid - 3, y + desc,
params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 2, y + desc, x + dim_.wid - 2, y + desc - 4,
+ pi.pain.line(x + dim_.wid - 3, y + desc, x + dim_.wid - 3, y + desc - 4,
params_.labelfont.color());
// the name of the charstyle. Can be toggled.
@@ -149,9 +154,9 @@
y -= ascent();
pi.pain.line(x, y + 4, x, y, params_.labelfont.color());
pi.pain.line(x + 4, y, x, y, params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 2, y + 4, x + dim_.wid - 2, y,
+ pi.pain.line(x + dim_.wid - 3, y + 4, x + dim_.wid - 3, y,
params_.labelfont.color());
- pi.pain.line(x + dim_.wid - 6, y, x + dim_.wid - 2, y,
+ pi.pain.line(x + dim_.wid - 7, y, x + dim_.wid - 3, y,
params_.labelfont.color());
}
}
Index: insettext.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.607
diff -u -r1.607 insettext.C
--- insettext.C 15 Feb 2005 19:53:42 - 1.607
+++ insettext.C 20 Feb 2005 18:56:58 -
@@ -212,7 +212,7 @@
void InsetText::drawFrame(Painter & pain, int x, int y) const
{
- int const w = text_.width() + border_;
+ int const w = text_.width() + 2 * border_;
int const a = text_.ascent() + border_;
int const h = a + text_.descent() + border_;
pain.rectangle(x, y - a, w, h, frameColor());