1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 05:44:11 +02:00

Per-font ellipsis configuration

This commit is contained in:
Brian Fiete 2023-01-23 06:54:20 -05:00
parent 5b80116c8d
commit 4a3e21c1ab

View file

@ -130,6 +130,7 @@ namespace Beefy.gfx
List<AltFont> mAlternates; List<AltFont> mAlternates;
MarkRefData mMarkRefData ~ delete _; MarkRefData mMarkRefData ~ delete _;
float[] mLoKerningTable; float[] mLoKerningTable;
public StringView mEllipsis = "...";
public this() public this()
{ {
@ -868,14 +869,14 @@ namespace Beefy.gfx
if (stringEndMode == FontOverflowMode.Ellipsis) if (stringEndMode == FontOverflowMode.Ellipsis)
{ {
float ellipsisLen = GetWidth("..."); float ellipsisLen = GetWidth(mEllipsis);
if (width < ellipsisLen) if (width < ellipsisLen)
return 0; // Don't draw at all if we don't even have enough space for the ellipsis return 0; // Don't draw at all if we don't even have enough space for the ellipsis
int strLen = GetCharCountToLength(workingStr, width - ellipsisLen); int strLen = GetCharCountToLength(workingStr, width - ellipsisLen);
tempStr = scope:: String(Math.Min(strLen, 128)); tempStr = scope:: String(Math.Min(strLen, 128));
tempStr.Append(theString, 0, strLen); tempStr.Append(theString, 0, strLen);
tempStr.Append("..."); tempStr.Append(mEllipsis);
workingStr = tempStr; workingStr = tempStr;
aWidth = GetWidth(workingStr); aWidth = GetWidth(workingStr);
break; break;