all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `set-fontset-font' and ascii characters
@ 2003-04-27 10:22 Oliver Scholz
  2003-05-01  8:10 ` Kenichi Handa
  0 siblings, 1 reply; 18+ messages in thread
From: Oliver Scholz @ 2003-04-27 10:22 UTC (permalink / 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é!

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2003-06-10  2:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-27 10:22 `set-fontset-font' and ascii characters Oliver Scholz
2003-05-01  8:10 ` 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.