all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: Probably dumb question: glyph rendering on unicode-2 branch
Date: Tue, 25 Oct 2005 10:33:01 +0900	[thread overview]
Message-ID: <E1EUDgT-0003A2-00@etlken> (raw)
In-Reply-To: <BD5A24D1-F3BD-4AC9-8762-8E4917C83D2E@cogsci.ucsd.edu> (message from Adrian Robert on Mon, 24 Oct 2005 10:43:04 -0400)

In article <BD5A24D1-F3BD-4AC9-8762-8E4917C83D2E@cogsci.ucsd.edu>, Adrian Robert <arobert@cogsci.ucsd.edu> writes:
> I didn't get any response to the below, let me try asking it in a  
> different way:

Sorry for not responding on this matter.  It seems that I
missed your original mail.

> unicode-2 branch:
>    dispextern.h:

>      struct glyph {
>      ...
>          /* Character code for character glyphs (type ==  
> CHAR_GLYPH).  */
>          unsigned ch;
>      ...
>      }
>      ...
>      struct glyph_string {
>      ...
>      /* Characters to be drawn, and number of characters.  */
>      XChar2b *char2b;
>      int nchars;
>      ...
>      }

>    {x,mac,w32}term.c:

>      x_encode_char(int c, XChar2b *char2b, ...)
>      {
>      ...
>      }

>      x_draw_glyph_string(struct glyph_string *s)
>      {
>      ...
>      }

> Questions:

> 1) Is 'int c' passed to x_encode_char() the same as 'unsigned ch' in  
> struct glpyh?

Mostly yes.  The exception is in the case that x_encode_char
is called on an element of composition glyph.  In that case,
x_encode_char is called from get_char_face_and_encoding
which is called from BUILD_COMPOSITE_GLYPH_STRING macro on
each element of a composition glyph.

> 2) In either case, what are they -- UCS-2?  UTF-16?  MULE?  UCS-4?   
> UTF-32?  What is the byte ordering?

It is a character code used in Emacs.  The value range is
0x0..0x3FFFFF.  Among them, 0x0..0x10FFFF are exactly the
same as Unicode characters.  I think it's nonsense to ask
"byte ordering" of (int).  That's depends on your hardware
architecture.

> I'll be happy to RTFM if this is documented anywhere..

The file src/character.h contains some documentation about
character code.

>>  I apologize if this is a dumb question, but I've been looking  
>>  through the code and can't figure this one out: on the unicode-2  
>>  branch, if a font specifies "iso-10646-1" for XLFD registry/ 
>>  encoding (and then fontset.c sets 'charset' accordingly), what  
>>  exactly is getting passed in struct glyph_string.char2b to  
>>  x_draw_glyph_string()?

If a font has CHARSET_REGISTRY "iso10646" and
CHARSET_ENCODING "1", the font contains only BMP characters.
Emacs-unicode uses such a font only for BMP characters.


>>  Not UTF-8, since it's just 2 bytes.   
>>  UCS-2?  UTF-16?  Don't these exclude a lot of unicode characters?   

Yes.  But, as far as I know, there's no consensus about what
to specify in a font supporting SMP or SIP in
CHARSET_REGISTRY and CHARSET_ENCODING fields.

>>  Does emacs provide any internal facility to get UTF-8?

Do you mean a way to convert a character code to UTF-8 byte
sequence in C level?  Then you can use the macro CHAR_STRING
(defined in character.h) because Emacs-unicode's internal
string/buffer representation is UTF-8 byte sequence.

---
Kenichi Handa
handa@m17n.org

  reply	other threads:[~2005-10-25  1:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-17 13:46 Probably dumb question: glyph rendering on unicode-2 branch Adrian Robert
2005-10-24 14:43 ` Adrian Robert
2005-10-25  1:33   ` Kenichi Handa [this message]
2005-10-25  3:24     ` Adrian Robert

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1EUDgT-0003A2-00@etlken \
    --to=handa@m17n.org \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.