Fix for multi-character emoji
This commit is contained in:
Родитель
650dc87dc1
Коммит
ccc65adf95
|
@ -71,13 +71,27 @@ namespace Topten.RichTextKit
|
||||||
{
|
{
|
||||||
// Find fallback font
|
// Find fallback font
|
||||||
RunFace = fontManager.MatchCharacter(typeface.FamilyName, typeface.FontWeight, typeface.FontWidth, typeface.FontSlant, null, pch[pos]);
|
RunFace = fontManager.MatchCharacter(typeface.FamilyName, typeface.FontWeight, typeface.FontWidth, typeface.FontSlant, null, pch[pos]);
|
||||||
|
count = 1;
|
||||||
// If couldn't use the specified font
|
|
||||||
if (RunFace == null)
|
if (RunFace == null)
|
||||||
|
{
|
||||||
RunFace = typeface;
|
RunFace = typeface;
|
||||||
|
count = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Consume as many as possible
|
||||||
|
count = RunFace.GetGlyphs((IntPtr)(pch + pos), length - pos, SKEncoding.Utf32, out var glyphs);
|
||||||
|
|
||||||
// Consume as many characters as possible using the requested type face
|
// But don't take control characters or spaces...
|
||||||
count = 1;// RunFace.GetGlyphs((IntPtr)(pch + pos), length - pos, SKEncoding.Utf32, out var glyphs);
|
for (int i = 1; i < count; i++)
|
||||||
|
{
|
||||||
|
if (pch[pos] <= 32)
|
||||||
|
{
|
||||||
|
count = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we need to start a new Run?
|
// Do we need to start a new Run?
|
||||||
|
|
Загрузка…
Ссылка в новой задаче