aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
authorJason Rumney2002-01-20 14:54:48 +0000
committerJason Rumney2002-01-20 14:54:48 +0000
commit73dc743ce981ff5e92d13b99262addeeef5ec2b5 (patch)
tree4df11c9662f62b81dfccf21ab05e2e6377f1a072 /src/w32term.c
parent5c139d2993ea581e05036976db4eb7107a5c0ca6 (diff)
downloademacs-73dc743ce981ff5e92d13b99262addeeef5ec2b5.tar.gz
emacs-73dc743ce981ff5e92d13b99262addeeef5ec2b5.zip
(w32_native_per_char_metric): Don't trust the metrics
that Windows returns. If a double check fails, try to guess how ExtTextOut is going to act.
Diffstat (limited to 'src/w32term.c')
-rw-r--r--src/w32term.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/w32term.c b/src/w32term.c
index af83ae53a2a..e25a270fc1d 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -388,8 +388,8 @@ static void x_clear_frame P_ ((void));
388static void x_clear_cursor P_ ((struct window *)); 388static void x_clear_cursor P_ ((struct window *));
389static void frame_highlight P_ ((struct frame *)); 389static void frame_highlight P_ ((struct frame *));
390static void frame_unhighlight P_ ((struct frame *)); 390static void frame_unhighlight P_ ((struct frame *));
391static void w32_new_focus_frame P_ ((struct w32_display_info *, 391static void x_new_focus_frame P_ ((struct w32_display_info *,
392 struct frame *)); 392 struct frame *));
393static void w32_frame_rehighlight P_ ((struct frame *)); 393static void w32_frame_rehighlight P_ ((struct frame *));
394static void x_frame_rehighlight P_ ((struct w32_display_info *)); 394static void x_frame_rehighlight P_ ((struct w32_display_info *));
395static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); 395static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
@@ -1210,9 +1210,20 @@ w32_native_per_char_metric (font, char2b, font_type, pcm)
1210 1210
1211 if (retval) 1211 if (retval)
1212 { 1212 {
1213 /* Don't trust the ABC widths. For synthesized fonts they are
1214 wrong, and so is the result of GetCharWidth()! */
1215 int real_width;
1216 GetCharWidth (hdc, *char2b, *char2b, &real_width);
1217
1213 pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC; 1218 pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC;
1219
1220 /* As far as I can tell, this is the best way to determine what
1221 ExtTextOut will do with the broken font. */
1222 if (pcm->width != real_width)
1223 pcm->width = (pcm->width + real_width) / 2;
1224
1214 pcm->lbearing = char_widths.abcA; 1225 pcm->lbearing = char_widths.abcA;
1215 pcm->rbearing = pcm->width - char_widths.abcC; 1226 pcm->rbearing = char_widths.abcA + char_widths.abcB;
1216 pcm->ascent = FONT_BASE (font); 1227 pcm->ascent = FONT_BASE (font);
1217 pcm->descent = FONT_DESCENT (font); 1228 pcm->descent = FONT_DESCENT (font);
1218 } 1229 }