I wondering if there is an extension that can reads the font name. Is there any?
Printable View
I wondering if there is an extension that can reads the font name. Is there any?
I don't understand. Read the font name of what?
Psuedocode time!!
Load any .ttf file in a Binary Extension (Binary Object, or maybe Binary Array object) and then follow these instructions:
Code://Find out how many tables there are in the file.
Set Pointer to '4'
"Number of tables" = Get Unsigned Short
//Move to the list of contents
Set Pointer to '12'
//Scan each line in the list of contents
//trying to find the 'Names Table'
LOOP 'Number of tables' times
{
"Table ID" = Get ASCII String, 4 bytes long
Advance Pointer by '8'
"Table Location" = Get Unsigned Long
Advance Pointer by '4'
"Table Length" = Get Unsigned Long
Advance Pointer by '4'
IF ("Table ID" == "name")
{ Then: Stop loop } //Once the Name Table has been found, stop the search loop.
}
//Read the Name Table
Set Pointer to 'Table Location'
Advance Pointer by '2'
"Number of Strings" = Get Unsigned Short
Advance Pointer by '2'
"Offset to String Def" = Get Unisgned Short
Advance Pointer by '4'
LOOP 'Number of Strings' times
{
Advance Pointer by '6'
"String Type" = Get Unsigned Short
Advance Pointer by '2'
"String Length" = Get Unsigned Short
Advance Pointer by '2'
"String Offset" = Get Unsigned Short
IF ("String Type" == '1')
{ Then: Stop loop } //Once the name string is found, stop the search loop.
}
//Read the name
Set Pointer to 'Offset to String Def'
Advance Pointer by 'String Offset'
"Font Name" = Get ASCII String, 'String Length' bytes long
RETURN "Font Name"
And that's it. It's doable in MMF2 with a binary extension, or you may be able to get some kind person to convert this into C code and build an extension out of it. :)
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=106181#Post1061 81
Never say I don't do anything for you :)