| 1 | #======================================================================= | ||
| 2 | # ____ ____ _____ _ ____ ___ ____ | ||
| 3 | # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \ | ||
| 4 | # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) | | ||
| 5 | # | __/| |_| | _| _ _ / ___ \| __/| | / __/ | ||
| 6 | # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____| | ||
| 7 | # | ||
| 8 | # A Perl Module Chain to faciliate the Creation and Modification | ||
| 9 | # of High-Quality "Portable Document Format (PDF)" Files. | ||
| 10 | # | ||
| 11 | #======================================================================= | ||
| 12 | # | ||
| 13 | # THIS IS A REUSED PERL MODULE, FOR PROPER LICENCING TERMS SEE BELOW: | ||
| 14 | # | ||
| 15 | # | ||
| 16 | # Copyright Martin Hosken <Martin_Hosken@sil.org> | ||
| 17 | # | ||
| 18 | # No warranty or expression of effectiveness, least of all regarding | ||
| 19 | # anyone's safety, is implied in this software or documentation. | ||
| 20 | # | ||
| 21 | # This specific module is licensed under the Perl Artistic License. | ||
| 22 | # | ||
| 23 | # | ||
| 24 | # $Id: Win32.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $ | ||
| 25 | # | ||
| 26 | #======================================================================= | ||
| 27 | |||
| 28 | package PDF::API3::Compat::API2::Basic::TTF::Win32; | ||
| 29 | |||
| 30 | # use strict; | ||
| 31 | # use vars qw($HKEY_LOCAL_MACHINE); | ||
| 32 | |||
| 33 | use Win32::Registry; | ||
| 34 | use Win32; | ||
| 35 | use File::Spec; | ||
| 36 | use PDF::API3::Compat::API2::Basic::TTF::Font; | ||
| 37 | |||
| 38 | |||
| 39 | sub findfonts | ||
| 40 | { | ||
| 41 | my ($sub) = @_; | ||
| 42 | my ($font_key) = 'SOFTWARE\Microsoft\Windows' . (Win32::IsWinNT() ? ' NT' : '') . '\CurrentVersion\Fonts'; | ||
| 43 | my ($regFont, $list, $l, $font, $file); | ||
| 44 | |||
| 45 | # get entry from registry for a font of this name | ||
| 46 | $::HKEY_LOCAL_MACHINE->Open($font_key, $regFont); | ||
| 47 | $regFont->GetValues($list); | ||
| 48 | |||
| 49 | foreach $l (sort keys %{$list}) | ||
| 50 | { | ||
| 51 | my ($fname) = $list->{$l}[0]; | ||
| 52 | next unless ($fname =~ s/\(TrueType\)$//o); | ||
| 53 | $file = File::Spec->rel2abs($list->{$l}[2], "$ENV{'windir'}/fonts"); | ||
| 54 | $font = PDF::API3::Compat::API2::Basic::TTF::Font->open($file) || next; | ||
| 55 | &{$sub}($font, $fname); | ||
| 56 | $font->release; | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | 1; | ||
| 61 | |||
| 62 | __END__ |