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:
parent
ba2c63af9a
commit
957f24e159
2 changed files with 22 additions and 10 deletions
|
@ -143,19 +143,19 @@ bool FTFont::Load(const StringImpl& fileName, float pointSize)
|
||||||
*facePtr = face;
|
*facePtr = face;
|
||||||
|
|
||||||
face->mFileName = fileName;
|
face->mFileName = fileName;
|
||||||
FT_Face ftFace;
|
FT_Face ftFace = NULL;
|
||||||
auto error = FT_New_Face(gFTLibrary, fileName.c_str(), 0, &ftFace);
|
auto error = FT_New_Face(gFTLibrary, fileName.c_str(), 0, &ftFace);
|
||||||
if (error != FT_Err_Ok)
|
|
||||||
return false;
|
|
||||||
face->mFTFace = ftFace;
|
face->mFTFace = ftFace;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
face = *facePtr;
|
face = *facePtr;
|
||||||
}
|
}
|
||||||
mFace = face;
|
if (face->mFTFace == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
mFace = face;
|
||||||
|
|
||||||
FTFontManager::FaceSize** faceSizePtr = NULL;
|
FTFontManager::FaceSize** faceSizePtr = NULL;
|
||||||
if (face->mFaceSizes.TryAdd(pointSize, NULL, &faceSizePtr))
|
if (face->mFaceSizes.TryAdd(pointSize, NULL, &faceSizePtr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -7893,7 +7893,7 @@ namespace IDE
|
||||||
}
|
}
|
||||||
else // Actual build
|
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
|
// 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.
|
// 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 fontSize = DarkTheme.sScale * mSettings.mEditorSettings.mFontSize;
|
||||||
float tinyFontSize = fontSize * 8.0f/9.0f;
|
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;
|
bool isFirstFont = true;
|
||||||
for (let fontName in mSettings.mEditorSettings.mFonts)
|
for (let fontName in mSettings.mEditorSettings.mFonts)
|
||||||
{
|
{
|
||||||
|
@ -10525,12 +10535,14 @@ namespace IDE
|
||||||
mTinyCodeFont.Dispose(true);
|
mTinyCodeFont.Dispose(true);
|
||||||
isFirstFont = !mTinyCodeFont.Load(fontName, tinyFontSize);
|
isFirstFont = !mTinyCodeFont.Load(fontName, tinyFontSize);
|
||||||
mCodeFont.Dispose(true);
|
mCodeFont.Dispose(true);
|
||||||
mCodeFont.Load(fontName, fontSize);
|
if (!mCodeFont.Load(fontName, fontSize))
|
||||||
|
FontFail(fontName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTinyCodeFont.AddAlternate(fontName, tinyFontSize).IgnoreError();
|
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();
|
msg.Clear();
|
||||||
if (!mBfBuildCompiler.PopMessage(msg))
|
if (!mBfBuildCompiler.PopMessage(msg))
|
||||||
break;
|
break;
|
||||||
OutputLine(msg);
|
OutputLineSmart(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mBfResolveSystem != null)
|
if (mBfResolveSystem != null)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue