unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adrian Robert <arobert@cogsci.ucsd.edu>
Cc: emacs-devel@gnu.org
Subject: Re: How to convert char from Emacs-20 internal to UTF-8?
Date: Tue, 22 Mar 2005 12:30:26 -0500	[thread overview]
Message-ID: <619606982fe3815e3343bfb65bb17906@cogsci.ucsd.edu> (raw)
In-Reply-To: <87acp3jyqi.fsf-monnier+emacs@gnu.org>


On Mar 16, 2005, at 12:19 PM, Stefan Monnier wrote:

>> I apologize for the "retro" question, but I was wondering if there 
>> was an
>> easy way to convert a character in the Emacs-20 internal 19-bit 
>> encoding
>> (from FAST_GLYPH_CHAR(glyph)) to UTF-8 (preferable) or straight 
>> Unicode.
>> I'd like to do it fully within C if possible, and it needs to be 
>> efficient.

I found a way to do this using parts of the C program available at:

http://tclab.kaist.ac.kr/~otfried/Mule/

Basically it uses a large table to convert from charset/byte1/byte2 to 
unicode then UTF-8.  I call SPLIT_NON_ASCII_CHAR() to get that info out 
of the 19-bit internal representation stored in the glyph.  CCL was not 
needed, though maybe it would have provided a more compact way to solve 
the problem than a 250K table.

However, I still have an issue: for 2-byte characters, such as Big5 or 
JIS Chinese characters, emacs (20) is giving me two glyphs for each 
character, with identical values.    Does this have something to do 
with it thinking the font needs a double wide horizontal space to 
render the character?

thanks,
Adrian

  parent reply	other threads:[~2005-03-22 17:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-16 16:46 How to convert char from Emacs-20 internal to UTF-8? Adrian Robert
2005-03-16 17:19 ` Stefan Monnier
2005-03-16 19:19   ` Adrian Robert
2005-03-16 19:38     ` Stefan Monnier
2005-03-17  3:20     ` Adrian Robert
2005-03-22 17:30   ` Adrian Robert [this message]
2005-03-23  4:52     ` Miles Bader

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=619606982fe3815e3343bfb65bb17906@cogsci.ucsd.edu \
    --to=arobert@cogsci.ucsd.edu \
    --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).