aboutsummaryrefslogtreecommitdiffstats
path: root/src/ftfont.c
diff options
context:
space:
mode:
authorKenichi Handa2007-12-09 12:29:51 +0000
committerKenichi Handa2007-12-09 12:29:51 +0000
commit169638172bb43a2bcc717e835258ef3bb5dcc4a9 (patch)
tree7485f3da36c3803babfa8964fdc85af45941248a /src/ftfont.c
parent6a5168e8ecf8a3070a96bd261b624db6f6503196 (diff)
downloademacs-169638172bb43a2bcc717e835258ef3bb5dcc4a9.tar.gz
emacs-169638172bb43a2bcc717e835258ef3bb5dcc4a9.zip
(struct OpenTypeSpec): Members script_tag renamed to
script, langsys_tag renamed to langsys, new member script. (OTF_TAG_STR): Terminate by '\0'. (ftfont_get_open_type_spec): If :otf prop is is spec, Limit the listing to the script specified in that property. Fix arg to OTF_check_features.
Diffstat (limited to 'src/ftfont.c')
-rw-r--r--src/ftfont.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/ftfont.c b/src/ftfont.c
index f64a60ade15..11715fbbfff 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -324,7 +324,8 @@ ftfont_get_cache (frame)
324 324
325struct OpenTypeSpec 325struct OpenTypeSpec
326{ 326{
327 unsigned int script, langsys; 327 Lisp_Object script;
328 unsigned int script_tag, langsys_tag;
328 int nfeatures[2]; 329 int nfeatures[2];
329 unsigned int *features[2]; 330 unsigned int *features[2];
330}; 331};
@@ -341,6 +342,7 @@ struct OpenTypeSpec
341 (P)[1] = (char) ((TAG >> 16) & 0xFF); \ 342 (P)[1] = (char) ((TAG >> 16) & 0xFF); \
342 (P)[2] = (char) ((TAG >> 8) & 0xFF); \ 343 (P)[2] = (char) ((TAG >> 8) & 0xFF); \
343 (P)[3] = (char) (TAG & 0xFF); \ 344 (P)[3] = (char) (TAG & 0xFF); \
345 (P)[4] = '\0'; \
344 } while (0) 346 } while (0)
345 347
346static struct OpenTypeSpec * 348static struct OpenTypeSpec *
@@ -352,17 +354,24 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
352 354
353 if (! spec) 355 if (! spec)
354 return NULL; 356 return NULL;
355 val = XCAR (otf_spec); 357 spec->script = XCAR (otf_spec);
356 if (! NILP (val)) 358 if (! NILP (val))
357 OTF_SYM_TAG (val, spec->script); 359 {
360 OTF_SYM_TAG (spec->script, spec->script_tag);
361 val = assq_no_quit (spec->script, Votf_script_alist);
362 if (CONSP (val) && SYMBOLP (XCDR (val)))
363 spec->script = XCDR (val);
364 else
365 spec->script = Qnil;
366 }
358 else 367 else
359 spec->script = 0x44464C54; /* "DFLT" */ 368 spec->script_tag = 0x44464C54; /* "DFLT" */
360 otf_spec = XCDR (otf_spec); 369 otf_spec = XCDR (otf_spec);
361 val = XCAR (otf_spec); 370 val = XCAR (otf_spec);
362 if (! NILP (val)) 371 if (! NILP (val))
363 OTF_SYM_TAG (val, spec->langsys); 372 OTF_SYM_TAG (val, spec->langsys_tag);
364 else 373 else
365 spec->langsys = 0; 374 spec->langsys_tag = 0;
366 spec->nfeatures[0] = spec->nfeatures[1] = 0; 375 spec->nfeatures[0] = spec->nfeatures[1] = 0;
367 for (i = 0; i < 2; i++) 376 for (i = 0; i < 2; i++)
368 { 377 {
@@ -464,10 +473,11 @@ ftfont_list (frame, spec)
464 if (EQ (key, QCotf)) 473 if (EQ (key, QCotf))
465 { 474 {
466 otspec = ftfont_get_open_type_spec (val); 475 otspec = ftfont_get_open_type_spec (val);
467 if (otspec) 476 if (! otspec)
468 return null_vector; 477 return null_vector;
469 strcat (otlayout, "otlayout:"); 478 strcat (otlayout, "otlayout:");
470 OTF_TAG_STR (otspec->script, otlayout + 9); 479 OTF_TAG_STR (otspec->script_tag, otlayout + 9);
480 script = otspec->script;
471 } 481 }
472 else if (EQ (key, QClanguage)) 482 else if (EQ (key, QClanguage))
473 { 483 {
@@ -634,12 +644,12 @@ ftfont_list (frame, spec)
634 otf = OTF_open ((char *) file); 644 otf = OTF_open ((char *) file);
635 if (! otf) 645 if (! otf)
636 continue; 646 continue;
637 if (OTF_check_features (otf, 0, 647 if (OTF_check_features (otf, 1,
638 otspec->script, otspec->langsys, 648 otspec->script_tag, otspec->langsys_tag,
639 otspec->features[0], 649 otspec->features[0],
640 otspec->nfeatures[0]) != 1 650 otspec->nfeatures[0]) != 1
641 || OTF_check_features (otf, 1, 651 || OTF_check_features (otf, 0,
642 otspec->script, otspec->langsys, 652 otspec->script_tag, otspec->langsys_tag,
643 otspec->features[1], 653 otspec->features[1],
644 otspec->nfeatures[1]) != 1) 654 otspec->nfeatures[1]) != 1)
645 continue; 655 continue;