diff --git a/BeefLibs/Beefy2D/src/gfx/Font.bf b/BeefLibs/Beefy2D/src/gfx/Font.bf index f40459a4..d2b3c037 100644 --- a/BeefLibs/Beefy2D/src/gfx/Font.bf +++ b/BeefLibs/Beefy2D/src/gfx/Font.bf @@ -171,16 +171,33 @@ namespace Beefy.gfx { if (valType == 1) { - String fontName = new String(&fontNameArr); + String fontName = scope String(&fontNameArr); int parenPos = fontName.IndexOf(" ("); if (parenPos != -1) fontName.RemoveToEnd(parenPos); fontName.ToUpper(); - String fontPath = new String(&data); - if ((!fontPath.EndsWith(".TTF", .OrdinalIgnoreCase)) || (!sFontNameMap.TryAdd(fontName, fontPath))) + String fontPath = scope String(&data); + if ((!fontPath.EndsWith(".TTF", .OrdinalIgnoreCase)) && (!fontPath.EndsWith(".TTC", .OrdinalIgnoreCase))) + continue; + + if (fontName.Contains('&')) { - delete fontName; - delete fontPath; + int collectionIdx = 0; + for (var namePart in fontName.Split('&', .RemoveEmptyEntries)) + { + namePart.Trim(); + if (sFontNameMap.TryAddAlt(namePart, var keyPtr, var valuePtr)) + { + *keyPtr = new String(namePart); + *valuePtr = new $"{fontPath}@{collectionIdx}"; + collectionIdx++; + } + } + } + else if (sFontNameMap.TryAdd(fontName, var keyPtr, var valuePtr)) + { + *keyPtr = new String(fontName); + *valuePtr = new String(fontPath); } } } diff --git a/BeefySysLib/gfx/FTFont.cpp b/BeefySysLib/gfx/FTFont.cpp index 36460849..9f65052d 100644 --- a/BeefySysLib/gfx/FTFont.cpp +++ b/BeefySysLib/gfx/FTFont.cpp @@ -144,7 +144,16 @@ bool FTFont::Load(const StringImpl& fileName, float pointSize) face->mFileName = fileName; FT_Face ftFace = NULL; - auto error = FT_New_Face(gFTLibrary, fileName.c_str(), 0, &ftFace); + + String useFileName = fileName; + int faceIdx = 0; + int atPos = (int)useFileName.IndexOf('@'); + if (atPos != -1) + { + faceIdx = atoi(useFileName.c_str() + atPos + 1); + useFileName.RemoveToEnd(atPos); + } + auto error = FT_New_Face(gFTLibrary, useFileName.c_str(), faceIdx, &ftFace); face->mFTFace = ftFace; } else diff --git a/IDEHelper/Backend/BeMCContext.cpp b/IDEHelper/Backend/BeMCContext.cpp index f82ef54b..04cbfabb 100644 --- a/IDEHelper/Backend/BeMCContext.cpp +++ b/IDEHelper/Backend/BeMCContext.cpp @@ -9910,11 +9910,6 @@ bool BeMCContext::DoLegalization() if ((needRegDisable) && ((!vregInfo->mDisableRAX) || (!vregInfo->mDisableRDX))) { - if (mDebugging) - { - NOP; - } - vregInfo->mDisableRAX = true; vregInfo->mDisableRDX = true; isFinalRun = false;