>>>>> "Bennett" ==   <[EMAIL PROTECTED]> writes:

>> Wow! It is actually very difficult to guess where each accent comes
>> from... I guess it is some bug in the handling of character height,
>> but I am not sure. Bennett, do you see this bug too?

Bennett> I do -- both in 1.3.7 and 1.4.0. (And your guess about
Bennett> character height seems right from what I see.)

Bennett> Running lyx with -dbg fonts doesn't reveal anything: all
Bennett> fonts are properly recognized. Moreover, even in Stefano's
Bennett> document, entering accents manually seems to work just fine.

This is because the accents you enter manually are regular 8bit
characters. The ones from Stefano's document are tex-type accents like
\'{e} for é. The code that is broken on LyX/Mac is the drawing code
for these things.

Bennett> Perhaps this will help track it down: taking just one word
Bennett> ("générale") from the buggy text and pasting it at the end of
Bennett> the document produces the weird accents -- located one line
Bennett> above where they should be. 

OK, so this seems to be a height problem.

Bennett> Entering new text in front of this word in the same paragraph
Bennett> moves "generale" forward in the line -- without moving the
Bennett> accents; 

This may be just a drawing glitch. Isn't there another accent
appearing on the upper line when you do this?

Bennett> similarly, deleting text (with <Delete>) in front of
Bennett> "générale" moves just "generale" backwards in the line,
Bennett> leaving the accents in place. However, deleting a word at a
Bennett> time or deleting selected text in front of "générale" moves
Bennett> the whole thing -- accents and all. (Is that clear?)

Is it with 1.3.X or 1.4.x?

[later]

Bennett, can you try the attached patch (against 1.4.0cvs)? If it does
not work, could you show me what is the output on console? Here I get
something like

[...]
accent=` ascent=15 descent=-12 height=3
char=e ascent=10 descent=0 height=10
[...]

The first line shows a negative descent, meaning that the accent is a
very thin character that lives over the baseline. I suspect that it is
not the case on LyX/Mac, and the patch tries to catter for it.

JMarc

Index: src/insets/insetlatexaccent.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetlatexaccent.C,v
retrieving revision 1.96
diff -u -p -r1.96 insetlatexaccent.C
--- src/insets/insetlatexaccent.C	17 May 2005 11:11:45 -0000	1.96
+++ src/insets/insetlatexaccent.C	31 Jul 2005 17:32:17 -0000
@@ -335,10 +335,22 @@ void InsetLatexAccent::drawAccent(Painte
 	char accent) const
 {
 	LyXFont const & font = pi.base.font;
+	lyxerr << "accent=" << accent 
+	       << " ascent=" << font_metrics::ascent(accent, font) 
+	       << " descent=" << font_metrics::descent(accent, font) 
+	       << " height=" << font_metrics::height(accent, font) 
+	       << std::endl;
+	lyxerr << "char=" << ic 
+	       << " ascent=" << font_metrics::ascent(ic, font) 
+	       << " descent=" << font_metrics::descent(ic, font) 
+	       << " height=" << font_metrics::height(ic, font) 
+	       << std::endl;
 	x -= font_metrics::center(accent, font);
-	y -= font_metrics::ascent(ic, font);
-	y -= font_metrics::descent(accent, font);
-	y -= font_metrics::height(accent, font) / 2;
+	if (font_metrics::descent(accent, font) < 0) {
+		y -= font_metrics::ascent(ic, font);
+		y -= font_metrics::descent(accent, font);
+		y -= font_metrics::height(accent, font) / 2;
+	}
 	pi.pain.text(x, y, accent, font);
 }
 

Reply via email to