Need to write something: Freetype? .C? ttf? sdl? Raw? O_o

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ruspa
Posts: 19
Joined: Thu Sep 13, 2007 11:17 pm
Location: Gorizia, ITALY

Need to write something: Freetype? .C? ttf? sdl? Raw? O_o

Post by ruspa »

I'm trying to figure out how to display some fonts in opengl without writing from scratch (if possible, of course) something that loads a picture with fonts, splits in many tiny imgs, ecc..
I'm getting sick at seeing to all those different methods discussed in the forums, but none of them seem to work to me.

SDL crashes installation (He miss 6/6 programs he needs to ./configure), I saw that installing this "sdl" (whatever it is) package will let me include some new libraries capable of loading ttf.

svn co ...trunk... idem, it won't install. Well, after 1 hour downloading files, he stopped ("Can't move whatsoever, exiting") and this was in order to get FreeType libraries... this mean I don't have them yet.

I tried on my own the way of flib.rar file linked in this forum (used "search" alot) but is completely missing a source file that obiously include in a header. Dead end, again.

I also found some half-threads regarding ".c" fonts, tomorrow I will check again, never heard of a c format for a font.

It is so difficult to display a font in gu context? You guys that already achieved, on your opinion, in wich direction do you suggest me to head to?
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

A simple way I have used is to have a font sprite, I'm using a 128x128 sprite.
Fill it with characters as shown here:
http://localhost.geek.nz/crap/font.png (black background is just for effect, first line is just to check alignment, yes I'm wasting alot of the sprite)

Then you can easily blit the right characters using some simple maths. (Which I'll leave up to the reader) :-)


Hint: The characters are arranged in ascii character order:

Code: Select all

0123456789ABCDEF +00
0123456789ABCDEF +10
0123456789ABCDEF +20
0123456789ABCDEF +30
0123456789ABCDEF +40
0123456789ABCDEF +50
0123456789ABCDEF +60
0123456789ABCDEF +70
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

even then with this info it might not be possible for him :)
so i say what i always say to this question

look at samples/gu/font/ samples/gu/fancytext/
or better yet go learn the background behind APIs like freetype
10011011 00101010 11010111 10001001 10111010
ruspa
Posts: 19
Joined: Thu Sep 13, 2007 11:17 pm
Location: Gorizia, ITALY

Post by ruspa »

I forgot to mention that the example in the sdk was the first place where I looked... But surprisingly it has some missing libraries and some wrong includes, like:

#include XX_XXX_X

whitout < or " and nothing even similar to the library name mentioned... and as far as I know that must be my version of the toolchain corrupted or something. I should have a look tomorrow to fancytext (here in Italy it's 4.12 AM time to go to bed, shouldn't I?) as I can't remember of a fancytext directory in the examples.. Perhaps I got a sick toolchain (that's could explain why the same toolchain script destroyed my .bashrc in my laptop with kubuntu feisty, all the shell commands disappeared (no more sudo, no more "ls" ecc, "apt-get" neither O__O) after 3 hours downloading packages and the classic "permission denied" at the end. Luky me it was only a wrong path the toolchain changed in the bashrc pointing to usr/bin where the shell commands are)
I think I will pursue the way of doing the tiny split&blits on a image file, coz I like when I do things by myself.
I'll look for a datasheet on how rgb data are spread in a png file.. In case of need I will be tedious and boring to you and ask ask and ask again HAHA!
Good night!
Smong
Posts: 82
Joined: Tue Sep 04, 2007 4:44 am

Post by Smong »

Last time I looked it was in the samples/gu/text directory.
(+[__]%)
saulotmalo2
Posts: 43
Joined: Mon Sep 10, 2007 9:32 am

Post by saulotmalo2 »

i wrote a little open source library for PSP called 3D~GDS it should be on pspupdates.qj.net web. There is the code for rendering fonts on openGL you can add it to your code and start to write on screen ;).
Post Reply