mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 08:37:42 +00:00
Merge pull request #327 from keymanapp/developer-5482-character-identifier-crash
Additional management for text editor selection of partial surrogate pair
This commit is contained in:
commit
dab87fddb5
2 changed files with 9 additions and 2 deletions
|
|
@ -925,7 +925,9 @@ begin
|
|||
if ch = '' then Exit;
|
||||
|
||||
if Uni_IsSurrogate2(ch[1]) then
|
||||
ch := memo.GetTextPart(memo.SelStart-2, memo.SelStart);
|
||||
ch := memo.GetTextPart(memo.SelStart-2, memo.SelStart)
|
||||
else if Uni_IsSurrogate1(ch[1]) then
|
||||
ch := memo.GetTextPart(memo.SelStart-1, memo.SelStart+1);
|
||||
|
||||
token := FormatUnicode(ch);
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -325,7 +325,12 @@ procedure TClearTypeDrawCharacter.SelectFallbackFont(Handle: THandle; const Text
|
|||
var
|
||||
uc: DWord;
|
||||
begin
|
||||
uc := Char.ConvertToUtf32(Text, 0); // I3310
|
||||
try
|
||||
uc := Char.ConvertToUtf32(Text, 0); // I3310
|
||||
except
|
||||
on E:EArgumentOutOfRangeException do
|
||||
uc := $FFFD; // Not a character, invalid Unicode
|
||||
end;
|
||||
if uc < $10000 then SelectFont(Handle, ctfCode2000)
|
||||
else if uc < $20000 then SelectFont(Handle, ctfCode2001)
|
||||
else if uc < $30000 then SelectFont(Handle, ctfCode2002)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue