This commit is contained in:
Brad Robinson 2020-05-10 23:04:43 +10:00
Родитель 650dc87dc1
Коммит ccc65adf95
1 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -71,13 +71,27 @@ namespace Topten.RichTextKit
{
// Find fallback font
RunFace = fontManager.MatchCharacter(typeface.FamilyName, typeface.FontWeight, typeface.FontWidth, typeface.FontSlant, null, pch[pos]);
// If couldn't use the specified font
count = 1;
if (RunFace == null)
{
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
count = 1;// RunFace.GetGlyphs((IntPtr)(pch + pos), length - pos, SKEncoding.Utf32, out var glyphs);
// But don't take control characters or spaces...
for (int i = 1; i < count; i++)
{
if (pch[pos] <= 32)
{
count = i;
break;
}
}
}
}
// Do we need to start a new Run?