Hans Aberg wrote Wednesday, March 25, 2009 11:23 PM


On 25 Mar 2009, at 23:30, Francisco Vila wrote:

From your kind explanation would be right to say that the argument to
the LilyPond \char command is a simple natural number and not a
multibyte utf-8 sequence? This is what --I think-- still has to be
made clear.

Everything you write out and see as a hexadecimal number on the screen is an ordinary number. In the computer, it is represented as a sequence of bytes from the ASCII set. Anything from UTF-8, if you have an editor capable of handling it, will look as just ordinary characters.

The manual says that \char #65 produces the letter "A". Here, 65 is an ordinary integer. Which position number basis? The ASCII hexadecimal number for "A" is 41, in languages like C/C++ written as 0x41, and in Unicode U+0041. What is the decimal number? In decimal, 4*16+1 = 65. What is the representation in the computer? All ASCII characters are translated as binary numbers. Since the hexadecimal form is 41, 0x4 is binary 0100, and 0x1 is binary 0001, 0x41 is binary 01000001. So 0x41 is one 8-bit byte.

So the manual is a bit short: it should say that the number is a decimal integer representing the Unicode code point.

No, the argument to \char is a hex number.

Also, since all Unicode tables use hexadecimal numbers, there should be a convenient way to give a hexadecimal number, either as a hexadecimal-to-decimal conversion function, or a new variation of \char (with a different name).

  Hans

Trevor






_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to