| 1 |
lars |
1 |
<?php
|
|
|
2 |
// $Header: /cvsroot/html2ps/box.text.string.php,v 1.5 2006/10/06 20:10:52 Konstantin Exp $
|
|
|
3 |
|
|
|
4 |
// TODO: from my POV, it wll be better to pass the font- or CSS-controlling object to the constructor
|
|
|
5 |
// instead of using globally visible functions in 'show'.
|
|
|
6 |
|
|
|
7 |
class TextBoxString extends TextBox {
|
|
|
8 |
function &create($text, $encoding) {
|
|
|
9 |
$box =& new TextBoxString($text, $encoding);
|
|
|
10 |
$box->readCSS($pipeline->get_current_css_state());
|
|
|
11 |
return $box;
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
function TextBoxString($word, $encoding) {
|
|
|
15 |
// Call parent constructor
|
|
|
16 |
$this->TextBox();
|
|
|
17 |
$this->add_subword($word, $encoding, array());
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
function get_extra_bottom() {
|
|
|
21 |
return 0;
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
// "Pure" Text boxes never have margins/border/padding
|
|
|
25 |
function get_extra_left() {
|
|
|
26 |
return 0;
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
// "Pure" Text boxes never have margins/border/padding
|
|
|
30 |
function get_extra_right() {
|
|
|
31 |
return 0;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
function get_extra_top() {
|
|
|
35 |
return 0;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
function get_full_width() {
|
|
|
39 |
return $this->width;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
function get_margin_top() {
|
|
|
43 |
return 0;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
function get_min_width(&$context) {
|
|
|
47 |
return $this->width;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
function get_max_width(&$context) {
|
|
|
51 |
return $this->width;
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
// Note that we don't need to call complicated 'get_width' function inherited from GenericFormattedBox,
|
|
|
55 |
// a TextBox never have width constraints nor children; its width is always defined by the string length
|
|
|
56 |
function get_width() {
|
|
|
57 |
return $this->width;
|
|
|
58 |
}
|
|
|
59 |
}
|
|
|
60 |
?>
|