unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* font oddity on OS X
@ 2004-07-25 21:29 Mark Moll
  2004-07-27  8:19 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Moll @ 2004-07-25 21:29 UTC (permalink / raw)
  Cc: Mark Moll

I observed the following odd behavior with a freshly compiled emacs 
from CVS. I have the code below in my .emacs to set it up for a mac 
keyboard. The odd thing is that if I press "option-u u" for instance, I 
get "¸" instead of "ü". Similarly, "option-e e" produces "È" instead of 
"é". Bizarrely, the problem goes away if I press "option-shift-minus" 
(em dash) once.

(set-terminal-coding-system 'iso-8859-1)
(set-language-environment "Latin-1")
(set-keyboard-coding-system 'mac-roman)
(set-selection-coding-system 'mac-roman)
(setq mac-keyboard-text-encoding kTextEncodingISOLatin1
       mac-command-key-is-meta t
       mac-emulate-three-button-mouse t)
(set-frame-font "fontset-mac")

-- 
Mark

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

* Re: font oddity on OS X
  2004-07-25 21:29 font oddity on OS X Mark Moll
@ 2004-07-27  8:19 ` YAMAMOTO Mitsuharu
  2004-07-27 14:10   ` Mark Moll
  0 siblings, 1 reply; 3+ messages in thread
From: YAMAMOTO Mitsuharu @ 2004-07-27  8:19 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> On Sun, 25 Jul 2004 16:29:24 -0500, Mark Moll <mmoll@rice.edu> said:

> The odd thing is that if I press "option-u u" for instance, I get
> "¸" instead of "ü". Similarly, "option-e e" produces "È" instead of
> "é". 

Not all combinations of `keyboard-coding-system' and
`mac-keyboard-text-encoding' are meaningful.  Some examples of valid
combinations are:

  (set-keyboard-coding-system 'mac-roman)
  (setq mac-keyboard-text-encoding kTextEncodingMacRoman)

  (set-keyboard-coding-system nil)
  (setq mac-keyboard-text-encoding kTextEncodingISOLatin1)

  (set-keyboard-coding-system 'iso-latin-1)
  (setq mac-keyboard-text-encoding kTextEncodingISOLatin1)

  ;; May not be displayed without ETL fonts.
  (set-keyboard-coding-system 'iso-latin-2)
  (setq mac-keyboard-text-encoding kTextEncodingISOLatin2)

Hmm, is it always possible to infer the valid value of
`mac-keyboard-text-encoding' from `keyboard-coding-system'?  If so, we
can make the variable `mac-keyboard-text-encoding' obsolete and things
would be much simpler.

> Bizarrely, the problem goes away if I press "option-shift-minus" (em
> dash) once.

This is due to the lack of resetting a converter object after
incomplete conversion of a text.  Please try the patch below.

			     YAMAMOTO Mitsuharu
			mituharu@math.s.chiba-u.ac.jp

Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.76
diff -c -r1.76 macterm.c
*** src/macterm.c	19 Jul 2004 04:42:42 -0000	1.76
--- src/macterm.c	27 Jul 2004 03:04:37 -0000
***************
*** 8545,8560 ****
  		{
  		  unsigned char ch = inev.code;
  		  ByteCount actual_input_length, actual_output_length;
! 		  unsigned char outch;
  
  		  convert_status = TECConvertText (converter, &ch, 1,
  						   &actual_input_length,
! 						   &outch, 1,
  						   &actual_output_length);
  		  if (convert_status == noErr
  		      && actual_input_length == 1
  		      && actual_output_length == 1)
! 		    inev.code = outch;
  		}
  	    }
  
--- 8545,8573 ----
  		{
  		  unsigned char ch = inev.code;
  		  ByteCount actual_input_length, actual_output_length;
! 		  unsigned char outbuf[32];
  
  		  convert_status = TECConvertText (converter, &ch, 1,
  						   &actual_input_length,
! 						   outbuf, 1,
  						   &actual_output_length);
  		  if (convert_status == noErr
  		      && actual_input_length == 1
  		      && actual_output_length == 1)
! 		    inev.code = *outbuf;
! 
! 		  /* Reset internal states of the converter object.
! 		     If it fails, create another one. */
! 		  convert_status = TECFlushText (converter, outbuf,
! 						 sizeof (outbuf),
! 						 &actual_output_length);
! 		  if (convert_status != noErr)
! 		    {
! 		      TECDisposeConverter (converter);
! 		      TECCreateConverter (&converter,
! 					  kTextEncodingMacRoman,
! 					  mac_keyboard_text_encoding);
! 		    }
  		}
  	    }
  

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

* Re: font oddity on OS X
  2004-07-27  8:19 ` YAMAMOTO Mitsuharu
@ 2004-07-27 14:10   ` Mark Moll
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Moll @ 2004-07-27 14:10 UTC (permalink / raw)
  Cc: Mark Moll, emacs-devel

On Jul 27, 2004, at 3:19, YAMAMOTO Mitsuharu wrote:
>> Bizarrely, the problem goes away if I press "option-shift-minus" (em
>> dash) once.
>
> This is due to the lack of resetting a converter object after
> incomplete conversion of a text.  Please try the patch below.

This patch fixes it. Thanks!
-- 
Mark

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

end of thread, other threads:[~2004-07-27 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-25 21:29 font oddity on OS X Mark Moll
2004-07-27  8:19 ` YAMAMOTO Mitsuharu
2004-07-27 14:10   ` Mark Moll

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).