1Imager::Font::BBox(3) User Contributed Perl DocumentationImager::Font::BBox(3)
2
3
4

NAME

6       Imager::Font::BBox - objects representing the bounding box of a string.
7

SYNOPSIS

9         use Imager::Font;
10
11         # get the object
12         my $font = Imager::Font->new(...);
13         my $bbox = $font->bounding_box(string=>$text, size=>$size);
14
15         # methods
16         my $start = $bbox->start_offset;
17         my $left_bearing = $bbox->left_bearing;
18         my $right_bearing = $bbox->right_bearing;
19         my $end = $bbox->end_offset;
20         my $gdescent = $box->global_descent;
21         my $gascent = $bbox->global_ascent;
22         my $ascent = $bbox->ascent;
23         my $decent = $bbox->descent;
24         my $total_width = $bbox->total_width;
25         my $fheight = $bbox->font_height;
26         my $theight = $bbox->text_height;
27         my $display_width = $bbox->display_width;
28

DESCRIPTION

30       Objects of this class are returned by the Imager::Font bounding_box()
31       method when it is called in scalar context.
32
33       This will hopefully make the information from this method more accessi‐
34       ble.
35

METHODS

37       start_offset()
38       neg_width
39       left_bearing
40           Returns the horizonatal offset from the selected drawing location
41           to the left edge of the first character drawn.  If this is posi‐
42           tive, the first glyph is to the right of the drawing location.
43
44           The alias neg_width() is present to match the bounding_box() docu‐
45           mentation for list context.
46
47           The alias left_bearing() is present to match font terminology.
48
49       end_offset
50       pos_width
51           The offset from the selected drawing location to the right edge of
52           the last character drawn.  Should always be positive.
53
54           You can use the alias pos_width() if you are used to the bound‐
55           ing_box() documentation for list context.
56
57       global_descent()
58           The lowest position relative to the font baseline that any charac‐
59           ter in the font reaches in the character cell.  Normally negative.
60
61           At least one font we've seen has reported a positive number for
62           this.
63
64       global_ascent()
65           The highest position relative to the font baseline that any charac‐
66           ter in the font reaches in the character cell.  Normally positive.
67
68       descent()
69           The lowest position relative to the font baseline that any charac‐
70           ter in the supplied string reaches.  Negative when any character's
71           glyph reaches below the baseline.
72
73       ascent()
74           The highest position relative to the font baseline that any charac‐
75           ter in the supplied string reaches.  Positive if any character's
76           glyph reaches above the baseline.
77
78       advance_width()
79           The advance width of the string, if the driver supports that, oth‐
80           erwise the same as end_offset.
81
82       total_width()
83           The total displayed width of the string.
84
85       font_height()
86           The maximum displayed height of any string using this font.
87
88       text_height()
89           The displayed height of the supplied string.
90
91       right_bearing
92           The distance from the right of the last glyph to the end of the
93           advance point.
94
95           If the glyph overflows the right side of the advance width this
96           value is negative.
97
98       display_width
99           The distance from the left-most pixel of the left-most glyph to the
100           right-most pixel of the right-most glyph.
101
102           Equals advance_width - left_bearing - right_bearing (and imple‐
103           mented that way.)
104

INTERNAL FUNCTIONS

106       new(...)
107           Called by Imager::Font->bounding_box() to create the object.
108

BUGS

110       Doesn't reproduce the functionality that you get using the x and y
111       parameters to Imager::Font->bounding_box().  I considered:
112
113         my ($left, $top, $right, $bottom) = $box->offset(x=>$x, y=>$y)
114
115       but this is about as clumsy as the original.
116

AUTHOR

118       Tony Cook <tony@develop-help.com>
119

SEE ALSO

121       Imager(3), Imager::Font(3)
122
123
124
125perl v5.8.8                       2008-03-28             Imager::Font::BBox(3)
Impressum