Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv10751
Modified Files:
osd.py
Log Message:
Fix drawstringframedhard: the ellipses must fit the width, too
Index: osd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/osd.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** osd.py 15 Mar 2003 10:15:43 -0000 1.23
--- osd.py 20 Mar 2003 19:27:19 -0000 1.24
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.24 2003/03/20 19:27:19 dischi
+ # Fix drawstringframedhard: the ellipses must fit the width, too
+ #
# Revision 1.23 2003/03/15 10:15:43 dischi
# Faster caching and there is no need for fchksum anymore
***************
*** 947,951 ****
# - Improve it
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None,
bgcolor=None,
! font=None, ptsize=0, align_h='left', align_v='top',
layer=None, ellipses='...'):
if not pygame.display.get_init():
--- 950,955 ----
# - Improve it
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None,
bgcolor=None,
! font=None, ptsize=0, align_h='left', align_v='top',
! layer=None, ellipses='...'):
if not pygame.display.get_init():
***************
*** 987,993 ****
lines = [ '' ]
line_number = 0
for i in range(len(string)):
char_size, char_height = self.charsize(string[i], font, ptsize)
! if ((occupied_size + char_size) <= width) and (string[i] != '\n'):
occupied_size += char_size
if string[i] == '\t':
--- 991,998 ----
lines = [ '' ]
line_number = 0
+ ellipse_size = self.stringsize(ellipses, font, ptsize)[0]
for i in range(len(string)):
char_size, char_height = self.charsize(string[i], font, ptsize)
! if ((occupied_size + char_size + ellipse_size) <= width) and (string[i]
!= '\n'):
occupied_size += char_size
if string[i] == '\t':
***************
*** 1009,1021 ****
lines[line_number] = string[i]
else:
- tmp_size, tmp_height = self.stringsize('...', font, ptsize)
j = 1
len_line = len(lines[line_number])
for j in range(len_line):
! if (occupied_size + tmp_size) <= width: break
! char_size, char_height =
self.charsize(lines[line_number][len_line-j-1], font, ptsize)
occupied_size -= char_size
lines[line_number] = lines[line_number][0:len_line-j]
if ellipses:
lines[line_number] += ellipses
break
--- 1014,1030 ----
lines[line_number] = string[i]
else:
j = 1
len_line = len(lines[line_number])
for j in range(len_line):
! if (occupied_size + ellipse_size) <= width:
! break
! char_size = self.charsize(lines[line_number][len_line-j-1],
! font, ptsize)[0]
occupied_size -= char_size
lines[line_number] = lines[line_number][0:len_line-j]
if ellipses:
+ while ellipses and ellipse_size >= width:
+ ellipses = ellipses[:-1]
+ ellipse_size = self.stringsize(ellipses, font, ptsize)[0]
lines[line_number] += ellipses
break
***************
*** 1032,1035 ****
--- 1041,1049 ----
for line in lines:
+ # FIXME:
+ # shorten line, maybe it's too long. It may be ellipses, but
+ # sometimes it also too long, don't know why.
+ #while line and self.stringsize(line, font, ptsize)[0] > width:
+ # line = line[:-1]
if align_h == 'left':
x0 = x
-------------------------------------------------------
This SF.net email is sponsored by: Tablet PC.
Does your code think in ink? You could win a Tablet PC.
Get a free Tablet PC hat just for playing. What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog