[Dev-luatex] encoding code issue

Yue Wang yuleopen at gmail.com
Sat Jun 20 11:47:02 CEST 2009


Hi, Taco and Khaled


>
> #2542 simply reverts #2451.

first of all, you left two typos there, so it will simply not work:

what I said is *pt =  *pt - 'A' + 'a'; // to lower
however, you write it like that:

#define tolower(ch) (ch+'A'-'a')

it is a "toupper" statement.


moreover,  the statement I left in macbinary.c is safe since there is
a "isupper" to do the test. however, it's totally wrong  for you to
put the same stuff to utype.h. utype.h should check whether it is in
the [A-Z] range or not.


So this is not because my patch sucks, but because you wrote the wrong
statement... Here is the patch for 2451:

Index: source/texk/web2c/luatexdir/luafontloader/fontforge/inc/utype.h

===================================================================
--- source/texk/web2c/luatexdir/luafontloader/fontforge/inc/utype.h	(revision
2541)
+++ source/texk/web2c/luatexdir/luafontloader/fontforge/inc/utype.h	(working
copy)
@@ -58,7 +58,7 @@
 #define toupper(ch) (____toupper[(ch)+1])
 #else
 /* ASCII style */
-#define tolower(ch) (ch+'A'-'a')
+#define tolower(ch)  ((ch >= 'A' && ch <= 'Z') ? ch + 32: ch)
 #endif
 #define islower(ch) (____utype[(ch)+1]&____L)
 #define isupper(ch) (____utype[(ch)+1]&____U)

can do all the trick.

>
> Best wishes,
> Taco
>
>

Yue Wang


More information about the dev-luatex mailing list