aboutsummaryrefslogtreecommitdiff
path: root/src/DrawUtil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/DrawUtil.cc')
-rw-r--r--src/DrawUtil.cc54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/DrawUtil.cc b/src/DrawUtil.cc
index f83c1ca..46ce8d9 100644
--- a/src/DrawUtil.cc
+++ b/src/DrawUtil.cc
@@ -19,43 +19,43 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: DrawUtil.cc,v 1.10 2002/11/26 15:50:46 fluxgen Exp $ 22// $Id: DrawUtil.cc,v 1.11 2002/12/01 13:41:55 rathnor Exp $
23 23
24#include "DrawUtil.hh" 24#include "DrawUtil.hh"
25 25
26namespace DrawUtil { 26namespace DrawUtil {
27 27
28int doAlignment(int max_width, int bevel, Font::FontJustify justify, 28int doAlignment(int max_width, int bevel, Font::FontJustify justify,
29 const FbTk::Font &font, const char * const text, size_t textlen, size_t &newlen) { 29 const FbTk::Font &font, const char * const text, size_t textlen, size_t &newlen) {
30 30
31 if (text == 0 || textlen == 0) 31 if (text == 0 || textlen == 0)
32 return 0; 32 return 0;
33 33
34 int l = font.textWidth(text, textlen) + bevel; 34 int l = font.textWidth(text, textlen) + bevel;
35 size_t dlen = textlen; 35 size_t dlen = textlen;
36 int dx = bevel; 36 int dx = bevel;
37 if (l > max_width) { 37 if (l > max_width) {
38 for (; dlen > 0; dlen--) { 38 for (; dlen > 0; dlen--) {
39 l = font.textWidth(text, dlen) + bevel; 39 l = font.textWidth(text, dlen) + bevel;
40 if (l<=max_width) 40 if (l<=max_width)
41 break; 41 break;
42 } 42 }
43 } 43 }
44 44
45 newlen = dlen; 45 newlen = dlen;
46 46
47 switch (justify) { 47 switch (justify) {
48 case DrawUtil::Font::RIGHT: 48 case DrawUtil::Font::RIGHT:
49 dx = max_width - l - bevel; 49 dx = max_width - l - bevel;
50 break; 50 break;
51 case DrawUtil::Font::CENTER: 51 case DrawUtil::Font::CENTER:
52 dx = (max_width - l)/2; 52 dx = (max_width - l)/2;
53 break; 53 break;
54 case DrawUtil::Font::LEFT: 54 case DrawUtil::Font::LEFT:
55 break; 55 break;
56 } 56 }
57 57
58 return dx; 58 return dx;
59} 59}
60 60
61}; //end namespace DrawUtil 61}; //end namespace DrawUtil