Mercurial > emacs
comparison src/w32uniscribe.c @ 109426:812261a6ffd2
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Tue, 06 Jul 2010 22:53:26 +0000 |
parents | e27859da5624 |
children | f8660b83cdbf |
comparison
equal
deleted
inserted
replaced
109425:773dc1704474 | 109426:812261a6ffd2 |
---|---|
62 DWORD, LPARAM); | 62 DWORD, LPARAM); |
63 /* Used by uniscribe_otf_capability. */ | 63 /* Used by uniscribe_otf_capability. */ |
64 static Lisp_Object otf_features (HDC context, char *table); | 64 static Lisp_Object otf_features (HDC context, char *table); |
65 | 65 |
66 static int | 66 static int |
67 memq_no_quit (elt, list) | 67 memq_no_quit (Lisp_Object elt, Lisp_Object list) |
68 Lisp_Object elt, list; | |
69 { | 68 { |
70 while (CONSP (list) && ! EQ (XCAR (list), elt)) | 69 while (CONSP (list) && ! EQ (XCAR (list), elt)) |
71 list = XCDR (list); | 70 list = XCDR (list); |
72 return (CONSP (list)); | 71 return (CONSP (list)); |
73 } | 72 } |
74 | 73 |
75 | 74 |
76 /* Font backend interface implementation. */ | 75 /* Font backend interface implementation. */ |
77 static Lisp_Object | 76 static Lisp_Object |
78 uniscribe_list (frame, font_spec) | 77 uniscribe_list (Lisp_Object frame, Lisp_Object font_spec) |
79 Lisp_Object frame, font_spec; | |
80 { | 78 { |
81 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1); | 79 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1); |
82 FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); | 80 FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); |
83 return fonts; | 81 return fonts; |
84 } | 82 } |
85 | 83 |
86 static Lisp_Object | 84 static Lisp_Object |
87 uniscribe_match (frame, font_spec) | 85 uniscribe_match (Lisp_Object frame, Lisp_Object font_spec) |
88 Lisp_Object frame, font_spec; | |
89 { | 86 { |
90 Lisp_Object entity = w32font_match_internal (frame, font_spec, 1); | 87 Lisp_Object entity = w32font_match_internal (frame, font_spec, 1); |
91 FONT_ADD_LOG ("uniscribe-match", font_spec, entity); | 88 FONT_ADD_LOG ("uniscribe-match", font_spec, entity); |
92 return entity; | 89 return entity; |
93 } | 90 } |
94 | 91 |
95 static Lisp_Object | 92 static Lisp_Object |
96 uniscribe_list_family (frame) | 93 uniscribe_list_family (Lisp_Object frame) |
97 Lisp_Object frame; | |
98 { | 94 { |
99 Lisp_Object list = Qnil; | 95 Lisp_Object list = Qnil; |
100 LOGFONT font_match_pattern; | 96 LOGFONT font_match_pattern; |
101 HDC dc; | 97 HDC dc; |
102 FRAME_PTR f = XFRAME (frame); | 98 FRAME_PTR f = XFRAME (frame); |
114 | 110 |
115 return list; | 111 return list; |
116 } | 112 } |
117 | 113 |
118 static Lisp_Object | 114 static Lisp_Object |
119 uniscribe_open (f, font_entity, pixel_size) | 115 uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) |
120 FRAME_PTR f; | |
121 Lisp_Object font_entity; | |
122 int pixel_size; | |
123 { | 116 { |
124 Lisp_Object font_object | 117 Lisp_Object font_object |
125 = font_make_object (VECSIZE (struct uniscribe_font_info), | 118 = font_make_object (VECSIZE (struct uniscribe_font_info), |
126 font_entity, pixel_size); | 119 font_entity, pixel_size); |
127 struct uniscribe_font_info *uniscribe_font | 120 struct uniscribe_font_info *uniscribe_font |
146 | 139 |
147 return font_object; | 140 return font_object; |
148 } | 141 } |
149 | 142 |
150 static void | 143 static void |
151 uniscribe_close (f, font) | 144 uniscribe_close (FRAME_PTR f, struct font *font) |
152 FRAME_PTR f; | |
153 struct font *font; | |
154 { | 145 { |
155 struct uniscribe_font_info *uniscribe_font | 146 struct uniscribe_font_info *uniscribe_font |
156 = (struct uniscribe_font_info *) font; | 147 = (struct uniscribe_font_info *) font; |
157 | 148 |
158 if (uniscribe_font->cache) | 149 if (uniscribe_font->cache) |
162 } | 153 } |
163 | 154 |
164 /* Return a list describing which scripts/languages FONT supports by | 155 /* Return a list describing which scripts/languages FONT supports by |
165 which GSUB/GPOS features of OpenType tables. */ | 156 which GSUB/GPOS features of OpenType tables. */ |
166 static Lisp_Object | 157 static Lisp_Object |
167 uniscribe_otf_capability (font) | 158 uniscribe_otf_capability (struct font *font) |
168 struct font *font; | |
169 { | 159 { |
170 HDC context; | 160 HDC context; |
171 HFONT old_font; | 161 HFONT old_font; |
172 struct frame *f; | 162 struct frame *f; |
173 Lisp_Object capability = Fcons (Qnil, Qnil); | 163 Lisp_Object capability = Fcons (Qnil, Qnil); |
200 through (M)th elements of LGSTRING are updated possibly by making | 190 through (M)th elements of LGSTRING are updated possibly by making |
201 a new glyph object and storing it in LGSTRING. If (M) is greater | 191 a new glyph object and storing it in LGSTRING. If (M) is greater |
202 than the length of LGSTRING, nil should be return. In that case, | 192 than the length of LGSTRING, nil should be return. In that case, |
203 this function is called again with the larger LGSTRING. */ | 193 this function is called again with the larger LGSTRING. */ |
204 static Lisp_Object | 194 static Lisp_Object |
205 uniscribe_shape (lgstring) | 195 uniscribe_shape (Lisp_Object lgstring) |
206 Lisp_Object lgstring; | |
207 { | 196 { |
208 struct font * font; | 197 struct font * font; |
209 struct uniscribe_font_info * uniscribe_font; | 198 struct uniscribe_font_info * uniscribe_font; |
210 EMACS_UINT nchars; | 199 EMACS_UINT nchars; |
211 int nitems, max_items, i, max_glyphs, done_glyphs; | 200 int nitems, max_items, i, max_glyphs, done_glyphs; |
449 | 438 |
450 /* Uniscribe implementation of encode_char for font backend. | 439 /* Uniscribe implementation of encode_char for font backend. |
451 Return a glyph code of FONT for characer C (Unicode code point). | 440 Return a glyph code of FONT for characer C (Unicode code point). |
452 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ | 441 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ |
453 static unsigned | 442 static unsigned |
454 uniscribe_encode_char (font, c) | 443 uniscribe_encode_char (struct font *font, int c) |
455 struct font *font; | |
456 int c; | |
457 { | 444 { |
458 HDC context = NULL; | 445 HDC context = NULL; |
459 struct frame *f = NULL; | 446 struct frame *f = NULL; |
460 HFONT old_font = NULL; | 447 HFONT old_font = NULL; |
461 unsigned code = FONT_INVALID_CODE; | 448 unsigned code = FONT_INVALID_CODE; |
572 | 559 |
573 /* Callback function for EnumFontFamiliesEx. | 560 /* Callback function for EnumFontFamiliesEx. |
574 Adds the name of opentype fonts to a Lisp list (passed in as the | 561 Adds the name of opentype fonts to a Lisp list (passed in as the |
575 lParam arg). */ | 562 lParam arg). */ |
576 static int CALLBACK | 563 static int CALLBACK |
577 add_opentype_font_name_to_list (logical_font, physical_font, font_type, | 564 add_opentype_font_name_to_list (ENUMLOGFONTEX *logical_font, |
578 list_object) | 565 NEWTEXTMETRICEX *physical_font, |
579 ENUMLOGFONTEX *logical_font; | 566 DWORD font_type, LPARAM list_object) |
580 NEWTEXTMETRICEX *physical_font; | |
581 DWORD font_type; | |
582 LPARAM list_object; | |
583 { | 567 { |
584 Lisp_Object* list = (Lisp_Object *) list_object; | 568 Lisp_Object* list = (Lisp_Object *) list_object; |
585 Lisp_Object family; | 569 Lisp_Object family; |
586 | 570 |
587 /* Skip vertical fonts (intended only for printing) */ | 571 /* Skip vertical fonts (intended only for printing) */ |
648 #define SNAME(VAL) SDATA (SYMBOL_NAME (VAL)) | 632 #define SNAME(VAL) SDATA (SYMBOL_NAME (VAL)) |
649 | 633 |
650 /* Check if font supports the otf script/language/features specified. | 634 /* Check if font supports the otf script/language/features specified. |
651 OTF_SPEC is in the format | 635 OTF_SPEC is in the format |
652 (script lang [(gsub_feature ...)|nil] [(gpos_feature ...)]?) */ | 636 (script lang [(gsub_feature ...)|nil] [(gpos_feature ...)]?) */ |
653 int uniscribe_check_otf (font, otf_spec) | 637 int |
654 LOGFONT *font; | 638 uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec) |
655 Lisp_Object otf_spec; | |
656 { | 639 { |
657 Lisp_Object script, lang, rest; | 640 Lisp_Object script, lang, rest; |
658 Lisp_Object features[2]; | 641 Lisp_Object features[2]; |
659 DWORD feature_tables[2]; | 642 DWORD feature_tables[2]; |
660 DWORD script_tag, default_script, lang_tag = 0; | 643 DWORD script_tag, default_script, lang_tag = 0; |
945 NULL, /* get_bitmap */ | 928 NULL, /* get_bitmap */ |
946 NULL, /* free_bitmap */ | 929 NULL, /* free_bitmap */ |
947 NULL, /* get_outline */ | 930 NULL, /* get_outline */ |
948 NULL, /* free_outline */ | 931 NULL, /* free_outline */ |
949 NULL, /* anchor_point */ | 932 NULL, /* anchor_point */ |
950 uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ | 933 uniscribe_otf_capability, /* Defined so (font-get FONTOBJ :otf) works. */ |
951 NULL, /* otf_drive - use shape instead. */ | 934 NULL, /* otf_drive - use shape instead. */ |
952 NULL, /* start_for_frame */ | 935 NULL, /* start_for_frame */ |
953 NULL, /* end_for_frame */ | 936 NULL, /* end_for_frame */ |
954 uniscribe_shape | 937 uniscribe_shape |
955 }; | 938 }; |
956 | 939 |
957 /* Note that this should be called at every startup, not just when dumping, | 940 /* Note that this should be called at every startup, not just when dumping, |
958 as it needs to test for the existence of the Uniscribe library. */ | 941 as it needs to test for the existence of the Uniscribe library. */ |
959 void | 942 void |
960 syms_of_w32uniscribe () | 943 syms_of_w32uniscribe (void) |
961 { | 944 { |
962 HMODULE uniscribe; | 945 HMODULE uniscribe; |
963 | 946 |
964 /* Don't init uniscribe when dumping */ | 947 /* Don't init uniscribe when dumping */ |
965 if (!initialized) | 948 if (!initialized) |