unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: `set-fontset-font' and ascii characters
Date: Sat, 03 May 2003 01:16:29 +0200	[thread overview]
Message-ID: <87isstx7le.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: <200305020105.KAA16075@etlken.m17n.org> (Kenichi Handa's message of "Fri, 2 May 2003 10:05:14 +0900 (JST)")

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]

Kenichi Handa <handa@m17n.org> writes:

> In article <uade6ji5i.fsf@ID-87814.user.dfncis.de>, Oliver Scholz <alkibiades@gmx.de> writes:
>> I guess so. Basically that is how I discovered x_new_fontset. I
>> started with Finternal_set_lisp_face_attribute and read the code until
>> I found the exact spot where the frame is resized. And now you tell
>> me that all this was pointless, because I could have used
>> Finternal_set_lisp_face in the first place? *moan* :-)
>
> I should have got that idea from the start, sorry.  :-(

I was just kidding. It was a good opportunity to read and understand
yet another part of the C code. And I had fun doing it. So my time
was well applied.

>> Allright, if you say that it is cleaner or easier to maintain this
>> way, then I'll look at it tomorrow.
>
> Thank you very much.  That way, I think, fontset.c can be
> modularized much more, which results in the easier
> maintenance.

O.k. Here's the new patch.

It seems that free_realized_multibyte_face is not used anymore. But it
is defined in xfaces.c, so I didn't touch it.

    Oliver


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4126 bytes --]

*** fontset.c.~1.76.~	Thu Feb 20 15:13:04 2003
--- fontset.c	Sat May  3 01:09:28 2003
***************
*** 939,958 ****
    return Qnil;
  }
  
- 
- /* Clear all elements of FONTSET for multibyte characters.  */
- 
- static void
- clear_fontset_elements (fontset)
-      Lisp_Object fontset;
- {
-   int i;
- 
-   for (i = CHAR_TABLE_SINGLE_BYTE_SLOTS; i < CHAR_TABLE_ORDINARY_SLOTS; i++)
-     XCHAR_TABLE (fontset)->contents[i] = Qnil;
- }
- 
- 
  /* Check validity of NAME as a fontset name and return the
     corresponding fontset.  If not valid, signal an error.
     If NAME is nil, return Vdefault_fontset.  */
--- 939,944 ----
***************
*** 973,978 ****
--- 959,967 ----
    return FONTSET_FROM_ID (id);
  }
  
+ extern Lisp_Object QCfont;
+ extern Lisp_Object Vface_new_frame_defaults;
+ 
  DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0,
         doc: /* Modify fontset NAME to use FONTNAME for CHARACTER.
  
***************
*** 993,999 ****
--- 982,991 ----
    int from, to;
    int id;
    Lisp_Object family, registry;
+   Lisp_Object lf_fnt, lfaces, fontset_name;
+ 
  
+   fontset_name = Fquery_fontset (name, Qnil);
    fontset = check_fontset_name (name);
  
    if (CONSP (character))
***************
*** 1006,1014 ****
        to = XINT (XCDR (character));
        if (!char_valid_p (from, 0) || !char_valid_p (to, 0))
  	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))
      {
--- 998,1003 ----
***************
*** 1026,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))
--- 1015,1024 ----
***************
*** 1068,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;
--- 1053,1082 ----
      FONTSET_SET (fontset, from, elt);
    Foptimize_char_table (fontset);
  
!   /* If the fontset is already used in a face, then we need to update
!      the display accordingly. 
! 
!      This is done by calling Finternal_set_lisp_face. To find the
!      faces which we need to update this way, we loop through all the
!      faces declared in Vface_new_frame_alist and check each face
!      whether FONTSET_NAME is specified as its fontset. Each element in
!      Vface_new_frame_alist a cons cell with the symbol for the face as
!      its car and an LFACE (a Lisp vector containing the face
!      specification) as its cdr. */
! 
!   for (lfaces = Vface_new_frame_defaults;
!        CONSP (lfaces);
!        lfaces = XCDR (lfaces))
!     {
!       /* Set lf_fnt to the font or fontset specified for the current
! 	 LFACE. */
!       lf_fnt = AREF (XCDR (XCAR (lfaces)), LFACE_FONT_INDEX);
!       /* We call Fquery_fontset, so we are not puzzled by alias names,
! 	 which may be used in LFACE. */
!       if (STRINGP (lf_fnt) &&
! 	  !NILP (Fequal (fontset_name, Fquery_fontset (lf_fnt, Qnil))))
! 	Finternal_set_lisp_face_attribute
! 	  ((XCAR (XCAR (lfaces))), QCfont, fontset_name, 0);
      }
  
    return Qnil;

[-- Attachment #3: Type: text/plain, Size: 242 bytes --]


-- 
Oliver Scholz               14 Floréal an 211 de la Révolution
Taunusstr. 25               Liberté, Egalité, Fraternité!
60329 Frankfurt a. M.       http://www.jungdemokratenhessen.de
Tel. (069) 97 40 99 42      http://www.jdjl.org

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2003-05-02 23:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87isstx7le.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    --cc=emacs-devel@gnu.org \
    /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).