[Dev-luatex] encoding code issue

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


Hi, Taco:

On Sat, Jun 20, 2009 at 12:20 AM, Yue Wang<yuleopen at gmail.com> wrote:
>> I have decided to keep that code: at some time in the future I want
>> to expose the fontforge Unicode library to the lua scripting language.
>> The current unicode library (slunicode) is minimalistic, already
>> outdated, and hard to keep up-to-date, so it makes sense to switch
>> to the much cleaner version from Fontforge at some point (not too
>> soon though, it has a rather low priority).
>>
>
> OK. I understand. but can you put tolower into #ifdef too?
> tolower is only needed for macbinary.c for a filename related call.
> It is not needed to be in full unicode range.
>

here is the patch.

Index: source/texk/web2c/luatexdir/luafontloader/fontforge/Unicode/utype.c
===================================================================
--- source/texk/web2c/luatexdir/luafontloader/fontforge/Unicode/utype.c	(revision
2540)
+++ source/texk/web2c/luatexdir/luafontloader/fontforge/Unicode/utype.c	(working
copy)
@@ -1,5 +1,6 @@
 #include "utype.h"

+#if 0
 const unsigned short ____tolower[]= { 0,
   0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
   0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
@@ -8195,7 +8196,6 @@
   0x0000, 0xfff9, 0xfffa, 0xfffb, 0xfffc, 0xfffd, 0x0000, 0x0000
 };

-#if 0
 const unsigned short ____toupper[] = { 0,
   0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
   0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
Index: source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c
===================================================================
--- source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c	(revision
2540)
+++ source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/macbinary.c	(working
copy)
@@ -1155,7 +1155,7 @@
     spt = strrchr(buffer,'/')+1;
     for ( pt=spt; *pt; ++pt )
 	if ( isupper( *pt ))
-	    *pt = tolower( *pt );
+	    *pt =  *pt - 'A' + 'a';
     dpt = strchr(spt,'.');
     if ( dpt==NULL ) dpt = spt+strlen(spt);
     if ( dpt-spt>8 || strlen(dpt)>4 ) {
Index: source/texk/web2c/luatexdir/luafontloader/fontforge/inc/utype.h
===================================================================
--- source/texk/web2c/luatexdir/luafontloader/fontforge/inc/utype.h	(revision
2540)
+++ source/texk/web2c/luatexdir/luafontloader/fontforge/inc/utype.h	(working
copy)
@@ -47,14 +47,14 @@
 #define ____TOUCHING	0x100000
 #define ____COMBININGPOSMASK	0x1fff00

+#if 0
 extern const unsigned short ____tolower[];
-#if 0
 extern const unsigned short ____toupper[];
 #endif
 extern const unsigned int  ____utype[];

+#if 0
 #define tolower(ch) (____tolower[(ch)+1])
-#if 0
 #define toupper(ch) (____toupper[(ch)+1])
 #endif
 #define islower(ch) (____utype[(ch)+1]&____L)



(and personally I think ____utype can be gone too...
such unicode library can be very easy to be implement in pure Lua way.)

Yue Wang


More information about the dev-luatex mailing list