760 u: WideChar; |
760 u: WideChar; |
761 tmpstr: array[0..256] of WideChar; |
761 tmpstr: array[0..256] of WideChar; |
762 begin |
762 begin |
763 if font >= CJKfntSmall then exit(font); |
763 if font >= CJKfntSmall then exit(font); |
764 |
764 |
765 l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), 255); |
765 l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1; |
766 i:= 0; |
766 i:= 0; |
767 while i < l do |
767 while i < l do |
768 begin |
768 begin |
769 u:= tmpstr[i]; |
769 u:= tmpstr[i]; |
770 if (#$2E80 <= u) and ( |
770 if (#$2E80 <= u) and ( |
771 (u >= #$2FDF ) or // CJK Radicals Supplement / Kangxi Radicals |
771 (u <= #$2FDF ) or // CJK Radicals Supplement / Kangxi Radicals |
772 ((#$2FF0 <= u) and (u >= #$303F)) or // Ideographic Description Characters / CJK Radicals Supplement |
772 ((#$2FF0 <= u) and (u <= #$303F)) or // Ideographic Description Characters / CJK Radicals Supplement |
773 ((#$31C0 <= u) and (u >= #$31EF)) or // CJK Strokes |
773 ((#$31C0 <= u) and (u <= #$31EF)) or // CJK Strokes |
774 ((#$3200 <= u) and (u >= #$4DBF)) or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A |
774 ((#$3200 <= u) and (u <= #$4DBF)) or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A |
775 ((#$4E00 <= u) and (u >= #$9FFF)) or // CJK Unified Ideographs |
775 ((#$4E00 <= u) and (u <= #$9FFF)) or // CJK Unified Ideographs |
776 ((#$F900 <= u) and (u >= #$FAFF)) or // CJK Compatibility Ideographs |
776 ((#$F900 <= u) and (u <= #$FAFF)) or // CJK Compatibility Ideographs |
777 ((#$FE30 <= u) and (u >= #$FE4F))) // CJK Compatibility Forms |
777 ((#$FE30 <= u) and (u <= #$FE4F))) // CJK Compatibility Forms |
778 then exit(THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) )); |
778 then exit(THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) )); |
779 inc(i) |
779 inc(i) |
780 end; |
780 end; |
781 exit(font); |
781 exit(font); |
782 (* two more to check. pascal WideChar is only 16 bit though |
782 (* two more to check. pascal WideChar is only 16 bit though |