mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Fixed some font crashing issues, allowed fonts to be 'optional' with a ?
This commit is contained in:
parent
868293f2f2
commit
d6a4b8b62c
3 changed files with 28 additions and 16 deletions
|
@ -360,20 +360,20 @@ namespace Beefy.theme.dark
|
||||||
mHeaderFont.AddAlternate(scope String(BFApp.sApp.mInstallDir, "fonts/seguihis.ttf"), 11.7f * sScale);*/
|
mHeaderFont.AddAlternate(scope String(BFApp.sApp.mInstallDir, "fonts/seguihis.ttf"), 11.7f * sScale);*/
|
||||||
|
|
||||||
mHeaderFont.Load("Segoe UI", 11.7f * sScale); //8.8
|
mHeaderFont.Load("Segoe UI", 11.7f * sScale); //8.8
|
||||||
mHeaderFont.AddAlternate("Segoe UI Symbol", 11.7f * sScale);
|
mHeaderFont.AddAlternate("Segoe UI Symbol", 11.7f * sScale).IgnoreError();
|
||||||
mHeaderFont.AddAlternate("Segoe UI Historic", 11.7f * sScale).IgnoreError();
|
mHeaderFont.AddAlternate("Segoe UI Historic", 11.7f * sScale).IgnoreError();
|
||||||
mHeaderFont.AddAlternate("Segoe UI Emoji", 11.7f * sScale).IgnoreError();
|
mHeaderFont.AddAlternate("Segoe UI Emoji", 11.7f * sScale).IgnoreError();
|
||||||
|
|
||||||
mSmallFont.Dispose(true);
|
mSmallFont.Dispose(true);
|
||||||
mSmallFont.Load("Segoe UI", 12.8f * sScale); // 10.0
|
mSmallFont.Load("Segoe UI", 12.8f * sScale); // 10.0
|
||||||
mSmallFont.AddAlternate("Segoe UI Symbol", 12.8f * sScale);
|
mSmallFont.AddAlternate("Segoe UI Symbol", 12.8f * sScale).IgnoreError();
|
||||||
mSmallFont.AddAlternate("Segoe UI Historic", 12.8f * sScale).IgnoreError();
|
mSmallFont.AddAlternate("Segoe UI Historic", 12.8f * sScale).IgnoreError();
|
||||||
mSmallFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale).IgnoreError();
|
mSmallFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale).IgnoreError();
|
||||||
|
|
||||||
mSmallBoldFont.Dispose(true);
|
mSmallBoldFont.Dispose(true);
|
||||||
mSmallBoldFont.Dispose(true);
|
mSmallBoldFont.Dispose(true);
|
||||||
mSmallBoldFont.Load("Segoe UI Bold", 12.8f * sScale); // 10.0
|
mSmallBoldFont.Load("Segoe UI Bold", 12.8f * sScale); // 10.0
|
||||||
mSmallBoldFont.AddAlternate("Segoe UI Symbol", 12.8f * sScale);
|
mSmallBoldFont.AddAlternate("Segoe UI Symbol", 12.8f * sScale).IgnoreError();
|
||||||
mSmallBoldFont.AddAlternate("Segoe UI Historic", 12.8f * sScale).IgnoreError();
|
mSmallBoldFont.AddAlternate("Segoe UI Historic", 12.8f * sScale).IgnoreError();
|
||||||
mSmallBoldFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale).IgnoreError();
|
mSmallBoldFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale).IgnoreError();
|
||||||
/*mSmallBoldFont.Load(StringAppend!(tempStr, BFApp.sApp.mInstallDir, "fonts/segoeuib.ttf"), 12.8f * sScale); // 10.0
|
/*mSmallBoldFont.Load(StringAppend!(tempStr, BFApp.sApp.mInstallDir, "fonts/segoeuib.ttf"), 12.8f * sScale); // 10.0
|
||||||
|
|
|
@ -4368,6 +4368,9 @@ namespace IDE
|
||||||
|
|
||||||
void ShowPanel(Panel panel, String label, bool setFocus = true)
|
void ShowPanel(Panel panel, String label, bool setFocus = true)
|
||||||
{
|
{
|
||||||
|
if (!mInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
mLastActivePanel = panel;
|
mLastActivePanel = panel;
|
||||||
RecordHistoryLocation();
|
RecordHistoryLocation();
|
||||||
ShowTab(panel, label, false, setFocus);
|
ShowTab(panel, label, false, setFocus);
|
||||||
|
@ -10646,19 +10649,22 @@ namespace IDE
|
||||||
float fontSize = DarkTheme.sScale * mSettings.mEditorSettings.mFontSize;
|
float fontSize = DarkTheme.sScale * mSettings.mEditorSettings.mFontSize;
|
||||||
float tinyFontSize = fontSize * 8.0f/9.0f;
|
float tinyFontSize = fontSize * 8.0f/9.0f;
|
||||||
|
|
||||||
bool failed = false;
|
String err = scope String();
|
||||||
void FontFail(StringView name)
|
void FontFail(StringView name)
|
||||||
{
|
{
|
||||||
String err = scope String()..AppendF("Failed to load font '{}'", name);
|
if (!err.IsEmpty)
|
||||||
OutputErrorLine(err);
|
err.Append("\n");
|
||||||
if (!failed)
|
err.AppendF("Failed to load font '{}'", name);
|
||||||
Fail(err);
|
|
||||||
failed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFirstFont = true;
|
bool isFirstFont = true;
|
||||||
for (let fontName in mSettings.mEditorSettings.mFonts)
|
for (var fontName in mSettings.mEditorSettings.mFonts)
|
||||||
|
FontLoop:
|
||||||
{
|
{
|
||||||
|
bool isOptional;
|
||||||
|
if (isOptional = fontName.StartsWith("?"))
|
||||||
|
fontName = scope:FontLoop String(fontName, "?".Length);
|
||||||
|
|
||||||
if (isFirstFont)
|
if (isFirstFont)
|
||||||
{
|
{
|
||||||
mTinyCodeFont.Dispose(true);
|
mTinyCodeFont.Dispose(true);
|
||||||
|
@ -10670,7 +10676,7 @@ namespace IDE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTinyCodeFont.AddAlternate(fontName, tinyFontSize).IgnoreError();
|
mTinyCodeFont.AddAlternate(fontName, tinyFontSize).IgnoreError();
|
||||||
if (mCodeFont.AddAlternate(fontName, fontSize) case .Err)
|
if ((mCodeFont.AddAlternate(fontName, fontSize) case .Err) && (!isOptional))
|
||||||
FontFail(fontName);
|
FontFail(fontName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10685,12 +10691,12 @@ namespace IDE
|
||||||
if (mCodeFont.GetWidth('😊') == 0)
|
if (mCodeFont.GetWidth('😊') == 0)
|
||||||
{
|
{
|
||||||
mCodeFont.AddAlternate("Segoe UI", fontSize);
|
mCodeFont.AddAlternate("Segoe UI", fontSize);
|
||||||
mCodeFont.AddAlternate("Segoe UI Symbol", fontSize);
|
mCodeFont.AddAlternate("Segoe UI Symbol", fontSize).IgnoreError();
|
||||||
mCodeFont.AddAlternate("Segoe UI Historic", fontSize).IgnoreError();
|
mCodeFont.AddAlternate("Segoe UI Historic", fontSize).IgnoreError();
|
||||||
mCodeFont.AddAlternate("Segoe UI Emoji", fontSize).IgnoreError();
|
mCodeFont.AddAlternate("Segoe UI Emoji", fontSize).IgnoreError();
|
||||||
|
|
||||||
mTinyCodeFont.AddAlternate("Segoe UI", tinyFontSize);
|
mTinyCodeFont.AddAlternate("Segoe UI", tinyFontSize);
|
||||||
mTinyCodeFont.AddAlternate("Segoe UI Symbol", tinyFontSize);
|
mTinyCodeFont.AddAlternate("Segoe UI Symbol", tinyFontSize).IgnoreError();
|
||||||
mTinyCodeFont.AddAlternate("Segoe UI Historic", tinyFontSize).IgnoreError();
|
mTinyCodeFont.AddAlternate("Segoe UI Historic", tinyFontSize).IgnoreError();
|
||||||
mTinyCodeFont.AddAlternate("Segoe UI Emoji", tinyFontSize).IgnoreError();
|
mTinyCodeFont.AddAlternate("Segoe UI Emoji", tinyFontSize).IgnoreError();
|
||||||
|
|
||||||
|
@ -10703,6 +10709,12 @@ namespace IDE
|
||||||
mTinyCodeFont.AddAlternate(new String("fonts/seguihis.ttf"), tinyFontSize);*/
|
mTinyCodeFont.AddAlternate(new String("fonts/seguihis.ttf"), tinyFontSize);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!err.IsEmpty)
|
||||||
|
{
|
||||||
|
OutputErrorLine(err);
|
||||||
|
Fail(err);
|
||||||
|
}
|
||||||
|
|
||||||
//mTinyCodeFont.Load(scope String(BFApp.sApp.mInstallDir, "fonts/SourceCodePro-Regular.ttf"), fontSize);
|
//mTinyCodeFont.Load(scope String(BFApp.sApp.mInstallDir, "fonts/SourceCodePro-Regular.ttf"), fontSize);
|
||||||
|
|
||||||
float squiggleScale = DarkTheme.sScale;
|
float squiggleScale = DarkTheme.sScale;
|
||||||
|
|
|
@ -354,9 +354,9 @@ namespace IDE
|
||||||
{
|
{
|
||||||
mFonts.Add(new String("fonts/SourceCodePro-Regular.ttf"));
|
mFonts.Add(new String("fonts/SourceCodePro-Regular.ttf"));
|
||||||
mFonts.Add(new String("Segoe UI"));
|
mFonts.Add(new String("Segoe UI"));
|
||||||
mFonts.Add(new String("Segoe UI Symbol"));
|
mFonts.Add(new String("?Segoe UI Symbol"));
|
||||||
mFonts.Add(new String("Segoe UI Historic"));
|
mFonts.Add(new String("?Segoe UI Historic"));
|
||||||
mFonts.Add(new String("Segoe UI Emoji"));
|
mFonts.Add(new String("?Segoe UI Emoji"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Apply()
|
public void Apply()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue