Fontypython is entertainment




I continued my research of fonts and came upon fontypython. It is a wxPython interface and uses the Pil,(Python Imaging Library), ImageFont, ImageDraw, and creates a gui to group and install fonts. I retreived the source (apt-get source fontypython) then looked throught the code to see what was being done to display the font information. I have a serious need for good LaTeX like symbols in my OpenGL , which is achieved by using the Python interface in the program to use it to build structured textures for equations and symbols for the interface chambers between dimensions. It allows me to have a larger character set of immediately recognizable dimensions for a particular problem set. If it were a mathematical sequence then I could go in the Integral direction, for example. The code I used to probe the LaTeX ttf files is below. It was a Q&D implementation to just see where to look and how it gets represented at various font sizes. I will probably go beyond ttf and use full textured three dimensional symbols that rotate and provide a wider range of symbols to select dimensions quickly while traversing the virtual n-dimensional cave solution tree matrix.



import ImageFont, ImageDraw
import Image
fontl=['/usr/share/fonts/truetype/latex-xft-fonts/cmex10.ttf',
 '/usr/share/fonts/truetype/latex-xft-fonts/cmmi10.ttf',
 '/usr/share/fonts/truetype/latex-xft-fonts/cmr10.ttf',
 '/usr/share/fonts/truetype/latex-xft-fonts/cmsy10.ttf',
 '/usr/share/fonts/truetype/latex-xft-fonts/msam10.ttf',
 '/usr/share/fonts/truetype/latex-xft-fonts/msbm10.ttf',
 '/usr/share/fonts/truetype/latex-xft-fonts/wasy10.ttf']

fontsize=20
ttfname='/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/UnBatangBold.ttf'
fontn = ImageFont.truetype(ttfname, fontsize)
aname=""
basePoint=32
groupsize=48
for fn in fontl:
 im=Image.new("RGB",(fontsize*(groupsize+8)+10, 32+fontsize*((256-basePoint)/groupsize)))
 draw = ImageDraw.Draw(im)
 fontm = ImageFont.truetype(fn, fontsize)
 for s in range((int)((256-basePoint)/groupsize)):
  aname=""
  for i in range(groupsize):
   aname=aname+chr(basePoint+i+s*groupsize)
  draw.text((10,s*(fontsize+1)), "At "+str(s*groupsize+basePoint), font=fontn)
  draw.text((10+fontsize*8, s*(fontsize+1)), aname, font=fontm)
 im.show()

0 comments:

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen