CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Reading font name from file

 



jdb
New User

Feb 28, 2003, 9:54 AM

Post #1 of 3 (3037 views)
Reading font name from file Can't Post

Given a filename (let's say "ARIBLK.TTF"), is there some way to return the name of the font itself ("Arial Black")? I'm trying to dynamically produce an HTML page containing samples of all the fonts on my machine. There may well be a better way of viewing the fonts on my machine, but I'm really interested in seeing if it's doable in Perl for my own amusement. I'm looking for the READ_FONT_NAME_FROM_FILE() below:


Code
use strict; 
my $dir = 'C:/WINNT/Fonts';
my @fontfiles = glob("$dir/*.ttf $dir/*.fon");

map {
my $ff = READ_FONT_NAME_FROM_FILE($_);
print qq|<font face="$ff">This text is using the $ff font.</font><br>\n|;
}@fontfiles;


TIA,
JDB


Melvosh
User

Feb 28, 2003, 10:38 AM

Post #2 of 3 (3034 views)
Re: [jdb] Reading font name from file [In reply to] Can't Post

Try [url="http://search.cpan.org/author/MHOSKEN/Font-TTF-0.32/"]Font::TTF from CPAN.
"...there's some good in this world, Mr. Frodo, and it's worth fighting for." - Samwise Gamgee, The Two Towers


jdb
New User

Feb 28, 2003, 11:35 AM

Post #3 of 3 (3032 views)
Re: [Melvosh] Reading font name from file [In reply to] Can't Post

I've looked into that Font::TTF mod in the past with no joy; I still don't really understand it as I know just about nothing about font tables, but I checked it out again just now for kicks, and I did find an example of reading names of installed fonts out of the Registry (using Win32::Registry) in one of the Font::TTF .pm files. So I've managed to produce the file I was going for - Tanks, Melvosh!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives