Bennu Game Development

English Forums => Extensions => Topic started by: josebita on December 29, 2008, 12:35:52 AM

Title: Pango
Post by: josebita on December 29, 2008, 12:35:52 AM
Hi all:

Yesterday night and today (and with a bit of help :)) I've created a wrapper library for pango. Pango is the font rendering system for one of the two main linux desktop systems.
It's very useful, as it supports HTML-like markup in texts, so something like this is perfectly valid:
[code language="html4strict"]<span font_family="Arial" size="xx-large" color="#0000ff"><u>Hello</u>, World!</span>[/code]
The full list of supported markup is here (http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html).
In the spanish post (http://forum.bennugd.org/index.php?topic=393.msg4668#msg4668) I've attached the code for a very first version of the library, and the library compiled for a 32 bit linux system. It should work just fine in both 32 and 16 color bit modes, but will certainly not work in 16 bits (help appreciated, I believe the problem might be with the 16 bit mask values).
As soon as I fix the problem get some free time, I'll try to compile it for windows.
I've uploaded the windows version, refer to the spanish post for details.
Hope you find it useful.

As usual, screenshots:
Subscript and superscript example:
(http://lh5.ggpht.com/_RDT1BQDk_sQ/SVgYdyfJKiI/AAAAAAAAITE/-GLViQvwgB4/s800/emc2.png)
Rendering non-latin alphabets:
(http://lh4.ggpht.com/_RDT1BQDk_sQ/SVgYeC5DYYI/AAAAAAAAITM/H_TCpZHinw4/s800/Hello%20World.png)

[UPDATE] The 16 bits problem is fixed with some help from SplinterGU and should now work just fine. I've updated the link in the spanish forum with the new version.
Title: Re: Pango
Post by: Sandman on December 31, 2008, 02:12:25 AM
This looks very interesting. Hope to see a Windows version.
Title: Re: Pango
Post by: josebita on January 01, 2009, 11:04:19 PM
I've just uploaded the windows binaries to the wiki. They're quite difficult to compile because of all the dependencies I've had to compile by hand. You can find a step-by-step tutorial to get SDL_Pango compiled in mingw here (http://johnnypops.demon.co.uk/mingw/).
The first thing you have to do is run once "fc-list.exe". This will create the file "etc/fonts/.fonts-cache-1". When distributing your game, be sure to delete this file prior to packaging and then run, while installing, fc-list.exe again.
After that, you should be able to just compile and run the example in the zipfile.

Hope you find it very useful and use it a lot, as it was quite hard to get :)

PS: Sandman, if you believe I'm spamming the wiki, tell me and I'll move the file somewhere else, ok?
Title: Re: Pango
Post by: Sandman on January 02, 2009, 12:20:29 AM
Not at all, you're doing a great job. :) If the wiki is not a good place to store such things, then we'd need a different place. But we don't have a different place now, so it's good. Maybe we need a central place to upload these kind of things to.

Thanks for the build!
Title: Re: Pango
Post by: josebita on January 03, 2009, 12:29:19 AM
I've reuploaded the pack with a binary that was missing.
During installation, be sure to run both ".exe"s.

Ok, so I've tested this with sandman's bennugd wip18 in a machine other than the one I used to compile the library and the result is as follows:
(http://lh3.ggpht.com/_RDT1BQDk_sQ/SV6vrosKcLI/AAAAAAAAIV4/PGR5OlJRKU4/s800/SDLPango.jpg)
Title: Re: Pango
Post by: Sandman on October 20, 2009, 02:34:56 PM
The Windows package contains a gazillion files. Are they all needed? In the readme it says something about being able to use a MS backend.
Title: Re: Pango
Post by: josebita on October 20, 2009, 05:01:42 PM
I'm pretty positive they're all needed when rendering through freetype.
I should recompile the package for a newer version of the package with a couple of improvements I made. I'll then try to compile the package so that it uses the native windows font rendering functions, and we'll see.

But right now, I'm pretty busy :(