Has anyone had any luck loading external fonts?
fontname := HPDF_LoadTTFontFromFile(hDoc,"C:\3of9.ttf",1)
should load up the TrueType font and return the font name for use with
font := HPDF_GetFont(hDoc, fontname, 0)
so in this case it should return "3 of 9 Barcode" but its only returning 0 for any TTF fonts I try, in Ansi or Unicode, any thoughts?
Code: Select all
HPDF_LoadTTFontFromFile(ByRef hDoc, file_name, embedding) {
Return, DllCall("libhpdf\HPDF_LoadTTFontFromFile", UPtr, hDoc, AStr, file_name, "Ptr", embedding, "Cdecl ptr")
}
Edit: just saw this, but dont understand it:
Haru can use only TrueType fonts which has cmap of unicode and following tables.
"OS/2", "cmap", "cvt ", "fpgm", "glyf", "head", "hhea", "hmtx", "loca", "maxp", "name", "post", "prep"
Edit: ok, so the library needs updating the last parameter to the DllCall above
"Cdecl AStr" to get the returned name! update to library needed
also the font needs the cmap, which mine didn't have, but I was able to load it into FontForge and save a copy with the cmap and it works
Code: Select all
fontname := HPDF_LoadTTFontFromFile(hDoc,"3of9Barcode.ttf", 1)
font := HPDF_GetFont(hDoc, fontname, 0)