2017-05-02 15 views

답변

0

(@Griffin 전에 시간의 부부의) 먼저 처음 FcConfig에 추가되어 있는지 확인하고 검색 할 필요가 TTF 파일에서 글꼴을 추가하기 위해 아래의 pango_font_description_from_string를 통해 PangoFont :

//first add to FcConfig 
std::string FontPath = "/path/to/font.ttf" 
const FcChar8 * fontFile = (const FcChar8 *)FontPath.c_str(); 
FcBool fontAddStatus = FcConfigAppFontAddFile(FcConfigGetCurrent(), fontFile); 

//then retrieve it via its fontDescriptor with pango 
PangoFontDescription * desc = pango_font_description_from_string("SOME-FONT-FAMILY SOME-STYLE"); 
PangoFontMap* pfm = pango_cairo_font_map_get_default(); 
PangoFont* font = pango_font_map_load_font(pfm, context, desc);