Drop the LongInt conversion, strip the two tests that are too large
authornemo
Thu, 07 Jan 2010 16:18:32 +0000
changeset 2681 dcbb5e98afc7
parent 2680 c925dec40d32
child 2682 d4c395f25db2
Drop the LongInt conversion, strip the two tests that are too large
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Thu Jan 07 16:13:43 2010 +0000
+++ b/hedgewars/uStore.pas	Thu Jan 07 16:18:32 2010 +0000
@@ -756,7 +756,8 @@
 
 
 function CheckCJKFont(s: string; font: THWFont): THWFont;
-var l, i, u : LongInt;
+var l, i : LongInt;
+    u: WideChar;
     tmpstr: array[0..256] of WideChar;
 begin
 if font >= CJKfntSmall then exit(font);
@@ -765,22 +766,22 @@
 i:= 0;
 while i < l do
     begin
-    u:= LongInt(tmpstr[i]);
-    //AddFileLog(IntToStr(u));
-    if ($2E80  <= u) and  (
-                          (u >= $2FDF )  or // CJK Radicals Supplement / Kangxi Radicals
-       (($2FF0  <= u) and (u >= $303F))  or // Ideographic Description Characters / CJK Radicals Supplement
-       (($31C0  <= u) and (u >= $31EF))  or // CJK Strokes
-       (($3200  <= u) and (u >= $4DBF))  or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A
-       (($4E00  <= u) and (u >= $9FFF))  or // CJK Unified Ideographs
-       (($F900  <= u) and (u >= $FAFF))  or // CJK Compatibility Ideographs
-       (($FE30  <= u) and (u >= $FE4F))  or // CJK Compatibility Forms
-       (($20000 <= u) and (u >= $2A6DF)) or // CJK Unified Ideographs Extension B
-       (($2F800 <= u) and (u >= $2FA1F)))    // CJK Compatibility Ideographs Supplement
+    u:= tmpstr[i];
+    if (#$2E80  <= u) and  (
+                           (u >= #$2FDF )  or // CJK Radicals Supplement / Kangxi Radicals
+       ((#$2FF0  <= u) and (u >= #$303F))  or // Ideographic Description Characters / CJK Radicals Supplement
+       ((#$31C0  <= u) and (u >= #$31EF))  or // CJK Strokes
+       ((#$3200  <= u) and (u >= #$4DBF))  or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A
+       ((#$4E00  <= u) and (u >= #$9FFF))  or // CJK Unified Ideographs
+       ((#$F900  <= u) and (u >= #$FAFF))  or // CJK Compatibility Ideographs
+       ((#$FE30  <= u) and (u >= #$FE4F)))    // CJK Compatibility Forms
        then exit(THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) ));
     inc(i)
     end;
 exit(font);
+(* two more to check. pascal WideChar is only 16 bit though
+       ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B
+       ((#$2F800 <= u) and (u >= #$2FA1F)))   // CJK Compatibility Ideographs Supplement *)
 end;
 
 function  RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture;