Mercurial > emacs
comparison src/w32font.c @ 90889:0df73c71020b
* w32font.c (QCsubranges): New symbol.
(w32font_open, w32font_has_char): Get subranges from subproperty
of extra.
(w32_enumfont_pattern_entity): Set subranges as subproperty of extra.
(syms_of_w32font): Define :subranges symbol.
Reformat according to GNU standards.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Thu, 31 May 2007 16:20:30 +0000 |
parents | aa7f1d212e78 |
children | 2f6131d7643f |
comparison
equal
deleted
inserted
replaced
90888:5f03b3602143 | 90889:0df73c71020b |
---|---|
90 } | 90 } |
91 | 91 |
92 /* w32 implementation of get_cache for font backend. | 92 /* w32 implementation of get_cache for font backend. |
93 Return a cache of font-entities on FRAME. The cache must be a | 93 Return a cache of font-entities on FRAME. The cache must be a |
94 cons whose cdr part is the actual cache area. */ | 94 cons whose cdr part is the actual cache area. */ |
95 static Lisp_Object w32font_get_cache (Lisp_Object frame) | 95 static Lisp_Object |
96 w32font_get_cache (frame) | |
97 Lisp_Object frame; | |
96 { | 98 { |
97 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame)); | 99 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame)); |
98 | 100 |
99 return (dpyinfo->name_list_element); | 101 return (dpyinfo->name_list_element); |
100 } | 102 } |
101 | 103 |
102 /* w32 implementation of list for font backend. | 104 /* w32 implementation of list for font backend. |
103 List fonts exactly matching with FONT_SPEC on FRAME. The value | 105 List fonts exactly matching with FONT_SPEC on FRAME. The value |
104 is a vector of font-entities. This is the sole API that | 106 is a vector of font-entities. This is the sole API that |
105 allocates font-entities. */ | 107 allocates font-entities. */ |
106 static Lisp_Object w32font_list (Lisp_Object frame, Lisp_Object font_spec) | 108 static Lisp_Object |
109 w32font_list (frame, font_spec) | |
110 Lisp_Object frame, font_spec; | |
107 { | 111 { |
108 Lisp_Object list = Qnil; | 112 Lisp_Object list = Qnil; |
109 LOGFONT font_match_pattern; | 113 LOGFONT font_match_pattern; |
110 HDC dc; | 114 HDC dc; |
111 FRAME_PTR f = XFRAME (frame); | 115 FRAME_PTR f = XFRAME (frame); |
137 | 141 |
138 /* w32 implementation of match for font backend. | 142 /* w32 implementation of match for font backend. |
139 Return a font entity most closely matching with FONT_SPEC on | 143 Return a font entity most closely matching with FONT_SPEC on |
140 FRAME. The closeness is detemined by the font backend, thus | 144 FRAME. The closeness is detemined by the font backend, thus |
141 `face-font-selection-order' is ignored here. */ | 145 `face-font-selection-order' is ignored here. */ |
142 static Lisp_Object w32font_match (Lisp_Object frame, Lisp_Object font_spec) | 146 static Lisp_Object |
147 w32font_match (frame, font_spec) | |
148 Lisp_Object frame, font_spec; | |
143 { | 149 { |
144 Lisp_Object list = Qnil; | 150 Lisp_Object list = Qnil; |
145 LOGFONT font_match_pattern; | 151 LOGFONT font_match_pattern; |
146 HDC dc; | 152 HDC dc; |
147 FRAME_PTR f = XFRAME (frame); | 153 FRAME_PTR f = XFRAME (frame); |
163 | 169 |
164 | 170 |
165 /* w32 implementation of list_family for font backend. | 171 /* w32 implementation of list_family for font backend. |
166 List available families. The value is a list of family names | 172 List available families. The value is a list of family names |
167 (symbols). */ | 173 (symbols). */ |
168 static Lisp_Object w32font_list_family (Lisp_Object frame) | 174 static Lisp_Object |
175 w32font_list_family (frame) | |
176 Lisp_Object frame; | |
169 { | 177 { |
170 Lisp_Object list = Qnil; | 178 Lisp_Object list = Qnil; |
171 LOGFONT font_match_pattern; | 179 LOGFONT font_match_pattern; |
172 HDC dc; | 180 HDC dc; |
173 FRAME_PTR f = XFRAME (frame); | 181 FRAME_PTR f = XFRAME (frame); |
185 } | 193 } |
186 | 194 |
187 /* w32 implementation of open for font backend. | 195 /* w32 implementation of open for font backend. |
188 Open a font specified by FONT_ENTITY on frame F. | 196 Open a font specified by FONT_ENTITY on frame F. |
189 If the font is scalable, open it with PIXEL_SIZE. */ | 197 If the font is scalable, open it with PIXEL_SIZE. */ |
190 static struct font* w32font_open (FRAME_PTR f, Lisp_Object font_entity, | 198 static struct font * |
191 int pixel_size) | 199 w32font_open (f, font_entity, pixel_size) |
200 FRAME_PTR f; | |
201 Lisp_Object font_entity; | |
202 int pixel_size; | |
192 { | 203 { |
193 int len, size; | 204 int len, size; |
194 LOGFONT logfont; | 205 LOGFONT logfont; |
195 HDC dc; | 206 HDC dc; |
196 HFONT hfont, old_font; | 207 HFONT hfont, old_font; |
289 return font; | 300 return font; |
290 } | 301 } |
291 | 302 |
292 /* w32 implementation of close for font_backend. | 303 /* w32 implementation of close for font_backend. |
293 Close FONT on frame F. */ | 304 Close FONT on frame F. */ |
294 static void w32font_close (FRAME_PTR f, struct font *font) | 305 static void |
306 w32font_close (f, font) | |
307 FRAME_PTR f; | |
308 struct font *font; | |
295 { | 309 { |
296 if (font->font.font) | 310 if (font->font.font) |
297 { | 311 { |
298 W32FontStruct *old_w32_font = (W32FontStruct *)font->font.font; | 312 W32FontStruct *old_w32_font = (W32FontStruct *)font->font.font; |
299 DeleteObject (font->font.font); | 313 DeleteObject (font->font.font); |
309 /* w32 implementation of has_char for font backend. | 323 /* w32 implementation of has_char for font backend. |
310 Optional. | 324 Optional. |
311 If FONT_ENTITY has a glyph for character C (Unicode code point), | 325 If FONT_ENTITY has a glyph for character C (Unicode code point), |
312 return 1. If not, return 0. If a font must be opened to check | 326 return 1. If not, return 0. If a font must be opened to check |
313 it, return -1. */ | 327 it, return -1. */ |
314 static int w32font_has_char (Lisp_Object entity, int c) | 328 static int |
329 w32font_has_char (entity, c) | |
330 Lisp_Object entity; | |
331 int c; | |
315 { | 332 { |
316 Lisp_Object val, extra; | 333 Lisp_Object val, extra; |
317 DWORD *ranges; | 334 DWORD *ranges; |
318 int index; | 335 int index; |
319 DWORD mask; | 336 DWORD mask; |
343 } | 360 } |
344 | 361 |
345 /* w32 implementation of encode_char for font backend. | 362 /* w32 implementation of encode_char for font backend. |
346 Return a glyph code of FONT for characer C (Unicode code point). | 363 Return a glyph code of FONT for characer C (Unicode code point). |
347 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ | 364 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ |
348 static unsigned w32font_encode_char (struct font *font, int c) | 365 static unsigned |
366 w32font_encode_char (font, c) | |
367 struct font *font; | |
368 int c; | |
349 { | 369 { |
350 if (get_glyph_indices_fn) | 370 if (get_glyph_indices_fn) |
351 { | 371 { |
352 HFONT old_font; | 372 HFONT old_font; |
353 WORD glyph[2]; | 373 WORD glyph[2]; |
379 /* w32 implementation of text_extents for font backend. | 399 /* w32 implementation of text_extents for font backend. |
380 Perform the size computation of glyphs of FONT and fillin members | 400 Perform the size computation of glyphs of FONT and fillin members |
381 of METRICS. The glyphs are specified by their glyph codes in | 401 of METRICS. The glyphs are specified by their glyph codes in |
382 CODE (length NGLYPHS). Apparently medtrics can be NULL, in this | 402 CODE (length NGLYPHS). Apparently medtrics can be NULL, in this |
383 case just return the overall width. */ | 403 case just return the overall width. */ |
384 static int w32font_text_extents (struct font *font, | 404 static int |
385 unsigned *code, int nglyphs, | 405 w32font_text_extents (font, code, nglyphs, metrics) |
386 struct font_metrics *metrics) | 406 struct font *font; |
407 unsigned *code; | |
408 int nglyphs; | |
409 struct font_metrics *metrics; | |
387 { | 410 { |
388 int i; | 411 int i; |
389 HFONT old_font; | 412 HFONT old_font; |
390 /* FIXME: Be nice if we had a frame here, rather than getting the desktop's | 413 /* FIXME: Be nice if we had a frame here, rather than getting the desktop's |
391 device context to measure against... */ | 414 device context to measure against... */ |
467 Optional. | 490 Optional. |
468 Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | 491 Draw glyphs between FROM and TO of S->char2b at (X Y) pixel |
469 position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | 492 position of frame F with S->FACE and S->GC. If WITH_BACKGROUND |
470 is nonzero, fill the background in advance. It is assured that | 493 is nonzero, fill the background in advance. It is assured that |
471 WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ | 494 WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ |
472 static int w32font_draw (struct glyph_string *s, int from, int to, | 495 static int |
473 int x, int y, int with_background) | 496 w32font_draw (s, from, to, x, y, with_background) |
497 struct glyph_string *s; | |
498 int from, to, x, y, with_background; | |
474 { | 499 { |
475 /* TODO: Do we need to specify ETO_GLYPH_INDEX or is char2b always utf-16? */ | 500 /* TODO: Do we need to specify ETO_GLYPH_INDEX or is char2b always utf-16? */ |
476 UINT options = 0; | 501 UINT options = 0; |
477 | 502 |
478 if (with_background) | 503 if (with_background) |
487 } | 512 } |
488 | 513 |
489 /* w32 implementation of free_entity for font backend. | 514 /* w32 implementation of free_entity for font backend. |
490 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). | 515 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). |
491 Free FONT_EXTRA_INDEX field of FONT_ENTITY. | 516 Free FONT_EXTRA_INDEX field of FONT_ENTITY. |
492 static void w32font_free_entity (Lisp_Object entity); | 517 static void |
518 w32font_free_entity (Lisp_Object entity); | |
493 */ | 519 */ |
494 | 520 |
495 /* w32 implementation of prepare_face for font backend. | 521 /* w32 implementation of prepare_face for font backend. |
496 Optional (if FACE->extra is not used). | 522 Optional (if FACE->extra is not used). |
497 Prepare FACE for displaying characters by FONT on frame F by | 523 Prepare FACE for displaying characters by FONT on frame F by |
498 storing some data in FACE->extra. If successful, return 0. | 524 storing some data in FACE->extra. If successful, return 0. |
499 Otherwise, return -1. | 525 Otherwise, return -1. |
500 static int w32font_prepare_face (FRAME_PTR f, struct face *face); | 526 static int |
527 w32font_prepare_face (FRAME_PTR f, struct face *face); | |
501 */ | 528 */ |
502 /* w32 implementation of done_face for font backend. | 529 /* w32 implementation of done_face for font backend. |
503 Optional. | 530 Optional. |
504 Done FACE for displaying characters by FACE->font on frame F. | 531 Done FACE for displaying characters by FACE->font on frame F. |
505 static void w32font_done_face (FRAME_PTR f, struct face *face); */ | 532 static void |
533 w32font_done_face (FRAME_PTR f, struct face *face); */ | |
506 | 534 |
507 /* w32 implementation of get_bitmap for font backend. | 535 /* w32 implementation of get_bitmap for font backend. |
508 Optional. | 536 Optional. |
509 Store bitmap data for glyph-code CODE of FONT in BITMAP. It is | 537 Store bitmap data for glyph-code CODE of FONT in BITMAP. It is |
510 intended that this method is callled from the other font-driver | 538 intended that this method is callled from the other font-driver |
511 for actual drawing. | 539 for actual drawing. |
512 static int w32font_get_bitmap (struct font *font, unsigned code, | 540 static int |
513 struct font_bitmap *bitmap, | 541 w32font_get_bitmap (struct font *font, unsigned code, |
514 int bits_per_pixel); | 542 struct font_bitmap *bitmap, int bits_per_pixel); |
515 */ | 543 */ |
516 /* w32 implementation of free_bitmap for font backend. | 544 /* w32 implementation of free_bitmap for font backend. |
517 Optional. | 545 Optional. |
518 Free bitmap data in BITMAP. | 546 Free bitmap data in BITMAP. |
519 static void w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); | 547 static void |
548 w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); | |
520 */ | 549 */ |
521 /* w32 implementation of get_outline for font backend. | 550 /* w32 implementation of get_outline for font backend. |
522 Optional. | 551 Optional. |
523 Return an outline data for glyph-code CODE of FONT. The format | 552 Return an outline data for glyph-code CODE of FONT. The format |
524 of the outline data depends on the font-driver. | 553 of the outline data depends on the font-driver. |
525 static void* w32font_get_outline (struct font *font, unsigned code); | 554 static void * |
555 w32font_get_outline (struct font *font, unsigned code); | |
526 */ | 556 */ |
527 /* w32 implementation of free_outline for font backend. | 557 /* w32 implementation of free_outline for font backend. |
528 Optional. | 558 Optional. |
529 Free OUTLINE (that is obtained by the above method). | 559 Free OUTLINE (that is obtained by the above method). |
530 static void w32font_free_outline (struct font *font, void *outline); | 560 static void |
561 w32font_free_outline (struct font *font, void *outline); | |
531 */ | 562 */ |
532 /* w32 implementation of anchor_point for font backend. | 563 /* w32 implementation of anchor_point for font backend. |
533 Optional. | 564 Optional. |
534 Get coordinates of the INDEXth anchor point of the glyph whose | 565 Get coordinates of the INDEXth anchor point of the glyph whose |
535 code is CODE. Store the coordinates in *X and *Y. Return 0 if | 566 code is CODE. Store the coordinates in *X and *Y. Return 0 if |
536 the operations was successfull. Otherwise return -1. | 567 the operations was successfull. Otherwise return -1. |
537 static int w32font_anchor_point (struct font *font, unsigned code, | 568 static int |
569 w32font_anchor_point (struct font *font, unsigned code, | |
538 int index, int *x, int *y); | 570 int index, int *x, int *y); |
539 */ | 571 */ |
540 /* w32 implementation of otf_capability for font backend. | 572 /* w32 implementation of otf_capability for font backend. |
541 Optional. | 573 Optional. |
542 Return a list describing which scripts/languages FONT | 574 Return a list describing which scripts/languages FONT |
543 supports by which GSUB/GPOS features of OpenType tables. | 575 supports by which GSUB/GPOS features of OpenType tables. |
544 static Lisp_Object w32font_otf_capability (struct font *font); | 576 static Lisp_Object |
577 w32font_otf_capability (struct font *font); | |
545 */ | 578 */ |
546 /* w32 implementation of otf_drive for font backend. | 579 /* w32 implementation of otf_drive for font backend. |
547 Optional. | 580 Optional. |
548 Apply FONT's OTF-FEATURES to the glyph string. | 581 Apply FONT's OTF-FEATURES to the glyph string. |
549 | 582 |
557 following elements. | 590 following elements. |
558 | 591 |
559 Return the number of output codes. If none of the features are | 592 Return the number of output codes. If none of the features are |
560 applicable to the input data, return 0. If GSTRING-OUT is too | 593 applicable to the input data, return 0. If GSTRING-OUT is too |
561 short, return -1. | 594 short, return -1. |
562 static int w32font_otf_drive (struct font *font, Lisp_Object features, | 595 static int |
563 Lisp_Object gstring_in, int from, int to, | 596 w32font_otf_drive (struct font *font, Lisp_Object features, |
564 Lisp_Object gstring_out, int idx, | 597 Lisp_Object gstring_in, int from, int to, |
565 int alternate_subst); | 598 Lisp_Object gstring_out, int idx, |
599 int alternate_subst); | |
566 */ | 600 */ |
567 | 601 |
568 /* Callback function for EnumFontFamiliesEx. | 602 /* Callback function for EnumFontFamiliesEx. |
569 * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ | 603 * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ |
570 static int CALLBACK add_font_name_to_list (ENUMLOGFONTEX *logical_font, | 604 static int CALLBACK |
571 NEWTEXTMETRICEX *physical_font, | 605 add_font_name_to_list (logical_font, physical_font, font_type, list_object) |
572 DWORD font_type, | 606 ENUMLOGFONTEX *logical_font; |
573 LPARAM list_object) | 607 NEWTEXTMETRICEX *physical_font; |
608 DWORD font_type; | |
609 LPARAM list_object; | |
574 { | 610 { |
575 Lisp_Object* list = (Lisp_Object *) list_object; | 611 Lisp_Object* list = (Lisp_Object *) list_object; |
576 Lisp_Object family = intern_downcase (logical_font->elfLogFont.lfFaceName, | 612 Lisp_Object family = intern_downcase (logical_font->elfLogFont.lfFaceName, |
577 strlen (logical_font->elfLogFont.lfFaceName)); | 613 strlen (logical_font->elfLogFont.lfFaceName)); |
578 if (! memq_no_quit (family, *list)) | 614 if (! memq_no_quit (family, *list)) |
580 | 616 |
581 return 1; | 617 return 1; |
582 } | 618 } |
583 | 619 |
584 /* Convert an enumerated Windows font to an Emacs font entity. */ | 620 /* Convert an enumerated Windows font to an Emacs font entity. */ |
585 Lisp_Object w32_enumfont_pattern_entity (ENUMLOGFONTEX *logical_font, | 621 static Lisp_Object |
586 NEWTEXTMETRICEX *physical_font, | 622 w32_enumfont_pattern_entity (logical_font, physical_font, font_type) |
587 DWORD font_type) | 623 ENUMLOGFONTEX *logical_font; |
624 NEWTEXTMETRICEX *physical_font; | |
625 DWORD font_type; | |
588 { | 626 { |
589 Lisp_Object entity, tem; | 627 Lisp_Object entity, tem; |
590 LOGFONT *lf = (LOGFONT*) logical_font; | 628 LOGFONT *lf = (LOGFONT*) logical_font; |
591 BYTE generic_type; | 629 BYTE generic_type; |
592 | 630 |
638 return entity; | 676 return entity; |
639 } | 677 } |
640 | 678 |
641 /* Callback function for EnumFontFamiliesEx. | 679 /* Callback function for EnumFontFamiliesEx. |
642 * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ | 680 * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ |
643 static int CALLBACK add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | 681 static int CALLBACK |
644 NEWTEXTMETRICEX *physical_font, | 682 add_font_entity_to_list (logical_font, physical_font, font_type, list_object) |
645 DWORD font_type, | 683 ENUMLOGFONTEX *logical_font; |
646 LPARAM list_object) | 684 NEWTEXTMETRICEX *physical_font; |
685 DWORD font_type; | |
686 LPARAM list_object; | |
647 { | 687 { |
648 Lisp_Object *list = (Lisp_Object *) list_object; | 688 Lisp_Object *list = (Lisp_Object *) list_object; |
649 Lisp_Object entity = w32_enumfont_pattern_entity (logical_font, | 689 Lisp_Object entity = w32_enumfont_pattern_entity (logical_font, |
650 physical_font, font_type); | 690 physical_font, font_type); |
651 if (!NILP (entity)) | 691 if (!NILP (entity)) |
655 } | 695 } |
656 | 696 |
657 /* Callback function for EnumFontFamiliesEx. | 697 /* Callback function for EnumFontFamiliesEx. |
658 * Adds the name of a font to a Lisp list (passed in as the lParam arg), | 698 * Adds the name of a font to a Lisp list (passed in as the lParam arg), |
659 * then terminate the search. */ | 699 * then terminate the search. */ |
660 static int CALLBACK add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font, | 700 static int CALLBACK |
661 NEWTEXTMETRICEX *physical_font, | 701 add_one_font_entity_to_list (logical_font, physical_font, font_type, list) |
662 DWORD font_type, | 702 ENUMLOGFONTEX *logical_font; |
663 LPARAM list_object) | 703 NEWTEXTMETRICEX *physical_font; |
664 { | 704 DWORD font_type; |
665 add_font_entity_to_list (logical_font, physical_font, font_type, list_object); | 705 LPARAM list; |
706 { | |
707 add_font_entity_to_list (logical_font, physical_font, font_type, list); | |
666 return 0; | 708 return 0; |
667 } | 709 } |
668 | 710 |
669 /* Convert a Lisp font registry (symbol) to a windows charset. */ | 711 /* Convert a Lisp font registry (symbol) to a windows charset. */ |
670 static LONG registry_to_w32_charset (Lisp_Object charset) | 712 static LONG |
713 registry_to_w32_charset (charset) | |
714 Lisp_Object charset; | |
671 { | 715 { |
672 if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) | 716 if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) |
673 || EQ (charset, Qunicode_sip)) | 717 || EQ (charset, Qunicode_sip)) |
674 return DEFAULT_CHARSET; /* UNICODE_CHARSET not defined in MingW32 */ | 718 return DEFAULT_CHARSET; /* UNICODE_CHARSET not defined in MingW32 */ |
675 else if (EQ (charset, Qiso8859_1)) | 719 else if (EQ (charset, Qiso8859_1)) |
680 return x_to_w32_charset (SDATA (charset)); | 724 return x_to_w32_charset (SDATA (charset)); |
681 else | 725 else |
682 return DEFAULT_CHARSET; | 726 return DEFAULT_CHARSET; |
683 } | 727 } |
684 | 728 |
685 static Lisp_Object w32_registry (LONG w32_charset) | 729 static Lisp_Object |
730 w32_registry (w32_charset) | |
731 LONG w32_charset; | |
686 { | 732 { |
687 if (w32_charset == ANSI_CHARSET) | 733 if (w32_charset == ANSI_CHARSET) |
688 return Qiso8859_1; | 734 return Qiso8859_1; |
689 else | 735 else |
690 { | 736 { |
691 char * charset = w32_to_x_charset (w32_charset, NULL); | 737 char * charset = w32_to_x_charset (w32_charset, NULL); |
692 return intern_downcase (charset, strlen(charset)); | 738 return intern_downcase (charset, strlen(charset)); |
693 } | 739 } |
694 } | 740 } |
695 | 741 |
696 static void set_fonts_frame (Lisp_Object fontlist, Lisp_Object frame) | 742 static void |
743 set_fonts_frame (fontlist, frame) | |
744 Lisp_Object fontlist; | |
745 Lisp_Object frame; | |
697 { | 746 { |
698 if (VECTORP (fontlist)) | 747 if (VECTORP (fontlist)) |
699 ASET (fontlist, FONT_FRAME_INDEX, frame); | 748 ASET (fontlist, FONT_FRAME_INDEX, frame); |
700 else | 749 else |
701 { | 750 { |
707 } | 756 } |
708 } | 757 } |
709 } | 758 } |
710 | 759 |
711 /* Fill in all the available details of LOGFONT from FONT_SPEC. */ | 760 /* Fill in all the available details of LOGFONT from FONT_SPEC. */ |
712 static void fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) | 761 static void |
762 fill_in_logfont (f, logfont, font_spec) | |
763 FRAME_PTR f; | |
764 LOGFONT *logfont; | |
765 Lisp_Object font_spec; | |
713 { | 766 { |
714 Lisp_Object val, tmp, extra; | 767 Lisp_Object val, tmp, extra; |
715 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; | 768 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; |
716 | 769 |
717 /* TODO: Allow user to override dpi settings. */ | 770 /* TODO: Allow user to override dpi settings. */ |
775 else if (STRINGP (tmp)) | 828 else if (STRINGP (tmp)) |
776 strncpy (logfont->lfFaceName, SDATA (tmp), LF_FACESIZE); | 829 strncpy (logfont->lfFaceName, SDATA (tmp), LF_FACESIZE); |
777 | 830 |
778 } | 831 } |
779 | 832 |
780 static void list_all_matching_fonts (Lisp_Object frame, | 833 static void |
781 LOGFONT *font_match_pattern, | 834 list_all_matching_fonts (frame, font_match_pattern, list) |
782 Lisp_Object* list) | 835 Lisp_Object frame; |
836 LOGFONT *font_match_pattern; | |
837 Lisp_Object* list; | |
783 { | 838 { |
784 HDC dc; | 839 HDC dc; |
785 Lisp_Object families = w32font_list_family (frame); | 840 Lisp_Object families = w32font_list_family (frame); |
786 struct frame *f = XFRAME (frame); | 841 struct frame *f = XFRAME (frame); |
787 | 842 |
806 } | 861 } |
807 | 862 |
808 release_frame_dc (f, dc); | 863 release_frame_dc (f, dc); |
809 } | 864 } |
810 | 865 |
811 static int unicode_range_for_char (unsigned c) | 866 static int |
867 unicode_range_for_char (c) | |
868 unsigned c; | |
812 { | 869 { |
813 /* Is there really no Windows API function for this?!!! */ | 870 /* Is there really no Windows API function for this?!!! */ |
814 if (c < 0x80) | 871 if (c < 0x80) |
815 return 0; // Basic Latin | 872 return 0; // Basic Latin |
816 else if (c < 0x100) | 873 else if (c < 0x100) |
1095 NULL /* otf_drive */ | 1152 NULL /* otf_drive */ |
1096 }; | 1153 }; |
1097 | 1154 |
1098 /* Initialize the font subsystem for the environment on which | 1155 /* Initialize the font subsystem for the environment on which |
1099 Emacs is running. */ | 1156 Emacs is running. */ |
1100 void w32font_initialize () | 1157 void |
1158 w32font_initialize () | |
1101 { | 1159 { |
1102 /* Load functions that might not exist on older versions of Windows. */ | 1160 /* Load functions that might not exist on older versions of Windows. */ |
1103 HANDLE gdi = LoadLibrary ("gdi32.dll"); | 1161 HANDLE gdi = LoadLibrary ("gdi32.dll"); |
1104 | 1162 |
1105 get_glyph_indices_fn | 1163 get_glyph_indices_fn |
1108 = (GETTEXTEXTENTPTI) GetProcAddress (gdi, "GetTextExtentPoint32W"); | 1166 = (GETTEXTEXTENTPTI) GetProcAddress (gdi, "GetTextExtentPoint32W"); |
1109 } | 1167 } |
1110 | 1168 |
1111 /* Initialize state that does not change between invocations. This is only | 1169 /* Initialize state that does not change between invocations. This is only |
1112 called when Emacs is dumped. */ | 1170 called when Emacs is dumped. */ |
1113 void syms_of_w32font () | 1171 void |
1172 syms_of_w32font () | |
1114 { | 1173 { |
1115 DEFSYM (Qw32, "w32"); | 1174 DEFSYM (Qw32, "w32"); |
1116 DEFSYM (Qdecorative, "decorative"); | 1175 DEFSYM (Qdecorative, "decorative"); |
1117 DEFSYM (Qmodern, "modern"); | 1176 DEFSYM (Qmodern, "modern"); |
1118 DEFSYM (Qroman, "roman"); | 1177 DEFSYM (Qroman, "roman"); |
1119 DEFSYM (Qscript, "script"); | 1178 DEFSYM (Qscript, "script"); |
1120 DEFSYM (Qswiss, "swiss"); | 1179 DEFSYM (Qswiss, "swiss"); |
1121 DEFSYM (Qunknown, "unknown"); | 1180 DEFSYM (Qunknown, "unknown"); |
1122 DEFSYM (QCsubranges, ":unicode-subranges"); | 1181 DEFSYM (QCsubranges, ":subranges"); |
1123 w32font_driver.type = Qw32; | 1182 w32font_driver.type = Qw32; |
1124 register_font_driver (&w32font_driver, NULL); | 1183 register_font_driver (&w32font_driver, NULL); |
1125 } | 1184 } |