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.
Read FONTNAME from ttf, otf and pfm font files
Re: Read FONTNAME from ttf, otf and pfm font files
www.microsoft.com/typography/tt/ttf_spec/ttch02.doc - TTF file format specification
http://www.microsoft.com/typography/otspec/otff.htm - OTF file format specification
http://partners.adobe.com/public/develo ... 78.PFM.pdf - Some info on PFM file format
Maybe these can help you started?
http://www.microsoft.com/typography/otspec/otff.htm - OTF file format specification
http://partners.adobe.com/public/develo ... 78.PFM.pdf - Some info on PFM file format
Maybe these can help you started?
Re: Read FONTNAME from ttf, otf and pfm font files
Thank you.
I have looked into similar documentation, but this is difficult for me to put into source code.
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

--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
Re: Read FONTNAME from ttf, otf and pfm font files
There are some routines inside PurePDF to extract TTF informations.
Re: Read FONTNAME from ttf, otf and pfm font files
@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
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
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