How to get the font script type from the font

139 Views Asked by At

I am using harfbuzz to shape regional font and this is my current code.

HBShaper2(const string& fontFile, FreeTypeLib* lib, int fontSize);
FreeTypeLib lib;
HBShaper2 hindiShaper("C:\\Windows\\Fonts\\mangal.ttf", &lib, (int)fontSize);

typedef struct {
    std::string data;
    std::string language;
    hb_script_t script;
    hb_direction_t direction;
    const char* c_data() { return data.c_str(); };
} HBText2;

HBText2 hbt5 = {
         stdstrTxt.c_str(),
         "hi",
         HB_SCRIPT_DEVANAGARI, // How to get this value of the font
         HB_DIRECTION_LTR
    };

Currently i am manually setting the hb_script_t value in the code.

How can i get this value of the font ?

0

There are 0 best solutions below