Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
If you have support for fontconfig font patterns, calling $image->useFontConfig(0); seems to turn it on, although the docs suggest that only $image->useFontConfig(1); turns it on. Is this a bug? I would like to test if its available with +out turning it on. In the code below (which prints 1 on my computer), Expected - Error because 'AlgerianD' isn't a font path Got - Fontconfig has been switched on, so 'AlgerianD' works, and the p +ath given to stringFT is matched with Arial or whatever it finds (?). use strict; use warnings; use GD; use File::Slurp; my $self = {}; $self->{img} = new GD::Image(64, 64); $self->{colourhash} = {rect => '000fff', line => '000000'}; setdefaultcolours($self); $self->{img}->filledRectangle(0, 0, 64, 64, $self->{colours}->{rect}); print $self->{img}->useFontConfig(0), "\n"; $self->{img}->stringFT($self->{colours}->{line}, '/home/dan/.fonts/ALG +ERINN.TTF', 20, 0, 32, 32, chr(68)) or die $@; $self->{img}->stringFT($self->{colours}->{line}, 'AlgerianD', 20, 0, 5 +, 32, chr(68)) or die $@; create($self, 'out.png'); sub create { my ($self, $out) = @_; write_file($out, {binmode => ':raw'}, $self->{img}->png) or die "Can +'t open $out\n"; } sub setdefaultcolours { my $self = shift; while (my ($key, $value) = each %{$self->{colourhash}}) { $self->{colours}->{$key} = setcolour($self, $key, $value); } } sub setcolour { my ($self, $colour, $value) = @_; my @a = map { hex $_ } $value =~ /(..)/g; if (defined $value) { $self->{colours}->{$colour} = $self->{img}->colorAllocate(@a); $self->{colourhash}->{$colour} = $value; } return $self->{colours}->{$colour} }

In reply to gd 2.46 usefontconfig can i look at it without changing its value? by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (7)
    As of 2018-06-24 03:47 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (126 votes). Check out past polls.