every one, I'm using GDI+ to rendering text with my own typeface, but I always get a error status InvalidParameter
when using member function AddFontFile(WCHAR*) of PrivateFontCollection to load my font file, here is my code:
PrivateFontCollection m_font_collection;
... // initialize window
GdiplusStartup(&gdi_token, &gdi_startup_input, NULL);
// here the result always is 2 (that specified as "InvalidParameter")
Status result = m_font_collection.AddFontFile(L"myfont.ttf");
I can't find any explanation why this error occur, does anyone knows how to fix that problem? Thanks! ps: forgive my poor English... :)
OK, I've solved this problem... how stupid I am... the question is quite stupid, I defined the m_font_collection too early! It should be defined after the function GdiplusStartup has been called, only after the GDI+ has been initialized the PrivateFontCollection can load your own font files... Hope can help somebody