aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2007-05-31 15:52:48 +0000
committerJason Rumney2007-05-31 15:52:48 +0000
commit01dbeb0bc865e054df7abf81ae065e93b4d83452 (patch)
treebfde430350cef229adf4a7400c7b6673e1e9e006
parent1b042981a98208ab3cce2801fe8793e307c1e325 (diff)
downloademacs-01dbeb0bc865e054df7abf81ae065e93b4d83452.tar.gz
emacs-01dbeb0bc865e054df7abf81ae065e93b4d83452.zip
(font_put_extra): Expose externally.
-rw-r--r--src/font.c3
-rw-r--r--src/w32font.c38
2 files changed, 28 insertions, 13 deletions
diff --git a/src/font.c b/src/font.c
index 965bf3f4b6f..4f9aaee3605 100644
--- a/src/font.c
+++ b/src/font.c
@@ -260,7 +260,6 @@ static Lisp_Object font_prop_validate_spacing P_ ((enum font_property_index,
260 Lisp_Object, Lisp_Object)); 260 Lisp_Object, Lisp_Object));
261static int get_font_prop_index P_ ((Lisp_Object, int)); 261static int get_font_prop_index P_ ((Lisp_Object, int));
262static Lisp_Object font_prop_validate P_ ((Lisp_Object)); 262static Lisp_Object font_prop_validate P_ ((Lisp_Object));
263static Lisp_Object font_put_extra P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
264 263
265static Lisp_Object 264static Lisp_Object
266font_prop_validate_symbol (prop_index, prop, val) 265font_prop_validate_symbol (prop_index, prop, val)
@@ -408,7 +407,7 @@ font_prop_validate (spec)
408 return spec; 407 return spec;
409} 408}
410 409
411static Lisp_Object 410Lisp_Object
412font_put_extra (font, prop, val) 411font_put_extra (font, prop, val)
413 Lisp_Object font, prop, val; 412 Lisp_Object font, prop, val;
414{ 413{
diff --git a/src/w32font.c b/src/w32font.c
index 0f5f930988c..8d323ae4cad 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -41,7 +41,7 @@ struct w32font_info
41 41
42extern struct font_driver w32font_driver; 42extern struct font_driver w32font_driver;
43 43
44Lisp_Object Qw32; 44Lisp_Object Qw32, QCsubranges;
45static Lisp_Object Qmodern, Qswiss, Qroman, Qdecorative, Qscript, Qunknown; 45static Lisp_Object Qmodern, Qswiss, Qroman, Qdecorative, Qscript, Qunknown;
46 46
47static void fill_in_logfont P_ ((FRAME_PTR f, LOGFONT *logfont, 47static void fill_in_logfont P_ ((FRAME_PTR f, LOGFONT *logfont,
@@ -194,7 +194,7 @@ static struct font* w32font_open (FRAME_PTR f, Lisp_Object font_entity,
194 LOGFONT logfont; 194 LOGFONT logfont;
195 HDC dc; 195 HDC dc;
196 HFONT hfont, old_font; 196 HFONT hfont, old_font;
197 Lisp_Object val; 197 Lisp_Object val, extra;
198 /* For backwards compatibility. */ 198 /* For backwards compatibility. */
199 W32FontStruct *compat_w32_font; 199 W32FontStruct *compat_w32_font;
200 200
@@ -272,11 +272,19 @@ static struct font* w32font_open (FRAME_PTR f, Lisp_Object font_entity,
272 272
273 /* Truetype fonts will have extra information about the characters 273 /* Truetype fonts will have extra information about the characters
274 covered by the font. */ 274 covered by the font. */
275 val = AREF (font_entity, FONT_EXTRA_INDEX); 275 ((struct w32font_info *)(font))->subranges = NULL;
276 if (XTYPE (val) == Lisp_Misc && XMISCTYPE (val) == Lisp_Misc_Save_Value) 276 extra = AREF (font_entity, FONT_EXTRA_INDEX);
277 ((struct w32font_info *)(font))->subranges = XSAVE_VALUE (val)->pointer; 277 if (CONSP (extra))
278 else 278 {
279 ((struct w32font_info *)(font))->subranges = NULL; 279 val = assq_no_quit (extra, QCsubranges);
280 if (CONSP (val))
281 {
282 val = XCDR (val);
283
284 if (XTYPE (val) == Lisp_Misc && XMISCTYPE (val) == Lisp_Misc_Save_Value)
285 ((struct w32font_info *)(font))->subranges = XSAVE_VALUE (val)->pointer;
286 }
287 }
280 288
281 return font; 289 return font;
282} 290}
@@ -305,12 +313,20 @@ static void w32font_close (FRAME_PTR f, struct font *font)
305 it, return -1. */ 313 it, return -1. */
306static int w32font_has_char (Lisp_Object entity, int c) 314static int w32font_has_char (Lisp_Object entity, int c)
307{ 315{
308 Lisp_Object val; 316 Lisp_Object val, extra;
309 DWORD *ranges; 317 DWORD *ranges;
310 int index; 318 int index;
311 DWORD mask; 319 DWORD mask;
312 320
313 val = AREF (entity, FONT_EXTRA_INDEX); 321 extra = AREF (entity, FONT_EXTRA_INDEX);
322 if (!CONSP (extra))
323 return -1;
324
325 val = assq_no_quit (extra, QCsubranges);
326 if (!CONSP (val))
327 return -1;
328
329 val = XCDR (val);
314 if (XTYPE (val) != Lisp_Misc || XMISCTYPE (val) != Lisp_Misc_Save_Value) 330 if (XTYPE (val) != Lisp_Misc || XMISCTYPE (val) != Lisp_Misc_Save_Value)
315 return -1; 331 return -1;
316 332
@@ -617,7 +633,7 @@ Lisp_Object w32_enumfont_pattern_entity (ENUMLOGFONTEX *logical_font,
617 { 633 {
618 DWORD *subranges = xmalloc(16); 634 DWORD *subranges = xmalloc(16);
619 memcpy (subranges, physical_font->ntmFontSig.fsUsb, 16); 635 memcpy (subranges, physical_font->ntmFontSig.fsUsb, 16);
620 ASET (entity, FONT_EXTRA_INDEX, make_save_value (subranges, 0)); 636 font_put_extra (entity, QCsubranges, make_save_value (subranges, 0));
621 } 637 }
622 return entity; 638 return entity;
623} 639}
@@ -1103,7 +1119,7 @@ void syms_of_w32font ()
1103 DEFSYM (Qscript, "script"); 1119 DEFSYM (Qscript, "script");
1104 DEFSYM (Qswiss, "swiss"); 1120 DEFSYM (Qswiss, "swiss");
1105 DEFSYM (Qunknown, "unknown"); 1121 DEFSYM (Qunknown, "unknown");
1106 1122 DEFSYM (QCsubranges, ":unicode-subranges");
1107 w32font_driver.type = Qw32; 1123 w32font_driver.type = Qw32;
1108 register_font_driver (&w32font_driver, NULL); 1124 register_font_driver (&w32font_driver, NULL);
1109} 1125}