hedgewars/uUtils.pas
changeset 10104 cb0b750bd8a3
parent 10080 ac51bcb534ef
child 10108 c68cf030eded
equal deleted inserted replaced
10103:9c24233ca1c5 10104:cb0b750bd8a3
    58 function  isPowerOf2(i: Longword): boolean;
    58 function  isPowerOf2(i: Longword): boolean;
    59 function  toPowerOf2(i: Longword): Longword; inline;
    59 function  toPowerOf2(i: Longword): Longword; inline;
    60 
    60 
    61 function  endian(independent: LongWord): LongWord; inline;
    61 function  endian(independent: LongWord): LongWord; inline;
    62 
    62 
    63 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
    63 function  CheckCJKFont(s: PChar; font: THWFont): THWFont;
    64 
    64 
    65 procedure AddFileLog(s: shortstring);
    65 procedure AddFileLog(s: shortstring);
    66 procedure AddFileLogRaw(s: pchar); cdecl;
    66 procedure AddFileLogRaw(s: pchar); cdecl;
    67 
    67 
    68 function  CheckNoTeamOrHH: boolean; inline;
    68 function  CheckNoTeamOrHH: boolean; inline;
   362 {$ENDIF}
   362 {$ENDIF}
   363 {$ENDIF}
   363 {$ENDIF}
   364 {$ENDIF}
   364 {$ENDIF}
   365 end;
   365 end;
   366 
   366 
   367 function CheckCJKFont(s: ansistring; font: THWFont): THWFont;
   367 function CheckCJKFont(s: PChar; font: THWFont): THWFont;
   368 var l, i : LongInt;
   368 var l, i : LongInt;
   369     u: WideChar;
   369     u: WideChar;
   370     tmpstr: array[0..256] of WideChar;
   370     tmpstr: array[0..256] of WideChar;
   371 begin
   371 begin
   372 CheckCJKFont:= font;
   372 CheckCJKFont:= font;
   373 
   373 
   374 {$IFNDEF MOBILE}
   374 {$IFNDEF MOBILE}
   375 // remove chinese fonts for now
   375 // remove chinese fonts for now
   376 if (font >= CJKfnt16) or (length(s) = 0) then
   376 if (font >= CJKfnt16) or (StrLength(s) = 0) then
   377 {$ENDIF}
   377 {$ENDIF}
   378     exit;
   378     exit;
   379 
   379 
   380 l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1;
   380 l:= Utf8ToUnicode(@tmpstr, s, StrLength(s))-1;
   381 i:= 0;
   381 i:= 0;
   382 
   382 
   383 while i < l do
   383 while i < l do
   384     begin
   384     begin
   385     u:= tmpstr[i];
   385     u:= tmpstr[i];