[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to convert char from Emacs-20 internal to UTF-8?

From: Adrian Robert
Subject: Re: How to convert char from Emacs-20 internal to UTF-8?
Date: Wed, 16 Mar 2005 14:19:16 -0500

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.

Since Emacs-21's internal chars are a superset of Emacs-20's internal chars,
you can just use Emacs-21's facilities like (encode-coding-string <str>
'utf-8) or (encode-char <char> 'ucs).

Thanks. Are the encode-coding-string and encode-char functions a) fast enough to be used inside of dumpglyphs() for screen rendering and b) something I can easily lift out of 21 and backport to 20? I'm asking because this is for a GNUstep/OS X interface for emacs 20 (http://emacs-on-aqua.sf.net/), and while we'd like to bring it up to date to work with the coming emacs-22 (where I assume this problem disappears completely), this is a large job and we'd like to have support for 2-byte font and other i18n rendering in the meantime. (In the OpenStep APIs, conversions to native font encoding are handled internally, so we don't need all of CCL's generality, but we need to get characters in UTF-8 or unicode to give to the APIs in the first place.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]