pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Glyph

Glyph - 1.2.0

Chandler Armstrong (omnirizon)

Tags:

Description

glyph is a library for manipulating text and printing it to a pygame window.

so what? there are about a million pygame libraries to do that already.

glyph is different for a few reasons:

1) glyph provides a within string literal mini-language for text manipulation. you can use the mini-language to indicate what you want exactly where you want it, all right within the string literal.

2) glyph provides typesetting like functionality: positioning text, wrapping text, justifying text, scrolling text, switching font, text color, background color, even inserting images into text

3) glyph provides 'linked' text: text that returns a value whenever the mouse is hovering over it. this can be used to route the user around your program, or provide tooltips.

one simple object, the Glyph object, provides all this functionality. how? because Glyph interprets a mini-language, provided in string literals, that indicates how the Glyph object should treat text.

Changes

compiler added. lots of little nice changes. it rocks.

Links

Home Page: http://code.google.com/p/glyph/
Source: https://sourceforge.net/project/showfiles.php?group_id=249484

Screenshot


click to view original size

Releases

Glyph - 2.6.5 - Dec 23, 2012
Glyph - 2.6.0b - Jul 6, 2012
Glyph - 2.5.4rc - Jul 27, 2011
Glyph - 2.5.3rc - Jul 9, 2011
Glyph - 2.5.2rc - Jun 25, 2011
Glyph - 2.5.1 - Mar 27, 2011
Glyph - 2.5.0 - Mar 2, 2011
Glyph - 2.4.0 - Dec 12, 2010
Glyph - 2.1.0b - Oct 5, 2010
Glyph - 2.0.0.a2 - Aug 1, 2010
Glyph - 2.0.0.a - Jul 18, 2010
Glyph - 1.2.0 - Jan 14, 2009
Glyph - 1.1.0 - Jan 10, 2009
Glyph - 1.0.0 - Jan 3, 2009

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

February 16, 2013 5:32am - seputarsoftware - nickname: (seputarsoftware)
great job guys http://octavinsu.blogspot.com/2013/01/acer-iconia-pc-tablet-dengan-windows-8.html
February 16, 2013 5:31am - seputarsoftware - nickname: (seputarsoftware) - 5/5
cool game http://update-seputar-software.blogspot.com/2013/01/bank-mandiri-bank-terbaik-di-indonesia_7534.html
December 31, 2012 8:48am - seputarsoftware - nickname: (seputarsoftware) - 5/5
http://octavinsu.blogspot.com/2012/12/ekioskucom-jual-beli-online-aman.html
September 3, 2012 12:30pm - seputarsoftware - nickname: (seputarsoftware) - 5/5
http://update-seputar-software.blogspot.com/2012/08/lakucom-belanja-online-grosir-eceran.html
March 3, 2011 12:04pm - Robert Leachman - nickname: (quazar)
Tried 2.5.0 and it's not working. Looking at this feedback page maybe we should take it to email? I just wrote to omnirizon at users.sourceforge.net I am callmerob@gmail.com let's figure this out?
March 1, 2011 3:57pm - Robert Leachman - nickname: (quazar)
I released Pythentene and Glyph is in the credits. Omnirizon I wonder if you could take a look and see how I did? I wonder if there's any improvements you might note. It occurred to me to not default at 640x480 but instead can test and use a higher resolution, but still would be nice to make the tiny screen look as good as possible. In any case, thanks!
February 2, 2011 11:30pm - Robert Leachman - nickname: (quazar)
Well there's more to the story; I moved the font directory as you said but then the demo wouldn't start at all, so I *copied* the font directory to both places. No luck, so added a statement `print env[1]` right before the crash... I see it emits "font\silkscreen_bold.ttf" which would probably work on Windows but not on Unix. I think it's a job for os.path.join though I see you use that in some places so... dunno, HTH
January 30, 2011 11:53am - Chandler Armstrong - nickname: (omnirizon)
ok I see the problem. the glyph demo needs the font folder inside the same directory as the _glyph.py file. I thought I had packaged it that way, but at any rate it was bad form. I'll change the demo code to get its current working directory and look for font files there.

to get the demo working for you now, simply put the font directory that came packaged with glyph back in the glyph directory.
January 29, 2011 11:43am - Robert Leachman - nickname: (quazar)
Thanks for the reply omnirizon! I didn't figure out the error below. Tried some bitmap font action but it didn't seem to help, marked it to revisit later as you say it doesn't look too bad.
January 24, 2011 12:22am - Chandler Armstrong - nickname: (omnirizon)
also, I've got some updates incoming that fix problems with glyph. namely, sometimes strings too long for the glyph rect would cause errors before reaching the point that glyph informs the user the error is that the string was too long. also, there was a bug that often caused unwanted behavior if the input text began with an environment. finally, i've worked with the editor to provide text wrapping for it and simplify the process of using the cursor.
January 24, 2011 12:18am - Chandler Armstrong - nickname: (omnirizon)
hey there. did you get the problems with the font filename sorted? I need to do something to provide some information as to the source of the problem in the input text to glyph.

that image you linked looks fine. unfortunately, non-bitmap fonts tend to look less than stellar with pygame; I suppose the pygame font library doesn't handle the sub-pixel anti-aliasing instructions in curve-based fonts very well. I always use bitmap fonts. Silkscreen is good and one of the few bitmaps fonts to offer normal, bold, and italics versions of the same font. Proggy, though, is probably my favorite. take care, most bitmap fonts only look good at one size.
January 16, 2011 7:57pm - Robert Leachman - nickname: (quazar)
Mr. Armstrong you've saved me a ton of time! But there's other work to do so can't show you the source code yet... would you mind looking at http://tinyurl.com/4owob7q and tell me what I might have missed? The text layout is STELLAR but I wonder if it could render the font better? THANKS
January 16, 2011 7:55pm - Robert Leachman - nickname: (quazar)
I'm running 2.4 and the demo starts fine, the editor runs, but when I click to try to learn >here< to learn about this wonderous mini-language the demo crashes with:
File "demo.py", line 322, in <module>
demo.start()
File "demo.py", line 277, in start
glyph.input(PAGES[link], justify = 'justified')
File "/Users/rob/Downloads/glyphTest/glyph/glyph/_glyph.py", line 410, in input
interpreted_txt = interpret(txt) #
File "/Users/rob/Downloads/glyphTest/glyph/glyph/_glyph.py", line 321, in _interpret
envs.append(read_env(_txt_)) # append new environemt
File "/Users/rob/Downloads/glyphTest/glyph/glyph/_glyph.py", line 266, in __read_env
return ('font', Font(path, int(size))) # return new font
IOError: unable to read font filename
I'm running using Python 2.5 with this tree:
./demo.py
./font
./font/silkscreen.ttf
./font/silkscreen_bold.ttf
./font/silkscreen_expanded.ttf
./font/silkscreen_expanded_bold.ttf
./glyph
./glyph/__init__.py
./glyph/__init__.pyc
./glyph/_editor.py
./glyph/_editor.pyc
./glyph/_glyph.py
./glyph/_glyph.pyc
./img
./img/bkgscreen.tga
./img/blu_pot.tga
./img/red_pot.tga
./readme.txt
Also I've got something else on my mind... separate post.
December 20, 2010 10:22am - Chandler Armstrong - nickname: (omnirizon)
In the interest of repeatability, can you make sure the folder structure is like this:

glyph/__init__.py
glyph/_glyph.py
glyph/_editor.py
glyph/demo.py

make sure glyph is directly on your PYTHONPATH.

I cannot repeat your error, but I think it might be caused by you still having the glyph module inside a folder named 'glyph-2.4.0'. Also, make sure you include all the files in the module as I had packaged them, the __init__ file is responsible for naming the objects, so if you had replaced it the objects would not be available.
December 20, 2010 3:21am - Kilon Alios - nickname: (kilon)
Tried it, it reported this

Traceback (most recent call last):
File "C:\Users\XXX\Downloads\glyph-2.4.0\glyph\demo.py", line 3, in <module>
from glyph import Editor, Glyph, Macros
ImportError: cannot import name Editor
December 16, 2010 10:51am - Chandler Armstrong - nickname: (omnirizon)
yes, as I stated in the instructions above, _you_ must rename the folder to glyph. I don't have this packaged with an installer. The next release will provide an installer option; the practices of distribution are something I'm just now learning.
December 16, 2010 8:37am - Kilon Alios - nickname: (kilon) - 1/5
i tried to run it but it reports "no module named glyph" and fails to execute demo.py .
August 2, 2010 1:11am - Francesco Pasa - nickname: (frapa) - 5/5
Have you add background text color in the last release? It's very useful this library!!!
August 1, 2010 6:09am - Chandler Armstrong - nickname: (omnirizon)
request delivered! and then some.
July 22, 2010 8:28pm - Andy Hanson - nickname: (rhodiumgames)
It would be nice to have a resizing feature.
January 4, 2009 2:29pm - Chandler Armstrong - nickname: (omnirizon)
well everything should be working. i didn't include the scrolling view feature, but its easy enough to add to the program. you would simply need to add a variable that reset to zero every loop, and map a key, like PAGE_UP and PAGE_DOWN to change it to one or negative one (or a higher number for faster scrolling) for one loop, then add this variable to the scroller's output call.

you could do a similar thing for the pager object to see the page flipping feature, as long as you had some text that was more than could fit in the page height (by default, also the rect height).

actually, i think you could see page flipping on the current program in the editor. just type until you fill up the editor box, it should automatically flip to a new page and you can keep typing. backspace, deleting all characters off the new page, until the editor flips back to the old page. all your old text should still be there and your (invisible) cursor will be at the position of the most recent character.
January 4, 2009 7:47am - Luca Fabbri - nickname: (keul) - 4/5
However all this seems promising! I'm not sure of what of the features described are right now working (or may be that they aren't available through the example program?).
January 3, 2009 11:13pm - Chandler Armstrong - nickname: (omnirizon)
i noticed that too. it was kind of weird

i don't know html at all, and needed to use some to even be able to insert a description. your project was right there at the top and I just used your html source. so our descrip pages look a lot alike too :)

i've actually been working on/with this project since last summer. like you, i wrote it for a game i'm writing that needed lots of text processing. i didn't want to release until I had put the module through the angles by using it in actual design. I've finally done that now and am pretty happy with it, so decided to put it up.
January 3, 2009 10:18pm - Luca Fabbri - nickname: (keul)
D'oh! I think we released two very similar projects one some hours after the other, but for what I see you are more advanced :-)
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Aug 22, 2014

Aug 21, 2014


Aug 19, 2014

Aug 18, 2014

Aug 2, 2014


Jul 28, 2014

Jul 22, 2014

Jul 21, 2014

Jul 20, 2014

Jul 19, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)