[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/ftfont.c,v
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] Changes to emacs/src/ftfont.c,v |
Date: |
Mon, 01 Sep 2008 02:46:23 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kenichi Handa <handa> 08/09/01 02:46:23
Index: ftfont.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ftfont.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- ftfont.c 29 Aug 2008 07:56:10 -0000 1.28
+++ ftfont.c 1 Sep 2008 02:46:23 -0000 1.29
@@ -673,7 +673,7 @@
{
Lisp_Object chars = assq_no_quit (script, Vscript_representative_chars);
- if (CONSP (chars))
+ if (CONSP (chars) && CONSP (CDR (chars)))
{
charset = FcCharSetCreate ();
if (! charset)
@@ -744,6 +744,9 @@
FcPattern *pattern;
FcFontSet *fontset = NULL;
FcObjectSet *objset = NULL;
+ FcCharSet *charset;
+ Lisp_Object chars = Qnil;
+ FcResult result;
char otlayout[15]; /* For "otlayout:XXXX" */
struct OpenTypeSpec *otspec = NULL;
int spacing = -1;
@@ -757,6 +760,17 @@
pattern = ftfont_spec_pattern (spec, otlayout, &otspec);
if (! pattern)
return Qnil;
+ if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) != FcResultMatch)
+ {
+ val = assq_no_quit (QCscript, AREF (spec, FONT_EXTRA_INDEX));
+ if (! NILP (val))
+ {
+ val = assq_no_quit (XCDR (val), Vscript_representative_chars);
+ if (CONSP (val) && VECTORP (XCDR (val)))
+ chars = XCDR (val);
+ }
+ val = Qnil;
+ }
if (INTEGERP (AREF (spec, FONT_SPACING_INDEX)))
spacing = XINT (AREF (spec, FONT_SPACING_INDEX));
family = AREF (spec, FONT_FAMILY_INDEX);
@@ -786,10 +800,12 @@
NULL);
if (! objset)
goto err;
+ if (! NILP (chars))
+ FcObjectSetAdd (objset, FC_CHARSET);
fontset = FcFontList (NULL, pattern, objset);
- if (! fontset)
- goto err;
+ if (! fontset || fontset->nfont == 0)
+ goto finish;
#if 0
/* Need fix because this finds any fonts. */
if (fontset->nfont == 0 && ! NILP (family))
@@ -836,8 +852,8 @@
{
FcChar8 *this;
- if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0,
- &this) != FcResultMatch
+ if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0, &this)
+ != FcResultMatch
|| ! strstr ((char *) this, otlayout))
continue;
}
@@ -865,12 +881,26 @@
continue;
}
#endif /* HAVE_LIBOTF */
+ if (VECTORP (chars))
+ {
+ int j;
+
+ if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset)
+ != FcResultMatch)
+ continue;
+ for (j = 0; j < ASIZE (chars); j++)
+ if (NATNUMP (AREF (chars, j))
+ && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j))))
+ break;
+ if (j == ASIZE (chars))
+ continue;
+ }
entity = ftfont_pattern_entity (fontset->fonts[i],
AREF (spec, FONT_EXTRA_INDEX));
if (! NILP (entity))
val = Fcons (entity, val);
}
- font_add_log ("ftfont-list", spec, val);
+ val = Fnreverse (val);
goto finish;
err:
@@ -879,6 +909,7 @@
val = Qnil;
finish:
+ font_add_log ("ftfont-list", spec, val);
if (objset) FcObjectSetDestroy (objset);
if (fontset) FcFontSetDestroy (fontset);
if (pattern) FcPatternDestroy (pattern);