Commit 9ef2e2cf authored by Jason Rumney's avatar Jason Rumney

Format and doc changes to bring closer to xterm.c.

(w32_char_font_type): New enum.
(Qw32_charset_*, w32_codepage_for_font): Moved to w32fns.c.
(w32_per_char_metric): Use w32_char_font_type instead of unicode_p.
(w32_encode_char): New function.
(x_encode_char): Removed.
(x_get_glyph_and_face_encoding): Use w32_encode_char in place of
x_encode_char and w32_font_is_double_byte.
(x_produce_image_glyph): Use image_ascent.
(x_produce_glyphs): Use new version of w32_per_char_metric and
handle NULL return value. Allow extra line spacing.
(W32_TEXTOUT): Distinguish between Unicode and DBCS text.
(w32_get_glyph_overhangs): Remove unicode_p param. Use
w32_font_type member of glyph instead.
(x_draw_glyph_string): Draw underline and strike-out for BDF fonts.
(fast_find_position): Make sure not to consider rows not visible
in the window.
(w32_read_socket) [WM_MENUSELECT]: Cannot call
w32_menu_display_help with input blocked, as it can abort.
(x_display_and_set_cursor): Choose cursor depending
on buffer-local value of cursor_type.
(x_draw_bar_cursor): Add parameter WIDTH.
parent 6915ded0
/* Implementation of GUI terminal on the Microsoft W32 API.
Copyright (C) 1989, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU Emacs.
......@@ -14,8 +15,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
......@@ -78,6 +79,14 @@ enum bitmap_type
ZV_LINE_BITMAP
};
enum w32_char_font_type
{
UNKNOWN_FONT,
ANSI_FONT,
UNICODE_FONT,
BDF_FONT
};
/* Bitmaps are all unsigned short, as Windows requires bitmap data to
be Word aligned. For some reason they are horizontally reflected
compared to how they appear on X, so changes in xterm.c should be
......@@ -168,14 +177,14 @@ static int any_help_event_p;
int x_stretch_cursor_p;
#define CP_DEFAULT 1004
extern unsigned int msh_mousewheel;
extern void free_frame_menubar ();
extern void w32_menu_display_help (HMENU menu, UINT menu_item, UINT flags);
extern int w32_codepage_for_font (char *fontname);
extern Lisp_Object Vwindow_system;
#define x_any_window_to_frame x_window_to_frame
......@@ -252,6 +261,7 @@ int last_scroll_bar_drag_pos;
/* Mouse movement. */
/* Where the mouse was last time we reported a mouse event. */
FRAME_PTR last_mouse_frame;
static RECT last_mouse_glyph;
static Lisp_Object last_mouse_press_frame;
......@@ -277,21 +287,21 @@ Lisp_Object Vw32_recognize_altgr;
If the last motion event didn't occur in a scroll bar, we set this
to Qnil, to tell w32_mouse_position to return an ordinary motion event. */
Lisp_Object last_mouse_scroll_bar;
int last_mouse_scroll_bar_pos;
static Lisp_Object last_mouse_scroll_bar;
static int last_mouse_scroll_bar_pos;
/* This is a hack. We would really prefer that w32_mouse_position would
return the time associated with the position it returns, but there
doesn't seem to be any way to wrest the timestamp from the server
doesn't seem to be any way to wrest the time-stamp from the server
along with the position query. So, we just keep track of the time
of the last movement we received, and return that in hopes that
it's somewhat accurate. */
Time last_mouse_movement_time;
/* Associative list linking character set strings to Windows codepages. */
Lisp_Object Vw32_charset_info_alist;
static Time last_mouse_movement_time;
/* Incremented by w32_read_socket whenever it really tries to read
events. */
/* Incremented by w32_read_socket whenever it really tries to read events. */
#ifdef __STDC__
static int volatile input_signal_count;
#else
......@@ -305,6 +315,7 @@ extern Lisp_Object Qface, Qmouse_face;
extern int errno;
/* A mask of extra modifier bits to put into every keyboard char. */
extern int extra_keyboard_modifiers;
/* Enumeration for overriding/changing the face to use for drawing
......@@ -369,7 +380,7 @@ static void w32_new_focus_frame P_ ((struct w32_display_info *,
static void w32_frame_rehighlight P_ ((struct frame *));
static void x_frame_rehighlight P_ ((struct w32_display_info *));
static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *));
static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int));
static int w32_intersect_rectangles P_ ((RECT *, RECT *, RECT *));
static void expose_frame P_ ((struct frame *, int, int, int, int));
static void expose_window_tree P_ ((struct window *, RECT *));
......@@ -394,36 +405,15 @@ static void w32_clip_to_row P_ ((struct window *, struct glyph_row *,
static Lisp_Object Qvendor_specific_keysyms;
Lisp_Object Qw32_charset_ansi;
Lisp_Object Qw32_charset_default;
Lisp_Object Qw32_charset_symbol;
Lisp_Object Qw32_charset_shiftjis;
Lisp_Object Qw32_charset_hangul;
Lisp_Object Qw32_charset_gb2312;
Lisp_Object Qw32_charset_chinesebig5;
Lisp_Object Qw32_charset_oem;
#ifdef JOHAB_CHARSET
Lisp_Object Qw32_charset_easteurope;
Lisp_Object Qw32_charset_turkish;
Lisp_Object Qw32_charset_baltic;
Lisp_Object Qw32_charset_russian;
Lisp_Object Qw32_charset_arabic;
Lisp_Object Qw32_charset_greek;
Lisp_Object Qw32_charset_hebrew;
Lisp_Object Qw32_charset_thai;
Lisp_Object Qw32_charset_johab;
Lisp_Object Qw32_charset_mac;
#endif
#ifdef UNICODE_CHARSET
Lisp_Object Qw32_charset_unicode;
#endif
/***********************************************************************
Debugging
***********************************************************************/
#if 0
/* This is a function useful for recording debugging information
about the sequence of occurrences in this file. */
/* This is a function useful for recording debugging information about
the sequence of occurrences in this file. */
struct record
{
......@@ -598,8 +588,8 @@ x_update_window_begin (w)
/* Don't do highlighting for mouse motion during the update. */
display_info->mouse_face_defer = 1;
/* If the frame needs to be redrawn,
simply forget about any prior mouse highlighting. */
/* If F needs to be redrawn, simply forget about any prior mouse
highlighting. */
if (FRAME_GARBAGED_P (f))
display_info->mouse_face_window = Qnil;
......@@ -682,6 +672,10 @@ x_update_window_end (w, cursor_on_p)
updated_window = NULL;
}
/* End update of frame F. This function is installed as a hook in
update_end. */
static void
x_update_end (f)
struct frame *f;
......@@ -690,6 +684,7 @@ x_update_end (f)
FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0;
}
/* This function is called from various places in xdisp.c whenever a
complete update has been performed. The global variable
updated_window is not available here. */
......@@ -965,7 +960,6 @@ x_draw_row_bitmaps (w, row)
}
/***********************************************************************
Line Highlighting
***********************************************************************/
......@@ -991,24 +985,25 @@ x_change_line_highlight (new_highlight, vpos, y, first_unused_hpos)
abort ();
}
/* This is used when starting Emacs and when restarting after suspend.
When starting Emacs, no window is mapped. And nothing must be done
to Emacs's own window if it is suspended (though that rarely happens). */
/* This is called when starting Emacs and when restarting after
suspend. When starting Emacs, no window is mapped. And nothing
must be done to Emacs's own window if it is suspended (though that
rarely happens). */
static void
w32_set_terminal_modes (void)
{
}
/* This is called when exiting or suspending Emacs.
Exiting will make the W32 windows go away, and suspending
requires no action. */
/* This is called when exiting or suspending Emacs. Exiting will make
the W32 windows go away, and suspending requires no action. */
static void
w32_reset_terminal_modes (void)
{
}
/***********************************************************************
Output Cursor
......@@ -1016,6 +1011,7 @@ w32_reset_terminal_modes (void)
/* Set the global variable output_cursor to CURSOR. All cursor
positions are relative to updated_window. */
static void
set_output_cursor (cursor)
struct cursor_pos *cursor;
......@@ -1065,6 +1061,7 @@ w32_cursor_to (vpos, hpos, y, x)
}
}
/***********************************************************************
Display Iterator
......@@ -1079,8 +1076,10 @@ static struct face *x_get_glyph_face_and_encoding P_ ((struct frame *,
static struct face *x_get_char_face_and_encoding P_ ((struct frame *, int,
int, wchar_t *, int));
static XCharStruct *w32_per_char_metric P_ ((HDC hdc, XFontStruct *,
wchar_t *, int unicode_p));
static void x_encode_char P_ ((int, wchar_t *, struct font_info *));
wchar_t *,
enum w32_char_font_type));
static enum w32_char_font_type
w32_encode_char P_ ((int, wchar_t *, struct font_info *, int *));
static void x_append_glyph P_ ((struct it *));
static void x_append_composite_glyph P_ ((struct it *));
static void x_append_stretch_glyph P_ ((struct it *it, Lisp_Object,
......@@ -1105,15 +1104,14 @@ static void x_produce_image_glyph P_ ((struct it *it));
/* Get metrics of character CHAR2B in FONT. Value is always non-null.
If CHAR2B is not contained in FONT, the font's default character
metric is returned. If unicode_p is non-zero, use unicode functions,
otherwise use ANSI functions. */
metric is returned. */
static INLINE XCharStruct *
w32_per_char_metric (hdc, font, char2b, unicode_p)
static XCharStruct *
w32_per_char_metric (hdc, font, char2b, font_type)
HDC hdc;
XFontStruct *font;
wchar_t *char2b;
int unicode_p;
enum w32_char_font_type font_type;
{
/* The result metric information. */
XCharStruct *pcm;
......@@ -1123,14 +1121,24 @@ w32_per_char_metric (hdc, font, char2b, unicode_p)
xassert (font && char2b);
if (font_type == UNKNOWN_FONT)
{
if (font->bdf)
font_type = BDF_FONT;
else if (!w32_enable_unicode_output)
font_type = ANSI_FONT;
else
font_type = UNICODE_FONT; /* NTEMACS_TODO: Need encoding? */
}
pcm = (XCharStruct *) xmalloc (sizeof (XCharStruct));
if (font->hfont)
SelectObject (hdc, font->hfont);
if (unicode_p)
if (font_type == UNICODE_FONT)
retval = GetCharABCWidthsW (hdc, *char2b, *char2b, &char_widths);
else
else if (font_type == ANSI_FONT)
retval = GetCharABCWidthsA (hdc, *char2b, *char2b, &char_widths);
if (retval)
......@@ -1145,7 +1153,7 @@ w32_per_char_metric (hdc, font, char2b, unicode_p)
failed, try GetTextExtentPoint32W, which is implemented and
at least gives us some of the info we are after (total
character width). */
if (unicode_p)
if (font_type == UNICODE_FONT)
retval = GetTextExtentPoint32W (hdc, char2b, 1, &sz);
if (retval)
......@@ -1156,9 +1164,8 @@ w32_per_char_metric (hdc, font, char2b, unicode_p)
}
else
{
pcm->width = FONT_MAX_WIDTH (font);
pcm->rbearing = FONT_MAX_WIDTH (font);
pcm->lbearing = 0;
xfree (pcm);
return NULL;
}
}
......@@ -1175,19 +1182,33 @@ w32_per_char_metric (hdc, font, char2b, unicode_p)
}
/* Determine if a font is double byte. */
int w32_font_is_double_byte (XFontStruct *font)
{
return font->double_byte_p;
}
/* Encode CHAR2B using encoding information from FONT_INFO. CHAR2B is
the two-byte form of C. Encoding is returned in *CHAR2B. */
static INLINE void
x_encode_char (c, char2b, font_info)
static INLINE enum w32_char_font_type
w32_encode_char (c, char2b, font_info, two_byte_p)
int c;
wchar_t *char2b;
struct font_info *font_info;
int * two_byte_p;
{
int charset = CHAR_CHARSET (c);
int codepage;
int unicode_p = 0;
XFontStruct *font = font_info->font;
xassert(two_byte_p);
*two_byte_p = w32_font_is_double_byte (font);
/* FONT_INFO may define a scheme by which to encode byte1 and byte2.
This may be either a program in a special encoder language or a
fixed encoding. */
......@@ -1212,16 +1233,10 @@ x_encode_char (c, char2b, font_info)
/* We assume that MSBs are appropriately set/reset by CCL
program. */
/* NTEMACS_TODO : Use GetFontLanguageInfo to determine if
font is double byte. */
#if 0
if (FONT_MAX_BYTE1 (font) == 0) /* 1-byte font */
#endif
if (!*two_byte_p) /* 1-byte font */
*char2b = BUILD_WCHAR_T (0, ccl->reg[1]);
#if 0
else
*char2b = BUILD_WCHAR_T (ccl->reg[1], ccl->reg[2]);
#endif
}
else if (font_info->encoding[charset])
{
......@@ -1260,7 +1275,17 @@ x_encode_char (c, char2b, font_info)
MultiByteToWideChar (codepage, 0, temp, 2, char2b, 1);
else
MultiByteToWideChar (codepage, 0, temp+1, 1, char2b, 1);
}
unicode_p = 1;
*two_byte_p = 1;
}
if (!font)
return UNKNOWN_FONT;
else if (font->bdf)
return BDF_FONT;
else if (unicode_p)
return UNICODE_FONT;
else
return ANSI_FONT;
}
......@@ -1309,7 +1334,7 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p)
struct font_info *font_info
= FONT_INFO_FROM_ID (f, face->font_info_id);
if (font_info)
x_encode_char (c, char2b, font_info);
w32_encode_char (c, char2b, font_info, &multibyte_p);
}
}
......@@ -1321,15 +1346,6 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p)
}
/* Determine if a font is double byte. */
int w32_font_is_double_byte (XFontStruct *font)
{
/* NTEMACS_TODO: Determine this properly using GetFontLanguageInfo
or similar. Returning 1 might work, as we use Unicode anyway. */
return 1;
}
/* Get face and two-byte form of character glyph GLYPH on frame F.
The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is
a pointer to a realized face that is ready for display. */
......@@ -1342,12 +1358,15 @@ x_get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
int *two_byte_p;
{
struct face *face;
int dummy = 0;
xassert (glyph->type == CHAR_GLYPH);
face = FACE_FROM_ID (f, glyph->face_id);
if (two_byte_p)
*two_byte_p = 0;
else
two_byte_p = &dummy;
if (!glyph->multibyte_p)
{
......@@ -1380,9 +1399,8 @@ x_get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
= FONT_INFO_FROM_ID (f, face->font_info_id);
if (font_info)
{
x_encode_char (glyph->u.ch, char2b, font_info);
if (two_byte_p)
*two_byte_p = w32_font_is_double_byte (font_info->font);
glyph->w32_font_type
= w32_encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
}
}
}
......@@ -1511,7 +1529,7 @@ x_produce_image_glyph (it)
PREPARE_FACE_FOR_DISPLAY (it->f, face);
prepare_image_for_display (it->f, img);
it->ascent = it->phys_ascent = IMAGE_ASCENT (img);
it->ascent = it->phys_ascent = image_ascent (img, face);
it->descent = it->phys_descent = img->height + 2 * img->margin - it->ascent;
it->pixel_width = img->width + 2 * img->margin;
......@@ -1845,13 +1863,25 @@ x_produce_glyphs (it)
it->nglyphs = 1;
pcm = w32_per_char_metric (hdc, font, &char2b, 0);
pcm = w32_per_char_metric (hdc, font, &char2b,
font->bdf ? BDF_FONT : ANSI_FONT);
it->ascent = FONT_BASE (font) + boff;
it->descent = FONT_DESCENT (font) - boff;
it->phys_ascent = pcm->ascent + boff;
it->phys_descent = pcm->descent - boff;
it->pixel_width = pcm->width;
if (pcm)
{
it->phys_ascent = pcm->ascent + boff;
it->phys_descent = pcm->descent - boff;
it->pixel_width = pcm->width;
}
else
{
it->glyph_not_available_p = 1;
it->phys_ascent = FONT_BASE(font) + boff;
it->phys_descent = FONT_DESCENT(font) - boff;
it->pixel_width = FONT_WIDTH(font);
}
/* If this is a space inside a region of text with
`space-width' property, change its width. */
stretched_p = it->char_to_display == ' ' && !NILP (it->space_width);
......@@ -1899,10 +1929,10 @@ x_produce_glyphs (it)
/* If characters with lbearing or rbearing are displayed
in this line, record that fact in a flag of the
glyph row. This is used to optimize X output code. */
if (pcm->lbearing < 0
|| pcm->rbearing > pcm->width)
if (pcm && (pcm->lbearing < 0 || pcm->rbearing > pcm->width))
it->glyph_row->contains_overlapping_glyphs_p = 1;
xfree (pcm);
if (pcm)
xfree (pcm);
}
}
else if (it->char_to_display == '\n')
......@@ -1923,9 +1953,7 @@ x_produce_glyphs (it)
else if (it->char_to_display == '\t')
{
int tab_width = it->tab_width * CANON_X_UNIT (it->f);
int x = (it->current_x
- it->prompt_width
+ it->continuation_lines_width);
int x = it->current_x + it->continuation_lines_width;
int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;
it->pixel_width = next_tab_x - x;
......@@ -1948,7 +1976,8 @@ x_produce_glyphs (it)
default font and calculate the width of the character
from the charset width; this is what old redisplay code
did. */
pcm = w32_per_char_metric (hdc, font, &char2b, 1);
pcm = w32_per_char_metric (hdc, font, &char2b,
font->bdf ? BDF_FONT : UNICODE_FONT);
if (font_not_found_p || !pcm)
{
......@@ -1962,6 +1991,7 @@ x_produce_glyphs (it)
}
else
{
it->pixel_width = pcm->width;
it->phys_ascent = pcm->ascent + boff;
it->phys_descent = pcm->descent - boff;
if (it->glyph_row
......@@ -1969,7 +1999,6 @@ x_produce_glyphs (it)
|| pcm->rbearing > pcm->width))
it->glyph_row->contains_overlapping_glyphs_p = 1;
}
it->nglyphs = 1;
it->ascent = FONT_BASE (font) + boff;
it->descent = FONT_DESCENT (font) - boff;
......@@ -1996,7 +2025,8 @@ x_produce_glyphs (it)
if (it->glyph_row)
x_append_glyph (it);
xfree (pcm);
if (pcm)
xfree (pcm);
}
release_frame_dc (it->f, hdc);
}
......@@ -2014,6 +2044,8 @@ x_produce_glyphs (it)
if (it->area == TEXT_AREA)
it->current_x += it->pixel_width;
it->descent += it->extra_line_spacing;
it->max_ascent = max (it->max_ascent, it->ascent);
it->max_descent = max (it->max_descent, it->descent);
it->max_phys_ascent = max (it->max_phys_ascent, it->phys_ascent);
......@@ -2036,7 +2068,7 @@ x_estimate_mode_line_height (f, face_id)
if (FRAME_FACE_CACHE (f))
{
struct face *face = FACE_FROM_ID (f, face_id);
if (face && face->font)
if (face)
height = FONT_HEIGHT (face->font) + 2 * face->box_line_width;
}
......@@ -2044,42 +2076,6 @@ x_estimate_mode_line_height (f, face_id)
}
/* Get the Windows codepage corresponding to the specified font. The
charset info in the font name is used to look up
w32-charset-to-codepage-alist. */
int
w32_codepage_for_font (char *fontname)
{
Lisp_Object codepage;
char charset_str[20], *charset, *end;
/* Extract charset part of font string. */
if (sscanf (fontname,
"-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%19s",
charset_str) == EOF)
return CP_DEFAULT;
/* Remove leading "*-". */
if (strncmp ("*-", charset_str, 2) == 0)
charset = charset_str + 2;
else
charset = charset_str;
/* Stop match at wildcard (including preceding '-'). */
if (end = strchr (charset, '*'))
{
if (end > charset && *(end-1) == '-')
end--;
*end = '\0';
}
codepage = Fcdr (Fcdr (Fassoc (build_string(charset),
Vw32_charset_info_alist)));
if (INTEGERP (codepage))
return XINT (codepage);
else
return CP_DEFAULT;
}
BOOL
w32_use_unicode_for_codepage (codepage)
......@@ -2213,7 +2209,7 @@ struct glyph_string
};
/* Encapsulate the different ways of printing text under W32. */
/* Encapsulate the different ways of displaying text under W32. */
void W32_TEXTOUT(s, x, y,chars,nchars)
struct glyph_string * s;
......@@ -2221,16 +2217,15 @@ void W32_TEXTOUT(s, x, y,chars,nchars)
wchar_t * chars;
int nchars;
{
/* NTEMACS_TODO: Find way to figure out charset_dim. */
/* int charset_dim = CHARSET_DIMENSION (s->charset); */
int charset_dim = w32_font_is_double_byte (s->gc->font) ? 2 : 1;
if (s->gc->font->bdf)
w32_BDF_TextOut (s->gc->font->bdf, s->hdc,
x, y, (char *) chars, 1 /* charset_dim */, nchars, 0);
else if (s->two_byte_p)
x, y, (char *) chars, charset_dim, nchars, 0);
else if (s->first_glyph->w32_font_type == UNICODE_FONT)
ExtTextOutW (s->hdc, x, y, 0, NULL, chars, nchars, NULL);
else
ExtTextOut (s->hdc, x, y, 0, NULL, (char *) chars,
nchars /* * charset_dim */, NULL);
nchars * charset_dim, NULL);
}
#if 0
......@@ -2288,8 +2283,6 @@ static void x_draw_glyph_string_background P_ ((struct glyph_string *,
int));
static void x_draw_glyph_string_foreground P_ ((struct glyph_string *));
static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *));
static void x_draw_glyph_string_underline P_ ((struct glyph_string *));
static void x_draw_glyph_string_underline P_ ((struct glyph_string *));
static void x_draw_glyph_string_box P_ ((struct glyph_string *));
static void x_draw_glyph_string P_ ((struct glyph_string *));
static void x_compute_glyph_string_overhangs P_ ((struct glyph_string *));
......@@ -2298,7 +2291,7 @@ static void x_set_mode_line_face_gc P_ ((struct glyph_string *));
static void x_set_mouse_face_gc P_ ((struct glyph_string *));
static void w32_get_glyph_overhangs P_ ((HDC hdc, struct glyph *,
struct frame *,
int *, int *, int));
int *, int *));
static void x_compute_overhangs_and_x P_ ((struct glyph_string *, int, int));
static int w32_alloc_lighter_color (struct frame *, COLORREF *, double, int);
static void w32_setup_relief_color P_ ((struct frame *, struct relief *,
......@@ -2672,11 +2665,11 @@ x_compute_overhangs_and_x (s, x, backward_p)
assumed to be zero. */
static void
w32_get_glyph_overhangs (hdc, glyph, f, left, right, unicode_p)
w32_get_glyph_overhangs (hdc, glyph, f, left, right)
HDC hdc;
struct glyph *glyph;
struct frame *f;
int *left, *right, unicode_p;
int *left, *right;
{
int c;
......@@ -2686,15 +2679,15 @@ w32_get_glyph_overhangs (hdc, glyph, f, left, right, unicode_p)
{
XFontStruct *font;
struct face *face;
struct font_info *font_info;
wchar_t char2b;
XCharStruct *pcm;
face = x_get_glyph_face_and_encoding (f, glyph, &char2b, NULL);
font = face->font;
font_info = FONT_INFO_FROM_ID (f, face->font_info_id);
if (font
&& (pcm = w32_per_char_metric (hdc, font, &char2b, unicode_p)))
&& (pcm = w32_per_char_metric (hdc, font, &char2b,
glyph->w32_font_type)))
{
if (pcm->rbearing > pcm->width)
*right = pcm->rbearing - pcm->width;
......@@ -2713,7 +2706,8 @@ x_get_glyph_overhangs (glyph, f, left, right)
int *left, *right;
{
HDC hdc = get_frame_dc (f);
w32_get_glyph_overhangs (hdc, glyph, f, left, right, glyph->multibyte_p);
/* Convert to unicode! */
w32_get_glyph_overhangs (hdc, glyph, f, left, right);
release_frame_dc (f, hdc);
}
......@@ -2763,8 +2757,7 @@ x_left_overwriting (s)
for (i = first - 1; i >= 0; --i)
{
int left, right;
w32_get_glyph_overhangs (s->hdc, glyphs + i, s->f, &left,
&right, s->two_byte_p);
w32_get_glyph_overhangs (s->hdc, glyphs + i, s->f, &left, &right);
if (x + right > 0)
k = i;
x -= glyphs[i].pixel_width;
......@@ -2819,8 +2812,7 @@ x_right_overwriting (s)
for (i = first; i < end; ++i)
{
int left, right;
w32_get_glyph_overhangs (s->hdc, glyphs + i, s->f, &left,
&right, s->two_byte_p);
w32_get_glyph_overhangs (s->hdc, glyphs + i, s->f, &left, &right);
if (x - left < 0)
k = i;
x += glyphs[i].pixel_width;
......@@ -3294,7 +3286,7 @@ x_draw_image_foreground (s)
struct glyph_string *s;
{
int x;
int y = s->ybase - IMAGE_ASCENT (s->img);
int y = s->ybase - image_ascent (s->img, s->face);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
......@@ -3395,8 +3387,8 @@ x_draw_image_relief (s)
int x0, y0, x1, y1, thick, raised_p;
RECT r;
int x;
int y = s->ybase - IMAGE_ASCENT (s->img);
int y = s->ybase - image_ascent (s->img, s->face);
/* If first glyph of S has a left box line, start drawing it to the
right of that line. */
if (s->face->box != FACE_NO_BOX
......@@ -3446,7 +3438,7 @@ w32_draw_image_foreground_1 (s, pixmap)
HDC hdc = CreateCompatibleDC (s->hdc);
HGDIOBJ orig_hdc_obj = SelectObject (hdc, pixmap);
int x;