mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 22:04:09 +02:00
Per-font ellipsis configuration
This commit is contained in:
parent
5b80116c8d
commit
4a3e21c1ab
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue