1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Support for TrueType collections

This commit is contained in:
Brian Fiete 2021-09-22 11:33:47 -07:00
parent 8280cdba56
commit fb1d1aecc0
3 changed files with 32 additions and 11 deletions

View file

@ -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