Freetype does not see glyphs in ttf file

87 Views Asked by At

Explain what could be wrong.

I use freetype to upload ttf files. I use this simple code:

#include <iostream>

#include "ft2build.h"
#include "freetype\freetype.h"

int main()
{

FT_Library FT_Library_;
FT_Face FT_Face_;

FT_Init_FreeType(&FT_Library_);



//---------------------------------------------------------
std ::string my_string_for_read;
my_load_from_disk(my_string_for_read); //loads ttf file from disk
//---------------------------------------------------------



const FT_Byte* font_data = (unsigned char*)&my_string_for_read[0];

int status = FT_New_Memory_Face(FT_Library_, font_data, my_string_for_read.size(), 0, &FT_Face_);

if (status != 0)
{
std ::cout<<"error";
return -1;
}


FT_UInt glyph_index;
FT_ULong char_code;

char_code = FT_Get_First_Char(FT_Face_, &glyph_index);

if (char_code == 0)
{
    std::cout<<"no glyphs";
}

}

I tried this code on two ttf files with Chinese characters - it works without problems.

But for example, on another ttffile with Greek characters "Greek.ttf" - freetype does not see glyphs :(

Although I checked this "Greek.ttf" for example on the site https://fontdrop.info/ - it displays glyphs from this file without any problems.

What could be the problem?

Here is a link to the Greek.ttf file:https://file.io/6COvqSNxNa1m

0

There are 0 best solutions below