in reply to TrueType font gallery

'lo,

I had almost the same problem (could be because I kinda borrowed some of this code in one of my scripts ;) ). The problem seemed to be Font::TTF::Font, $n->release() did the trick.

Don't forget that in your example you change the original reference, so you don't have any method 'release' anymore (I forgot that initially).

my $n = Font::TTF::Font->open($f) || $f; $tmp = $n->{name} || $f if ref $n; $tmp = $tmp->read->find_name(4) || $f if ref $n; $n->release() if ref $n;
This brought back memory usage from ~25mb (crash at 1020 fonts) to ~6mb (all my fonts, 1035).


    december

PS: Where did you find the find_name(4) reference? I haven't found any documentation about the exact usage of find_name and the meaning of its $nid parameter...

Replies are listed 'Best First'.
Re^2: TrueType font gallery
by basje (Beadle) on Aug 09, 2005 at 20:43 UTC
    Where did you find the find_name(4) reference? I haven't found any documentation about the exact usage of find_name and the meaning of its $nid parameter...

    This is specified in the truetype/opentype specs. tt/ot fonts are divided into tables. "name" is one of those tables.

    Look here for details: http://www.microsoft.com/typography/otspec/name.htm

Re: Re: TrueType font gallery
by Juerd (Abbot) on Jun 04, 2003 at 17:54 UTC

    PS: Where did you find the find_name(4) reference? I haven't found any documentation about the exact usage of find_name and the meaning of its $nid parameter...

    I didn't. Just tried values until it returned something reasonable. One does stupid things when documentation is lacking.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      Heh. That's basically what I did, too. Nowhere a reference to those strings to be found.

      And, out of curiosity, does it work (or did time make this irrelevant)?

        And, out of curiosity, does it work (or did time make this irrelevant)?

        It works :)

        Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }