aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2006-06-21 01:24:36 +0000
committerKenichi Handa2006-06-21 01:24:36 +0000
commit1b834a8d5833c4d4b2151f3808d15a8d9e1795b0 (patch)
tree55f94bdc71f0f894a3e8fada4a171104a2950b61 /src
parente2d0c925ec6b73f064ef1bb0aac7a1cb78591bd2 (diff)
downloademacs-1b834a8d5833c4d4b2151f3808d15a8d9e1795b0.tar.gz
emacs-1b834a8d5833c4d4b2151f3808d15a8d9e1795b0.zip
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
(font_has_char): Accept font-object too. (font_find_for_lface): Try at first with a size specified in face.
Diffstat (limited to 'src')
-rw-r--r--src/font.c59
1 files changed, 47 insertions, 12 deletions
diff --git a/src/font.c b/src/font.c
index 050ad8cdf0e..bd18d1a3ce7 100644
--- a/src/font.c
+++ b/src/font.c
@@ -862,7 +862,8 @@ font_parse_xlfd (name, font, merge)
862 { 862 {
863 if (! NILP (f[XLFD_ENCODING_INDEX])) 863 if (! NILP (f[XLFD_ENCODING_INDEX]))
864 f[XLFD_REGISTRY_INDEX] 864 f[XLFD_REGISTRY_INDEX]
865 = Fintern (concat2 (SYMBOL_NAME (f[XLFD_REGISTRY_INDEX]), 865 = Fintern (concat3 (SYMBOL_NAME (f[XLFD_REGISTRY_INDEX]),
866 build_string ("-"),
866 SYMBOL_NAME (f[XLFD_ENCODING_INDEX])), Qnil); 867 SYMBOL_NAME (f[XLFD_ENCODING_INDEX])), Qnil);
867 } 868 }
868 } 869 }
@@ -2240,20 +2241,39 @@ font_close_object (f, font_object)
2240} 2241}
2241 2242
2242int 2243int
2243font_has_char (f, font_entity, c) 2244font_has_char (f, font, c)
2244 FRAME_PTR f; 2245 FRAME_PTR f;
2245 Lisp_Object font_entity; 2246 Lisp_Object font;
2246 int c; 2247 int c;
2247{ 2248{
2248 Lisp_Object type = AREF (font_entity, FONT_TYPE_INDEX); 2249 struct font *fontp;
2249 struct font_driver_list *driver_list;
2250 2250
2251 for (driver_list = f->font_driver_list; 2251 if (FONT_ENTITY_P (font))
2252 driver_list && ! EQ (driver_list->driver->type, type); 2252 {
2253 driver_list = driver_list->next); 2253 Lisp_Object type = AREF (font, FONT_TYPE_INDEX);
2254 if (! driver_list) 2254 struct font_driver_list *driver_list;
2255 return -1; 2255
2256 return driver_list->driver->has_char (font_entity, c); 2256 for (driver_list = f->font_driver_list;
2257 driver_list && ! EQ (driver_list->driver->type, type);
2258 driver_list = driver_list->next);
2259 if (! driver_list)
2260 return 0;
2261 if (! driver_list->driver->has_char)
2262 return -1;
2263 return driver_list->driver->has_char (font, c);
2264 }
2265
2266 xassert (FONT_OBJECT_P (font));
2267 fontp = XSAVE_VALUE (font)->pointer;
2268
2269 if (fontp->driver->has_char)
2270 {
2271 int result = fontp->driver->has_char (fontp->entity, c);
2272
2273 if (result >= 0)
2274 return result;
2275 }
2276 return (fontp->driver->encode_char (fontp, c) != FONT_INVALID_CODE);
2257} 2277}
2258 2278
2259unsigned 2279unsigned
@@ -2328,11 +2348,26 @@ font_find_for_lface (f, lface, spec)
2328 if (NILP (AREF (scratch_font_spec, FONT_REGISTRY_INDEX))) 2348 if (NILP (AREF (scratch_font_spec, FONT_REGISTRY_INDEX)))
2329 ASET (scratch_font_spec, FONT_REGISTRY_INDEX, intern ("iso8859-1")); 2349 ASET (scratch_font_spec, FONT_REGISTRY_INDEX, intern ("iso8859-1"));
2330 2350
2351 if (NILP (AREF (scratch_font_spec, FONT_SIZE_INDEX))
2352 && ! NILP (lface[LFACE_HEIGHT_INDEX]))
2353 {
2354 double pt = XINT (lface[LFACE_HEIGHT_INDEX]);
2355 int pixel_size = POINT_TO_PIXEL (pt / 10, f->resy);
2356
2357 ASET (scratch_font_spec, FONT_SIZE_INDEX, make_number (pixel_size));
2358 }
2359
2331 XSETFRAME (frame, f); 2360 XSETFRAME (frame, f);
2332 entities = font_list_entities (frame, scratch_font_spec); 2361 entities = font_list_entities (frame, scratch_font_spec);
2333 while (ASIZE (entities) == 0) 2362 while (ASIZE (entities) == 0)
2334 { 2363 {
2335 if (! NILP (AREF (scratch_font_spec, FONT_FOUNDRY_INDEX)) 2364 if (! NILP (AREF (scratch_font_spec, FONT_SIZE_INDEX))
2365 && (NILP (spec) || NILP (AREF (spec, FONT_SIZE_INDEX))))
2366 {
2367 ASET (scratch_font_spec, FONT_SIZE_INDEX, Qnil);
2368 entities = font_list_entities (frame, scratch_font_spec);
2369 }
2370 else if (! NILP (AREF (scratch_font_spec, FONT_FOUNDRY_INDEX))
2336 && (NILP (spec) || NILP (AREF (spec, FONT_FOUNDRY_INDEX)))) 2371 && (NILP (spec) || NILP (AREF (spec, FONT_FOUNDRY_INDEX))))
2337 { 2372 {
2338 ASET (scratch_font_spec, FONT_FOUNDRY_INDEX, Qnil); 2373 ASET (scratch_font_spec, FONT_FOUNDRY_INDEX, Qnil);