1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed failure when failing to load a font

This commit is contained in:
Brian Fiete 2020-01-15 08:32:38 -08:00
parent ba2c63af9a
commit 957f24e159
2 changed files with 22 additions and 10 deletions

View file

@ -143,18 +143,18 @@ bool FTFont::Load(const StringImpl& fileName, float pointSize)
*facePtr = face;
face->mFileName = fileName;
FT_Face ftFace;
FT_Face ftFace = NULL;
auto error = FT_New_Face(gFTLibrary, fileName.c_str(), 0, &ftFace);
if (error != FT_Err_Ok)
return false;
face->mFTFace = ftFace;
}
else
{
face = *facePtr;
}
mFace = face;
if (face->mFTFace == NULL)
return false;
mFace = face;
FTFontManager::FaceSize** faceSizePtr = NULL;
if (face->mFaceSizes.TryAdd(pointSize, NULL, &faceSizePtr))

View file

@ -7893,7 +7893,7 @@ namespace IDE
}
else // Actual build
{
if ((projectSource.HasChangedSinceLastCompile) || (forceQueue))
if ((projectSource.HasChangedSinceLastCompile) || (projectSource.mLoadFailed) || (forceQueue))
{
// mHasChangedSinceLastCompile is safe to set 'false' here since it just determines whether or not
// we rebuild the TypeDefs from the sources. It isn't affected by any compilation errors.
@ -10517,6 +10517,16 @@ namespace IDE
float fontSize = DarkTheme.sScale * mSettings.mEditorSettings.mFontSize;
float tinyFontSize = fontSize * 8.0f/9.0f;
bool failed = false;
void FontFail(StringView name)
{
String err = scope String()..AppendF("Failed to load font '{}'", name);
OutputErrorLine(err);
if (!failed)
Fail(err);
failed = true;
}
bool isFirstFont = true;
for (let fontName in mSettings.mEditorSettings.mFonts)
{
@ -10525,12 +10535,14 @@ namespace IDE
mTinyCodeFont.Dispose(true);
isFirstFont = !mTinyCodeFont.Load(fontName, tinyFontSize);
mCodeFont.Dispose(true);
mCodeFont.Load(fontName, fontSize);
if (!mCodeFont.Load(fontName, fontSize))
FontFail(fontName);
}
else
{
mTinyCodeFont.AddAlternate(fontName, tinyFontSize).IgnoreError();
mCodeFont.AddAlternate(fontName, fontSize).IgnoreError();
if (mCodeFont.AddAlternate(fontName, fontSize) case .Err)
FontFail(fontName);
}
}
@ -11118,7 +11130,7 @@ namespace IDE
msg.Clear();
if (!mBfBuildCompiler.PopMessage(msg))
break;
OutputLine(msg);
OutputLineSmart(msg);
}
if (mBfResolveSystem != null)