From 76feb8641e5870c73b649a6e986b5d8d8936a61f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 11 Dec 2010 17:20:11 +0200 Subject: [PATCH] Fix bug #7398 with truncated glyphs in tooltip display on w32. w32fns.c (Fx_show_tip): Call try_window with last argument TRY_WINDOW_IGNORE_FONTS_CHANGE. Delete the TODO ifdef: problem solved. Round up the tip height to an integral multiple of the frame's line height. Add FRAME_COLUMN_WIDTH to the tip width. --- src/ChangeLog | 6 ++++++ src/w32fns.c | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f2604606982..249e77d3aa3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2010-12-11 Eli Zaretskii + * w32fns.c (Fx_show_tip): Call try_window with last argument + TRY_WINDOW_IGNORE_FONTS_CHANGE. Delete the TODO ifdef: problem + solved. Round up the tip height to an integral multiple of the + frame's line height. Add FRAME_COLUMN_WIDTH to the tip width. + (Bug#7398) + * xdisp.c (string_pos_nchars_ahead, c_string_pos) (face_before_or_after_it_pos, next_element_from_string) (next_element_from_c_string, produce_stretch_glyph): Remove unused diff --git a/src/w32fns.c b/src/w32fns.c index 61dd8b9ee1f..39fa6918e62 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5892,7 +5892,7 @@ Text larger than the specified size is clipped. */) clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); - try_window (FRAME_ROOT_WINDOW (f), pos, 0); + try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE); /* Compute width and height of the tooltip. */ width = height = 0; @@ -5909,9 +5909,7 @@ Text larger than the specified size is clipped. */) /* Let the row go over the full width of the frame. */ row->full_width_p = 1; -#ifdef TODO /* Investigate why some fonts need more width than is - calculated for some tooltips. */ - /* There's a glyph at the end of rows that is use to place + /* There's a glyph at the end of rows that is used to place the cursor there. Don't include the width of this glyph. */ if (row->used[TEXT_AREA]) { @@ -5919,15 +5917,16 @@ Text larger than the specified size is clipped. */) row_width = row->pixel_width - last->pixel_width; } else -#endif row_width = row->pixel_width; - /* TODO: find why tips do not draw along baseline as instructed. */ height += row->height; width = max (width, row_width); } - /* Add the frame's internal border to the width and height the X + /* Round up the height to an integral multiple of FRAME_LINE_HEIGHT. */ + if (height % FRAME_LINE_HEIGHT (f) != 0) + height += FRAME_LINE_HEIGHT (f) - height % FRAME_LINE_HEIGHT (f); + /* Add the frame's internal border to the width and height the w32 window should have. */ height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); @@ -5946,11 +5945,13 @@ Text larger than the specified size is clipped. */) FRAME_EXTERNAL_MENU_BAR (f)); /* Position and size tooltip, and put it in the topmost group. - The add-on of 3 to the 5th argument is a kludge: without it, - some fonts cause the last character of the tip to be truncated, - for some obscure reason. */ + The add-on of FRAME_COLUMN_WIDTH to the 5th argument is a + peculiarity of w32 display: without it, some fonts cause the + last character of the tip to be truncated or wrapped around to + the next line. */ SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, - root_x, root_y, rect.right - rect.left + 3, + root_x, root_y, + rect.right - rect.left + FRAME_COLUMN_WIDTH (f), rect.bottom - rect.top, SWP_NOACTIVATE); /* Ensure tooltip is on top of other topmost windows (eg menus). */ -- 2.39.2