aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-12-19 22:22:55 +0000
committerJason Rumney2007-12-19 22:22:55 +0000
commit859a9fdfc4e15f7364e772ee69bc4ed90653d3b4 (patch)
tree0d01ba4c28f319089843a5c8c8061117d895d8c9 /src
parentdb9b8a15c685561afac98cb3d300a5f7cdef6a9b (diff)
downloademacs-859a9fdfc4e15f7364e772ee69bc4ed90653d3b4.tar.gz
emacs-859a9fdfc4e15f7364e772ee69bc4ed90653d3b4.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.unicode3
-rw-r--r--src/w32font.c17
2 files changed, 20 insertions, 0 deletions
diff --git a/src/ChangeLog.unicode b/src/ChangeLog.unicode
index b496f8490c7..816919436ab 100644
--- a/src/ChangeLog.unicode
+++ b/src/ChangeLog.unicode
@@ -1,5 +1,8 @@
12007-12-19 Jason Rumney <jasonr@gnu.org> 12007-12-19 Jason Rumney <jasonr@gnu.org>
2 2
3 * w32font.c (w32font_text_extents): Don't use the frame stored in the
4 font, as it may have been deleted.
5
3 * w32font.h (w32font_get_cache): Update declaration. 6 * w32font.h (w32font_get_cache): Update declaration.
4 7
52007-12-18 Kenichi Handa <handa@ni.aist.go.jp> 82007-12-18 Kenichi Handa <handa@ni.aist.go.jp>
diff --git a/src/w32font.c b/src/w32font.c
index 3ac6001c181..bb1c125e2a4 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -203,6 +203,8 @@ w32font_open (f, font_entity, pixel_size)
203 if (w32_font == NULL) 203 if (w32_font == NULL)
204 return NULL; 204 return NULL;
205 205
206 safe_debug_print (font_entity);
207
206 if (!w32font_open_internal (f, font_entity, pixel_size, w32_font)) 208 if (!w32font_open_internal (f, font_entity, pixel_size, w32_font))
207 { 209 {
208 xfree (w32_font); 210 xfree (w32_font);
@@ -293,7 +295,14 @@ w32font_text_extents (font, code, nglyphs, metrics)
293 WORD *wcode = alloca(nglyphs * sizeof (WORD)); 295 WORD *wcode = alloca(nglyphs * sizeof (WORD));
294 SIZE size; 296 SIZE size;
295 297
298#if 0
299 /* Frames can come and go, and their fonts outlive them. This is
300 particularly troublesome with tooltip frames, and causes crashes. */
296 f = ((struct w32font_info *)font)->owning_frame; 301 f = ((struct w32font_info *)font)->owning_frame;
302#else
303 f = selected_frame;
304#endif
305
297 dc = get_frame_dc (f); 306 dc = get_frame_dc (f);
298 old_font = SelectObject (dc, ((W32FontStruct *)(font->font.font))->hfont); 307 old_font = SelectObject (dc, ((W32FontStruct *)(font->font.font))->hfont);
299 308
@@ -601,6 +610,10 @@ w32font_match_internal (frame, font_spec, opentype_only)
601 bzero (&match_data.pattern, sizeof (LOGFONT)); 610 bzero (&match_data.pattern, sizeof (LOGFONT));
602 fill_in_logfont (f, &match_data.pattern, font_spec); 611 fill_in_logfont (f, &match_data.pattern, font_spec);
603 612
613 /* If weight was not specified, try to get a normal weight font. */
614 if (!match_data.pattern.lfWeight)
615 match_data.pattern.lfWeight = FW_NORMAL;
616
604 match_data.opentype_only = opentype_only; 617 match_data.opentype_only = opentype_only;
605 if (opentype_only) 618 if (opentype_only)
606 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; 619 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS;
@@ -637,6 +650,10 @@ w32font_open_internal (f, font_entity, pixel_size, w32_font)
637 bzero (&logfont, sizeof (logfont)); 650 bzero (&logfont, sizeof (logfont));
638 fill_in_logfont (f, &logfont, font_entity); 651 fill_in_logfont (f, &logfont, font_entity);
639 652
653 /* If weight was not specified, try to get a normal weight font. */
654 if (!logfont.lfWeight)
655 logfont.lfWeight = FW_NORMAL;
656
640 size = XINT (AREF (font_entity, FONT_SIZE_INDEX)); 657 size = XINT (AREF (font_entity, FONT_SIZE_INDEX));
641 if (!size) 658 if (!size)
642 size = pixel_size; 659 size = pixel_size;