equal
deleted
inserted
replaced
294 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
294 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
295 var l, i : LongInt; |
295 var l, i : LongInt; |
296 u: WideChar; |
296 u: WideChar; |
297 tmpstr: array[0..256] of WideChar; |
297 tmpstr: array[0..256] of WideChar; |
298 begin |
298 begin |
|
299 CheckCJKFont:= font; |
299 |
300 |
300 {$IFNDEF MOBILE} |
301 {$IFNDEF MOBILE} |
301 // remove chinese fonts for now |
302 // remove chinese fonts for now |
302 if (font >= CJKfnt16) or (length(s) = 0) then |
303 if (font >= CJKfnt16) or (length(s) = 0) then |
303 {$ENDIF} |
304 {$ENDIF} |
304 exit(font); |
305 exit; |
305 |
306 |
306 l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1; |
307 l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1; |
307 i:= 0; |
308 i:= 0; |
308 |
309 |
309 while i < l do |
310 while i < l do |
318 ((#$3200 <= u) and (u <= #$4DBF)) or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A |
319 ((#$3200 <= u) and (u <= #$4DBF)) or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A |
319 ((#$4E00 <= u) and (u <= #$9FFF)) or // CJK Unified Ideographs |
320 ((#$4E00 <= u) and (u <= #$9FFF)) or // CJK Unified Ideographs |
320 ((#$AC00 <= u) and (u <= #$D7AF)) or // Hangul Syllables |
321 ((#$AC00 <= u) and (u <= #$D7AF)) or // Hangul Syllables |
321 ((#$F900 <= u) and (u <= #$FAFF)) or // CJK Compatibility Ideographs |
322 ((#$F900 <= u) and (u <= #$FAFF)) or // CJK Compatibility Ideographs |
322 ((#$FE30 <= u) and (u <= #$FE4F))) // CJK Compatibility Forms |
323 ((#$FE30 <= u) and (u <= #$FE4F))) // CJK Compatibility Forms |
323 then exit(THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) )); |
324 then |
|
325 begin |
|
326 CheckCJKFont:= THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) ); |
|
327 exit; |
|
328 end; |
324 inc(i) |
329 inc(i) |
325 end; |
330 end; |
326 exit(font); |
|
327 (* two more to check. pascal WideChar is only 16 bit though |
331 (* two more to check. pascal WideChar is only 16 bit though |
328 ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B |
332 ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B |
329 ((#$2F800 <= u) and (u >= #$2FA1F))) // CJK Compatibility Ideographs Supplement *) |
333 ((#$2F800 <= u) and (u >= #$2FA1F))) // CJK Compatibility Ideographs Supplement *) |
330 end; |
334 end; |
331 |
335 |