[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] PATCH: OTF fonts in windows/linux
- To: pygame-users@xxxxxxxx
- Subject: [pygame] PATCH: OTF fonts in windows/linux
- From: Ian Katz <ifreecarve@xxxxxxxxx>
- Date: Wed, 27 Oct 2010 14:49:07 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Wed, 27 Oct 2010 14:49:18 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=1NXZGTzyDYpoyO7yB2RRJd+VJK9slNzhjsu0eo4RL1o=; b=eWsYtXOjZfwbgtnbEm715SoEoeIh3Nxvhh3zSaywvYSFFVCDK7MQo88U/z19v1wj5O nNoiXVufraByyFa2WO5rML/qsPIbVlS2q3oN5irQgdqh0LrKq4OmPIEYP4UwmavJbl+2 fAKpfZorudpdIrt14qMDmxECkxSxEuMtDRjZU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ongy+yxG74g6RyzyIuakaaR2lg2dU8EyTpAUP39a2BGlTmqc0JnWEjD4FhrU1J4mBS u2s5z7XXhcDhcXZhXeKH/bP+bry0u4++BCu+PSXM+cXsEJoGrHFtlEX1wrrfoR8XYPRy sv3nzLDm/CCG0GiLxfin/KrYcIO6Z4wW8Dv7E=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Even though freetype supports OTF fonts, it looks like they are
rejected by pygame because of their extension. This patch enables
.otf fonts in pygame.font.get_fonts().
It's minimally tested (i.e., the enabled OTF fonts render properly),
but seems to work.
-Ian
--
Ian Katz
Research Engineer, MIT Sea Grant AUV Laboratory
ijk5@xxxxxxx / 617 253 9312
*** /usr/lib/python2.6/dist-packages/pygame/sysfont.py 2010-10-27 14:43:05.966510229 -0400
--- scratch/sysfont.py 2010-10-27 14:44:49.254511698 -0400
***************
*** 273,279 ****
# no goodness with str or MBCS encoding... skip this font.
continue
! if font[-4:].lower() not in [".ttf", ".ttc"]:
continue
if os.sep not in font:
font = os.path.join(fontdir, font)
--- 273,279 ----
# no goodness with str or MBCS encoding... skip this font.
continue
! if font[-4:].lower() not in [".ttf", ".ttc", ".otf"]:
continue
if os.sep not in font:
font = os.path.join(fontdir, font)
***************
*** 462,468 ****
for line in entries.split('\n'):
try:
filename, family, style = line.split(':', 2)
! if filename[-4:].lower() in ['.ttf', '.ttc']:
bold = style.find('Bold') >= 0
italic = style.find('Italic') >= 0
oblique = style.find('Oblique') >= 0
--- 462,468 ----
for line in entries.split('\n'):
try:
filename, family, style = line.split(':', 2)
! if filename[-4:].lower() in ['.ttf', '.ttc', '.otf']:
bold = style.find('Bold') >= 0
italic = style.find('Italic') >= 0
oblique = style.find('Oblique') >= 0