*** fontset.c.~1.76.~ Thu Feb 20 15:13:04 2003 --- fontset.c Thu May 1 19:31:18 2003 *************** *** 36,41 **** --- 36,42 ---- #include "dispextern.h" #include "fontset.h" #include "window.h" + #include "xterm.h" #ifdef FONTSET_DEBUG #undef xassert *************** *** 993,998 **** --- 994,1001 ---- 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); *************** *** 1008,1014 **** 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)) { --- 1011,1017 ---- 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)) { *************** *** 1027,1039 **** 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)) --- 1030,1042 ---- 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)) *************** *** 1068,1089 **** 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; } --- 1071,1119 ---- FONTSET_SET (fontset, from, elt); Foptimize_char_table (fontset); ! /* Make sure that Emacs displays all faces with the correct ! font. The ascii charset needs a special treatment.*/ ! if (sbyte_change) ! { ! Lisp_Object fr_list; ! FRAME_PTR frpt; ! ! /* Check all frames whether they have FONTSET as the fontset for ! the default face. If so, make sure that Emacs changes the ! size of the frame accordingly. */ ! for (fr_list = Vframe_list; ! CONSP (fr_list); ! fr_list = XCDR (fr_list)) { ! frpt = XFRAME (XCAR (fr_list)); ! if (FONTSET_ID (fontset) == FRAME_FONTSET (frpt)) ! { ! Lisp_Object fpvalue = get_frame_param (frpt, Qfont); ! x_new_fontset_force (frpt, SDATA (fpvalue)); ! } } ! /* Make sure that the next call to init_iterator will free all ! realized faces (stolen from ! `internal-set-lisp-face-attribute'). */ ! ++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; }