1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Don't pass line height in GetLineSpacing

This commit is contained in:
MineBill 2025-02-15 20:12:13 +02:00
parent 1cb21de201
commit 12a87caa65
No known key found for this signature in database
4 changed files with 10 additions and 10 deletions

View file

@ -894,11 +894,11 @@ namespace Beefy.gfx
return (int32)theString.Length; return (int32)theString.Length;
} }
public float GetLineSpacing(float heightMultiplier = 1.0f) public float GetLineSpacing()
{ {
if (mFTFont == null) if (mFTFont == null)
return 0; return 0;
return mFTFont.mHeight * heightMultiplier; return mFTFont.mHeight;
} }
public float GetHeight() public float GetHeight()

View file

@ -105,7 +105,7 @@ namespace Beefy.theme.dark
mLineCoords.GrowUninitialized(mData.mLineStarts.Count); mLineCoords.GrowUninitialized(mData.mLineStarts.Count);
mLineCoordJumpTable.Clear(); mLineCoordJumpTable.Clear();
float fontHeight = mFont.GetLineSpacing(mLineHeight); float fontHeight = mFont.GetLineSpacing() * mLineHeight;
int prevJumpIdx = -1; int prevJumpIdx = -1;
float jumpCoordSpacing = GetJumpCoordSpacing(); float jumpCoordSpacing = GetJumpCoordSpacing();
@ -218,7 +218,7 @@ namespace Beefy.theme.dark
public float GetTextOffset() public float GetTextOffset()
{ {
float baseLineSpacing = mFont.GetLineSpacing(); float baseLineSpacing = mFont.GetLineSpacing();
float lineSpacing = mFont.GetLineSpacing(mLineHeight); float lineSpacing = mFont.GetLineSpacing() * mLineHeight;
return lineSpacing / 2.0f - baseLineSpacing / 2.0f; return lineSpacing / 2.0f - baseLineSpacing / 2.0f;
} }
@ -534,7 +534,7 @@ namespace Beefy.theme.dark
#unwarn #unwarn
int lineCount = GetLineCount(); int lineCount = GetLineCount();
float lineSpacing = mFont.GetLineSpacing(mLineHeight); float lineSpacing = mFont.GetLineSpacing() * mLineHeight;
float fontLineSpacing = mFont.GetLineSpacing(); float fontLineSpacing = mFont.GetLineSpacing();
float textYOffset = GetTextOffset(); float textYOffset = GetTextOffset();

View file

@ -1216,7 +1216,7 @@ namespace IDE.ui
{ {
bool isRenameSymbol = (IDEApp.sApp.mSymbolReferenceHelper != null) && (IDEApp.sApp.mSymbolReferenceHelper.mKind == SymbolReferenceHelper.Kind.Rename); bool isRenameSymbol = (IDEApp.sApp.mSymbolReferenceHelper != null) && (IDEApp.sApp.mSymbolReferenceHelper.mKind == SymbolReferenceHelper.Kind.Rename);
using (g.PushColor(isRenameSymbol ? (uint32)0x28FFFFFF : (uint32)0x18FFFFFF)) using (g.PushColor(isRenameSymbol ? (uint32)0x28FFFFFF : (uint32)0x18FFFFFF))
g.FillRect(x, y, width, mFont.GetLineSpacing(mLineHeight)); g.FillRect(x, y, width, mFont.GetLineSpacing() * mLineHeight);
DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)SourceElementFlags.SymbolReference)); DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)SourceElementFlags.SymbolReference));
return; return;
@ -1225,7 +1225,7 @@ namespace IDE.ui
if ((flags & (uint8)SourceElementFlags.Find_CurrentSelection) != 0) if ((flags & (uint8)SourceElementFlags.Find_CurrentSelection) != 0)
{ {
using (g.PushColor(0x504C575C)) using (g.PushColor(0x504C575C))
g.FillRect(x, y, width, mFont.GetLineSpacing(mLineHeight)); g.FillRect(x, y, width, mFont.GetLineSpacing() * mLineHeight);
DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)(SourceElementFlags.Find_CurrentSelection | .Find_Matches))); DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)(SourceElementFlags.Find_CurrentSelection | .Find_Matches)));
return; return;
@ -1234,7 +1234,7 @@ namespace IDE.ui
if ((flags & (uint8)SourceElementFlags.Find_Matches) != 0) if ((flags & (uint8)SourceElementFlags.Find_Matches) != 0)
{ {
using (g.PushColor(0x50D0C090)) using (g.PushColor(0x50D0C090))
g.FillRect(x, y, width, mFont.GetLineSpacing(mLineHeight)); g.FillRect(x, y, width, mFont.GetLineSpacing() * mLineHeight);
DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)SourceElementFlags.Find_Matches)); DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)SourceElementFlags.Find_Matches));
return; return;
@ -5852,7 +5852,7 @@ namespace IDE.ui
} }
orderedEmitEmbeds.Sort(scope (lhs, rhs) => lhs.line <=> rhs.line); orderedEmitEmbeds.Sort(scope (lhs, rhs) => lhs.line <=> rhs.line);
float fontHeight = mFont.GetLineSpacing(mLineHeight); float fontHeight = mFont.GetLineSpacing() * mLineHeight;
int prevJumpIdx = -1; int prevJumpIdx = -1;
float jumpCoordSpacing = GetJumpCoordSpacing(); float jumpCoordSpacing = GetJumpCoordSpacing();

View file

@ -4550,7 +4550,7 @@ namespace IDE.ui
{ {
float editX = GetEditX(); float editX = GetEditX();
float lineSpacing = ewc.mFont.GetLineSpacing(ewc.mLineHeight); float lineSpacing = ewc.mFont.GetLineSpacing() * ewc.mLineHeight;
int cursorLineNumber = mEditWidget.mEditWidgetContent.CursorLineAndColumn.mLine; int cursorLineNumber = mEditWidget.mEditWidgetContent.CursorLineAndColumn.mLine;
bool hiliteCurrentLine = mEditWidget.mHasFocus; bool hiliteCurrentLine = mEditWidget.mHasFocus;