[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Font height
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Font height
- From: "andrew baker" <failrate@xxxxxxxxx>
- Date: Tue, 9 May 2006 20:03:59 -0700
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 09 May 2006 23:04:02 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=HvV4mejGyWQ8MAMqEkdO9quJL6QGjtO8Oh4YhBQTXwErYmuZDUTMqiFwny72fhOajKKAP3JYNglsdNYv0fHDbtwxkmmeGATb9iy+472cXIE3lkEQU062lyRFVtuaLxOIZ/qDC6TjeYdzYtQByNQtdbdNBZP7HtWEch4EousH+SU=
- In-reply-to: <44613FFE.1040808@wi.rr.com>
- References: <44613FFE.1040808@wi.rr.com>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Well, y'all set the size when you initialize the font, innit? I have this as a variable, and I reference that variable as an offset other places where I blit text written in that font.
EX:
out_text = []
while len(text) > width:
if text[width] == ' ':
out_text.append(text[:width])
text = text[width:]
else:
new_width = text.rfind(' ', 0, width)
if new_width == -1:
new_width = width
out_text.append(text[:new_width])
text = text[new_width+1:]
out_text.append(text)
for line in out_text:
readout = gfx.font.render(line, 1, (0,0,0,255))
self.display_menu.blit(readout, (world.font_size, height*world.font_size))
height+=1
On 5/9/06, Mike Wyatt <mwyatt@xxxxxxxxx> wrote:
Is there any way to manually adjust the height of a font rendered in
PyGame? Ascent and descent are set to values that are quite a bit
larger than I would prefer, resulting in my text being drawn roughly 40%
lower than the given position. There are no setters for those
attributes (only getters). I could manually move the rendered text a
bit higher on the display, but that is a bit hacky and probably won't
work quite right for any given height value.
Thoughts?
--
Andrew Ulysses Baker
"failrate"