mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Extended memory loading support
This commit is contained in:
parent
0efdecb719
commit
29c0f82bba
7 changed files with 136 additions and 33 deletions
|
@ -147,13 +147,24 @@ bool FTFont::Load(const StringImpl& fileName, float pointSize)
|
|||
|
||||
String useFileName = fileName;
|
||||
int faceIdx = 0;
|
||||
int atPos = (int)useFileName.IndexOf('@');
|
||||
int atPos = (int)useFileName.IndexOf('@', 1);
|
||||
if (atPos != -1)
|
||||
{
|
||||
faceIdx = atoi(useFileName.c_str() + atPos + 1);
|
||||
useFileName.RemoveToEnd(atPos);
|
||||
}
|
||||
auto error = FT_New_Face(gFTLibrary, useFileName.c_str(), faceIdx, &ftFace);
|
||||
|
||||
void* memPtr = NULL;
|
||||
int memLen = 0;
|
||||
if (ParseMemorySpan(fileName, memPtr, memLen))
|
||||
{
|
||||
FT_New_Memory_Face(gFTLibrary, (FT_Byte*)memPtr, memLen, faceIdx, &ftFace);
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_New_Face(gFTLibrary, useFileName.c_str(), faceIdx, &ftFace);
|
||||
}
|
||||
|
||||
face->mFTFace = ftFace;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue