1Template::Plugin::GD::TUesxetr::CWornatpr(i3b)uted PerlTDeomcpulmaetnet:a:tPiloungin::GD::Text::Wrap(3)
2
3
4

NAME

6       Template::Plugin::GD::Text::Wrap - Break and wrap strings in GD images
7

SYNOPSIS

9           [% USE align = GD.Text.Wrap(gd_image); %]
10

EXAMPLES

12           [% FILTER null;
13               USE gd  = GD.Image(200,400);
14               USE gdc = GD.Constants;
15               black = gd.colorAllocate(0,   0, 0);
16               green = gd.colorAllocate(0, 255, 0);
17               txt = "This is some long text. " | repeat(10);
18               USE wrapbox = GD.Text.Wrap(gd,
19                line_space  => 4,
20                color       => green,
21                text        => txt,
22               );
23               wrapbox.set_font(gdc.gdMediumBoldFont);
24               wrapbox.set(align => 'center', width => 160);
25               wrapbox.draw(20, 20);
26               gd.png | stdout(1);
27             END;
28           -%]
29
30           [% txt = BLOCK -%]
31           Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
32           sed diam nonummy nibh euismod tincidunt ut laoreet dolore
33           magna aliquam erat volutpat.
34           [% END -%]
35           [% FILTER null;
36               #
37               # This example follows the example in GD::Text::Wrap, except
38               # we create a second image that is a copy just enough of the
39               # first image to hold the final text, plus a border.
40               #
41               USE gd  = GD.Image(400,400);
42               USE gdc = GD.Constants;
43               green = gd.colorAllocate(0, 255, 0);
44               blue  = gd.colorAllocate(0, 0, 255);
45               USE wrapbox = GD.Text.Wrap(gd,
46                line_space  => 4,
47                color       => green,
48                text        => txt,
49               );
50               wrapbox.set_font(gdc.gdMediumBoldFont);
51               wrapbox.set(align => 'center', width => 140);
52               rect = wrapbox.get_bounds(5, 5);
53               x0 = rect.0;
54               y0 = rect.1;
55               x1 = rect.2 + 9;
56               y1 = rect.3 + 9;
57               gd.filledRectangle(0, 0, x1, y1, blue);
58               gd.rectangle(0, 0, x1, y1, green);
59               wrapbox.draw(x0, y0);
60               nx = x1 + 1;
61               ny = y1 + 1;
62               USE gd2 = GD.Image(nx, ny);
63               gd2.copy(gd, 0, 0, 0, 0, x1, y1);
64               gd2.png | stdout(1);
65              END;
66           -%]
67

DESCRIPTION

69       The GD.Text.Wrap plugin provides an interface to the GD::Text::Wrap
70       module. It allows multiples line of text to be drawn in GD images with
71       various wrapping and alignment.
72
73       See GD::Text::Wrap for more details. See
74       Template::Plugin::GD::Text::Align for a plugin that allow you to draw
75       text with various alignment and orientation.
76

AUTHOR

78       Thomas Boutell wrote the GD graphics library.
79
80       Lincoln D. Stein wrote the Perl GD modules that interface to it and
81       Martien Verbruggen wrote the GD::Text module.
82
83       Craig Barratt <craig@arraycomm.com> wrote the original GD plugins for
84       the Template Toolkit (2001).
85
86       Andy Wardley <abw@cpan.org> extracted them from the TT core into a
87       separate distribution for TT version 2.15.
88
89       These modules are looking for a new maintainer.  Please contact Andy
90       Wardley if you are willing to help out.
91
93       Copyright (C) 2001 Craig Barratt <craig@arraycomm.com>, 2006 Andy
94       Wardley <abw@cpan.org>.
95
96       GD::Text is copyright 1999 Martien Verbruggen.
97
98       This module is free software; you can redistribute it and/or modify it
99       under the same terms as Perl itself.
100

SEE ALSO

102       Template::Plugin::GD, Template::Plugin::GD::Text, GD
103
104
105
106perl v5.30.0                      2019-07-26Template::Plugin::GD::Text::Wrap(3)
Impressum