Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Perl Tk - .font.cache-1 file

by taureau (Initiate)
on Aug 05, 2005 at 08:44 UTC ( #481136=perlquestion: print w/replies, xml ) Need Help??

taureau has asked for the wisdom of the Perl Monks concerning the following question:

Hello *, I work on a solaris platform and the perl 5.8.5 release. I used Tk to design a small front end. I came across a problem and I knew i had to get here. The Tk window, apparently tries to read this file called '.font.cache-1' from my home directory. This file is not present by default in UNIX though. TK creates it. So, the first time I invoke my program, i get a 'segmentation fault' and the code fails. I immediately noticed that a file named '.font.cache-1' got created in my home directory. Now, when the tk program is invoked again, all works fine. I delete this '.font.cache-1' file and invoke again, and all goes down again. Can someone help? here is a sample code which always fails. For the first time that is.
use Tk; # create first main window $mw = MainWindow->new( -title => 'Test1' ); # if I remove the following line, no "segmentation fault" occurs. # even no pack is required to get the "segm fault" $label = $mw->Label(); # Display first window Tk::update($mw); # and destroy it $mw->destroy(); # create second main window $mw1 = MainWindow->new( -title => 'Test2' ); $label1 = $mw1->Label()->pack(); # main loop MainLoop;
Any ideas? taureau

Replies are listed 'Best First'.
Re: Perl Tk - .font.cache-1 file
by zentara (Archbishop) on Aug 05, 2005 at 10:49 UTC
    The .fonts.cache-1 file is part of the Freetype font system, do a google search for "fonts.cache-1". You create it by running the fc-cache(and/or fontconfig) command. I don't have to deal with it much, so thats about all I know. You can get it at Freetype

    Why it is causing problems for you I don't know, it usually runs transparently in the background. Maybe your Tk version was compiled with Freetype support, but the machine you are on dosn't have Freetype installed?


    I'm not really a human, but I play one on earth. flash japh
Re: Perl Tk - .font.cache-1 file
by Tanalis (Curate) on Aug 05, 2005 at 09:09 UTC
    I can't replicate this - your code works as expected for me. I don't see the .font.cache-1 file being created either, though, which makes me think that this might be system-specific.

    What Solaris version (uname -r) and Tk version (perl -MTk -e 'print $Tk::VERSION, "\n"') are you running?

    What happens if you put text into the label when you create it, out of interest?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://481136]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2020-11-25 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?