<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Font::TTF::Win32;

# use strict;
# use vars qw($HKEY_LOCAL_MACHINE);

use Win32::Registry;
use Win32;
use File::Spec;
use Font::TTF::Font;


sub findfonts
{
    my ($sub) = @_;
    my ($font_key) = 'SOFTWARE\Microsoft\Windows' . (Win32::IsWinNT() ? ' NT' : '') . '\CurrentVersion\Fonts';
    my ($regFont, $list, $l, $font, $file);
    
# get entry from registry for a font of this name
    $::HKEY_LOCAL_MACHINE-&gt;Open($font_key, $regFont);
    $regFont-&gt;GetValues($list);

    foreach $l (sort keys %{$list})
    {
        my ($fname) = $list-&gt;{$l}[0];
        next unless ($fname =~ s/\(TrueType\)$//o);
        $file = File::Spec-&gt;rel2abs($list-&gt;{$l}[2], "$ENV{'windir'}/fonts");
        $font = Font::TTF::Font-&gt;open($file) || next;
        &amp;{$sub}($font, $fname);
        $font-&gt;release;
    }
}

1;
</pre></body></html>