# HG changeset patch # User Jason Rumney # Date 1180626740 0 # Node ID aa7f1d212e78ab6e87c2fb91ab475bc10a27cd23 # Parent 2aad53aaeca3c64941d602d7d2cd0079101e039d (font_put_extra): Expose externally. diff -r 2aad53aaeca3 -r aa7f1d212e78 src/w32font.c --- a/src/w32font.c Thu May 31 15:51:46 2007 +0000 +++ b/src/w32font.c Thu May 31 15:52:20 2007 +0000 @@ -41,7 +41,7 @@ extern struct font_driver w32font_driver; -Lisp_Object Qw32; +Lisp_Object Qw32, QCsubranges; static Lisp_Object Qmodern, Qswiss, Qroman, Qdecorative, Qscript, Qunknown; static void fill_in_logfont P_ ((FRAME_PTR f, LOGFONT *logfont, @@ -194,7 +194,7 @@ LOGFONT logfont; HDC dc; HFONT hfont, old_font; - Lisp_Object val; + Lisp_Object val, extra; /* For backwards compatibility. */ W32FontStruct *compat_w32_font; @@ -272,11 +272,19 @@ /* Truetype fonts will have extra information about the characters covered by the font. */ - val = AREF (font_entity, FONT_EXTRA_INDEX); - if (XTYPE (val) == Lisp_Misc && XMISCTYPE (val) == Lisp_Misc_Save_Value) - ((struct w32font_info *)(font))->subranges = XSAVE_VALUE (val)->pointer; - else - ((struct w32font_info *)(font))->subranges = NULL; + ((struct w32font_info *)(font))->subranges = NULL; + extra = AREF (font_entity, FONT_EXTRA_INDEX); + if (CONSP (extra)) + { + val = assq_no_quit (extra, QCsubranges); + if (CONSP (val)) + { + val = XCDR (val); + + if (XTYPE (val) == Lisp_Misc && XMISCTYPE (val) == Lisp_Misc_Save_Value) + ((struct w32font_info *)(font))->subranges = XSAVE_VALUE (val)->pointer; + } + } return font; } @@ -305,12 +313,20 @@ it, return -1. */ static int w32font_has_char (Lisp_Object entity, int c) { - Lisp_Object val; + Lisp_Object val, extra; DWORD *ranges; int index; DWORD mask; - val = AREF (entity, FONT_EXTRA_INDEX); + extra = AREF (entity, FONT_EXTRA_INDEX); + if (!CONSP (extra)) + return -1; + + val = assq_no_quit (extra, QCsubranges); + if (!CONSP (val)) + return -1; + + val = XCDR (val); if (XTYPE (val) != Lisp_Misc || XMISCTYPE (val) != Lisp_Misc_Save_Value) return -1; @@ -617,7 +633,7 @@ { DWORD *subranges = xmalloc(16); memcpy (subranges, physical_font->ntmFontSig.fsUsb, 16); - ASET (entity, FONT_EXTRA_INDEX, make_save_value (subranges, 0)); + font_put_extra (entity, QCsubranges, make_save_value (subranges, 0)); } return entity; } @@ -1103,7 +1119,7 @@ DEFSYM (Qscript, "script"); DEFSYM (Qswiss, "swiss"); DEFSYM (Qunknown, "unknown"); - + DEFSYM (QCsubranges, ":unicode-subranges"); w32font_driver.type = Qw32; register_font_driver (&w32font_driver, NULL); }