mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Support for TrueType collections
This commit is contained in:
parent
8280cdba56
commit
fb1d1aecc0
3 changed files with 32 additions and 11 deletions
|
@ -171,16 +171,33 @@ namespace Beefy.gfx
|
||||||
{
|
{
|
||||||
if (valType == 1)
|
if (valType == 1)
|
||||||
{
|
{
|
||||||
String fontName = new String(&fontNameArr);
|
String fontName = scope String(&fontNameArr);
|
||||||
int parenPos = fontName.IndexOf(" (");
|
int parenPos = fontName.IndexOf(" (");
|
||||||
if (parenPos != -1)
|
if (parenPos != -1)
|
||||||
fontName.RemoveToEnd(parenPos);
|
fontName.RemoveToEnd(parenPos);
|
||||||
fontName.ToUpper();
|
fontName.ToUpper();
|
||||||
String fontPath = new String(&data);
|
String fontPath = scope String(&data);
|
||||||
if ((!fontPath.EndsWith(".TTF", .OrdinalIgnoreCase)) || (!sFontNameMap.TryAdd(fontName, fontPath)))
|
if ((!fontPath.EndsWith(".TTF", .OrdinalIgnoreCase)) && (!fontPath.EndsWith(".TTC", .OrdinalIgnoreCase)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (fontName.Contains('&'))
|
||||||
{
|
{
|
||||||
delete fontName;
|
int collectionIdx = 0;
|
||||||
delete fontPath;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,16 @@ bool FTFont::Load(const StringImpl& fileName, float pointSize)
|
||||||
|
|
||||||
face->mFileName = fileName;
|
face->mFileName = fileName;
|
||||||
FT_Face ftFace = NULL;
|
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;
|
face->mFTFace = ftFace;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -9910,11 +9910,6 @@ bool BeMCContext::DoLegalization()
|
||||||
if ((needRegDisable) &&
|
if ((needRegDisable) &&
|
||||||
((!vregInfo->mDisableRAX) || (!vregInfo->mDisableRDX)))
|
((!vregInfo->mDisableRAX) || (!vregInfo->mDisableRDX)))
|
||||||
{
|
{
|
||||||
if (mDebugging)
|
|
||||||
{
|
|
||||||
NOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
vregInfo->mDisableRAX = true;
|
vregInfo->mDisableRAX = true;
|
||||||
vregInfo->mDisableRDX = true;
|
vregInfo->mDisableRDX = true;
|
||||||
isFinalRun = false;
|
isFinalRun = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue