简体   繁体   中英

Get name of .bdf font using Freetype

I tried to receive the font name of a .bdf font. I am already using Freetype with bdf to render, so this works fine. However, I need to know the font name of the currently used FT_Face .

What I tried:

BDF_Property bdfProp;
FT_Get_BDF_Property(m_face, "FONT",bdfProp);
std::cout << "BDF Prop Type: " << bdfProp->type << std::endl;

This only returns "0", so it doesn't recognize the name tag inside the bdf-file (which is declared as FONT inside the bdf).

I got the solution:

BDF_PropertyRec rec;
FT_Get_BDF_Property(m_face, "FAMILY", &rec);

The problem was BDF_Property, because this actually is a pointer not object. So I had a pointer with datatype before, which didn't have any memory allocated. Now I just do a call-by-reference to the PropertyRec-object itself. Works like it should ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM