Page 1 of 1
Read FONTNAME from ttf, otf and pfm font files
Posted: Thu Apr 18, 2013 8:00 am
by Amor_2001
Hello.
I want to write a program to read the font names from ttf, otf and pfm font files.
Unfortunately, I have yet no idea.
Could someone make me ready procedures available?
Thank you.
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Thu Apr 18, 2013 8:19 am
by eesau
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Thu Apr 18, 2013 8:54 am
by Amor_2001
Thank you.
I have looked into similar documentation, but this is difficult for me to put into source code.
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Thu Apr 18, 2013 12:24 pm
by Thade
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Thu Apr 18, 2013 12:26 pm
by Amor_2001
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Thu Apr 18, 2013 3:21 pm
by ABBKlaus
There are some routines inside PurePDF to extract TTF informations.
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Fri Apr 19, 2013 7:25 am
by Amor_2001
@ABBKlaus
Can you please tell me what and where to find it there? I have found nothing to extract the Font Names in PurePdf. Only to set the properties.
Thanks
Re: Read FONTNAME from ttf, otf and pfm font files
Posted: Fri Apr 19, 2013 10:58 am
by ABBKlaus
its inside ipdf_TTF_Handle_Name. I have used Tutorial22 Font.pb which uses Tahoma.ttf :
Code: Select all
Procedure.s ipdf_TTF_Handle_Name(List Fonts.PDF_FontStructure(),*name.TTF_name_Header,PID,PSID,LID,NID)
Protected count=ipdf_EndianW(*name\count)&$FFFF
Protected stringOffset=*name+ipdf_EndianW(*name\stringOffset)&$FFFF
Protected platformID,platformSpecificID,languageID,nameID,offset,length
Protected i,j,name$,res$
Debug "count="+Str(count)
If count>0
For i=0 To count-1
platformID=ipdf_EndianW(*name\NameRecord[i]\platformID)&$FFFF
platformSpecificID=ipdf_EndianW(*name\NameRecord[i]\platformSpecificID)&$FFFF
languageID=ipdf_EndianW(*name\NameRecord[i]\languageID)&$FFFF
nameID=ipdf_EndianW(*name\NameRecord[i]\nameID)&$FFFF
offset=ipdf_EndianW(*name\NameRecord[i]\offset)&$FFFF
length=ipdf_EndianW(*name\NameRecord[i]\length)&$FFFF
;Debug "platformID="+Str(platformID)
;Debug "platformSpecificID="+Str(platformSpecificID)
;Debug "languageID="+Str(languageID)
;Debug "nameID="+Str(nameID)
;Debug "offset="+Str(offset)
;Debug "length="+Str(length)
If length>0
If platformID=3
name$=""
For j=0 To Int(length/2)-1
name$+Chr(ipdf_EndianW(PeekU(stringOffset+offset+2*j))&$FFFF)
Next
Else
name$=PeekS(stringOffset+offset,length,#PB_Ascii)
EndIf
Debug "ipdf_TTF_Handle_Name:["+Str(Len(name$))+"]"+name$
;CallDebugger
EndIf
If PID=platformID And PSID=platformSpecificID And LID=languageID And NID=nameID
res$=name$
Break
EndIf
Next
EndIf
ProcedureReturn res$
EndProcedure
Debug Output wrote:ipdf_TTF_Handle_Name:[50]© 2004 Microsoft Corporation. All rights reserved.
ipdf_TTF_Handle_Name:[6]Tahoma
ipdf_TTF_Handle_Name:[7]Regular