[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src fontset.c [EMACS_23_1_RC]
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] emacs/src fontset.c [EMACS_23_1_RC] |
Date: |
Fri, 03 Jul 2009 02:10:39 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Branch: EMACS_23_1_RC
Changes by: Kenichi Handa <handa> 09/07/03 02:10:39
Modified files:
src : fontset.c
Log message:
(fontset_find_font): Re-order a fallback font-group.
(fontset_font): Treat return value t of fontset_find_font as a
sign of no-font in that fontset, not as a sign of no-font
anywhere.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/fontset.c?cvsroot=emacs&only_with_tag=EMACS_23_1_RC&r1=1.173&r2=1.173.2.1
Patches:
Index: fontset.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fontset.c,v
retrieving revision 1.173
retrieving revision 1.173.2.1
diff -u -b -r1.173 -r1.173.2.1
--- fontset.c 8 Jun 2009 04:33:40 -0000 1.173
+++ fontset.c 3 Jul 2009 02:10:38 -0000 1.173.2.1
@@ -525,6 +525,8 @@
{
Lisp_Object vec, font_group;
int i, charset_matched = -1;
+ Lisp_Object rfont_def;
+ int found_index;
FRAME_PTR f = (FRAMEP (FONTSET_FRAME (fontset)))
? XFRAME (selected_frame) : XFRAME (FONTSET_FRAME (fontset));
@@ -564,21 +566,22 @@
/* Find the first available font in the vector of RFONT-DEF. */
for (i = 0; i < ASIZE (vec); i++)
{
- Lisp_Object rfont_def, font_def;
+ Lisp_Object font_def;
Lisp_Object font_entity, font_object;
if (i == 0 && charset_matched >= 0)
{
/* Try the element matching with the charset ID at first. */
- rfont_def = AREF (vec, charset_matched);
+ found_index = charset_matched;
charset_matched = -1;
i--;
}
else if (i != charset_matched)
- rfont_def = AREF (vec, i);
+ found_index = i;
else
continue;
+ rfont_def = AREF (vec, found_index);
if (NILP (rfont_def))
/* This is a sign of not to try the other fonts. */
return Qt;
@@ -623,7 +626,7 @@
}
if (font_has_char (f, font_object, c))
- return rfont_def;
+ goto found;
/* Find a font already opened, maching with the current spec,
and supporting C. */
@@ -637,7 +640,7 @@
break;
font_object = RFONT_DEF_OBJECT (AREF (vec, i));
if (! NILP (font_object) && font_has_char (f, font_object, c))
- return rfont_def;
+ goto found;
}
/* Find a font-entity with the current spec and supporting C. */
@@ -661,10 +664,12 @@
for (j = 0; j < i; j++)
ASET (new_vec, j, AREF (vec, j));
ASET (new_vec, j, rfont_def);
+ found_index = j;
for (j++; j < ASIZE (new_vec); j++)
ASET (new_vec, j, AREF (vec, j - 1));
XSETCDR (font_group, new_vec);
- return rfont_def;
+ vec = new_vec;
+ goto found;
}
/* No font of the current spec for C. Try the next spec. */
@@ -673,6 +678,20 @@
FONTSET_SET (fontset, make_number (c), make_number (0));
return Qnil;
+
+ found:
+ if (fallback && found_index > 0)
+ {
+ /* The order of fonts in the fallback font-group is not that
+ important, and it is better to move the found font to the
+ first of the group so that the next try will find it
+ quickly. */
+ for (i = found_index; i > 0; i--)
+ ASET (vec, i, AREF (vec, i - 1));
+ ASET (vec, 0, rfont_def);
+ found_index = 0;
+ }
+ return rfont_def;
}
@@ -685,13 +704,14 @@
{
Lisp_Object rfont_def;
Lisp_Object base_fontset;
+ int try_fallback = 0, try_default_fallback = 0;
/* Try a font-group of FONTSET. */
rfont_def = fontset_find_font (fontset, c, face, id, 0);
if (VECTORP (rfont_def))
return rfont_def;
- if (EQ (rfont_def, Qt))
- goto no_font;
+ if (! EQ (rfont_def, Qt))
+ try_fallback = 1;
/* Try a font-group of the default fontset. */
base_fontset = FONTSET_BASE (fontset);
@@ -703,29 +723,30 @@
rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id,
0);
if (VECTORP (rfont_def))
return rfont_def;
- if (EQ (rfont_def, Qt))
- goto no_font;
+ if (! EQ (rfont_def, Qt))
+ try_default_fallback = 1;
}
/* Try a fallback font-group of FONTSET. */
+ if (try_fallback)
+ {
rfont_def = fontset_find_font (fontset, c, face, id, 1);
if (VECTORP (rfont_def))
return rfont_def;
- if (EQ (rfont_def, Qt))
- goto no_font;
+ /* Remember that FONTSET has no font for C. */
+ FONTSET_SET (fontset, make_number (c), Qt);
+ }
/* Try a fallback font-group of the default fontset . */
- if (! EQ (base_fontset, Vdefault_fontset))
+ if (try_default_fallback)
{
rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id,
1);
if (VECTORP (rfont_def))
return rfont_def;
+ /* Remember that the default fontset has no font for C. */
+ FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c), Qt);
}
- no_font:
- /* Remember that we have no font for C. */
- FONTSET_SET (fontset, make_number (c), Qt);
-
return Qnil;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/src fontset.c [EMACS_23_1_RC],
Kenichi Handa <=