From: Oliver Scholz <alkibiades@gmx.de>
Subject: `set-fontset-font' and ascii characters
Date: Sun, 27 Apr 2003 12:22:15 +0200 [thread overview]
Message-ID: <87he8kutns.fsf@ID-87814.user.dfncis.de> (raw)
Is there any special reason why `set-fontset-font' should raise an
error, if CHARACTER specifies a single byte char? The patch below
seems to work, but I may be missing something.
Oliver
*** fontset.c.~1.73.~ Fri Jan 17 09:10:00 2003
--- fontset.c Sun Apr 27 12:05:48 2003
***************
*** 992,997 ****
--- 992,999 ----
int from, to;
int id;
Lisp_Object family, registry;
+ int sbyte_change = 0; /* Flag indicating that CHARACTER specifies
+ the `ascii' charset. */
fontset = check_fontset_name (name);
***************
*** 1007,1013 ****
error ("Character range should be by non-generic characters.");
if (!NILP (name)
&& (SINGLE_BYTE_CHAR_P (from) || SINGLE_BYTE_CHAR_P (to)))
! error ("Can't change font for a single byte character");
}
else if (SYMBOLP (character))
{
--- 1009,1015 ----
error ("Character range should be by non-generic characters.");
if (!NILP (name)
&& (SINGLE_BYTE_CHAR_P (from) || SINGLE_BYTE_CHAR_P (to)))
! sbyte_change = 1;
}
else if (SYMBOLP (character))
{
***************
*** 1026,1038 ****
if (!char_valid_p (from, 1))
invalid_character (from);
if (SINGLE_BYTE_CHAR_P (from))
! error ("Can't change font for a single byte character");
if (from < to)
{
if (!char_valid_p (to, 1))
invalid_character (to);
if (SINGLE_BYTE_CHAR_P (to))
! error ("Can't change font for a single byte character");
}
if (STRINGP (fontname))
--- 1028,1040 ----
if (!char_valid_p (from, 1))
invalid_character (from);
if (SINGLE_BYTE_CHAR_P (from))
! sbyte_change = 1;
if (from < to)
{
if (!char_valid_p (to, 1))
invalid_character (to);
if (SINGLE_BYTE_CHAR_P (to))
! sbyte_change = 1;
}
if (STRINGP (fontname))
***************
*** 1067,1088 ****
FONTSET_SET (fontset, from, elt);
Foptimize_char_table (fontset);
! /* If there's a realized fontset REALIZED whose parent is FONTSET,
! clear all the elements of REALIZED and free all multibyte faces
! whose fontset is REALIZED. This way, the specified character(s)
! are surely redisplayed by a correct font. */
! for (id = 0; id < ASIZE (Vfontset_table); id++)
! {
! realized = AREF (Vfontset_table, id);
! if (!NILP (realized)
! && !BASE_FONTSET_P (realized)
! && EQ (FONTSET_BASE (realized), fontset))
! {
! FRAME_PTR f = XFRAME (FONTSET_FRAME (realized));
! clear_fontset_elements (realized);
! free_realized_multibyte_face (f, id);
! }
! }
return Qnil;
}
--- 1069,1100 ----
FONTSET_SET (fontset, from, elt);
Foptimize_char_table (fontset);
! if (sbyte_change)
! {
! /* The ascii charset needs a special treatment in order to make
! sure that it is redisplayed in the correct font. The
! following (stolen from `internal-set-lisp-face-attribute')
! makes sure that the next call to init_iterator will free all
! realized faces. */
! ++face_change_count;
! ++windows_or_buffers_changed;
! } else {
! /* If there's a realized fontset REALIZED whose parent is FONTSET,
! clear all the elements of REALIZED and free all multibyte faces
! whose fontset is REALIZED. This way, the specified character(s)
! are surely redisplayed by a correct font. */
! for (id = 0; id < ASIZE (Vfontset_table); id++)
! {
! realized = AREF (Vfontset_table, id);
! if (!NILP (realized)
! && !BASE_FONTSET_P (realized)
! && EQ (FONTSET_BASE (realized), fontset))
! {
! FRAME_PTR f = XFRAME (FONTSET_FRAME (realized));
! clear_fontset_elements (realized);
! free_realized_multibyte_face (f, id);
! }
! }}
return Qnil;
}
--
8 Floréal an 211 de la Révolution
Liberté, Egalité, Fraternité!
next reply other threads:[~2003-04-27 10:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-27 10:22 Oliver Scholz [this message]
2003-05-01 8:10 ` `set-fontset-font' and ascii characters Kenichi Handa
2003-05-01 17:48 ` Oliver Scholz
2003-05-01 20:01 ` Oliver Scholz
2003-05-01 23:53 ` Kenichi Handa
2003-05-02 0:06 ` Kenichi Handa
2003-05-02 0:39 ` Oliver Scholz
2003-05-02 1:05 ` Kenichi Handa
2003-05-02 23:16 ` Oliver Scholz
2003-05-03 2:48 ` Kenichi Handa
2003-05-03 22:24 ` Oliver Scholz
2003-05-05 8:33 ` Kenichi Handa
2003-05-06 13:48 ` Oliver Scholz
2003-05-07 1:12 ` Kenichi Handa
2003-05-25 12:17 ` Oliver Scholz
2003-06-10 2:16 ` Kenichi Handa
2003-06-10 2:47 ` Stefan Monnier
2003-05-02 7:06 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87he8kutns.fsf@ID-87814.user.dfncis.de \
--to=alkibiades@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).