How to load font file from assets when use android ndk

216 views Asked by At

I succeeded in loading ftgles library on android.

But I can not rendering fonts.

I think that it has problem when load the font file (.ttf file)

How could I load the font file from assets?

this is initialize part

AAssetManager* manager = GLManager::getInstance()->asset();
AAsset* fontFile = AAssetManager_open(manager, "NanumBarunGothic.ttf", AASSET_MODE_BUFFER);
off_t fontDataSize = AAsset_getLength(fontFile);

FT_Byte* fontData = new FT_Byte[fontDataSize];
AAsset_read(fontFile, fontData, (size_t)fontDataSize);
AAsset_close(fontFile);
font = new FTGLPixmapFont(fontData, fontDataSize);
font->FaceSize(500);

this is render part

const char* text = "Hi world";
font->Render(text);
0

There are 0 answers