Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » some fixes for allegro 4.9.4 font addon

This thread is locked; no one can reply to it. rss feed Print
some fixes for allegro 4.9.4 font addon
Wagner Soares
Member #9,011
September 2007
avatar

I don't know if it was already fixed at this time, but anyway, here is some things that need to chage:
in allegro\addons\font\text.c

1void al_font_textout_centre(AL_CONST ALLEGRO_FONT *f, AL_CONST char *str, int x, int y)
2{
3 int len;
4 ASSERT(f);
5 ASSERT(str);
6 
7 len = al_font_text_length(f, str);
8 // this causes some unwanted characters, so strlen(str) must be ustrlen(str)
9 f->vtable->render(f, str, x - len/2, y, strlen(str));
10}
11void al_font_textout_right(AL_CONST ALLEGRO_FONT *f, AL_CONST char *str, int x, int y)
12{
13 int len;
14 ASSERT(f);
15 ASSERT(str);
16 
17 len = al_font_text_length(f, str);
18 // the same here
19 f->vtable->render(f, str, x - len, y, strlen(str));
20}

in allegro\addons\font\allegro5\a5_font.h

1// top of the file
2#ifndef A5_TTF_H
3#define A5_TTF_H
4 
5//the line with
6A5_TTF_FUNC(ALLEGRO_FONT *, al_ttf_load_font, (char const *filename, int size, int flags));
7// must change to
8#ifdef __cplusplus
9extern "C" {
10#endif
11 
12A5_TTF_FUNC(ALLEGRO_FONT *, al_ttf_load_font, (char const *filename, int size, int flags));
13 
14#ifdef __cplusplus
15}
16#endif
17 
18#endif // A5_TTF_H
19// I think this is self explanatory

Thomas Fjellstrom
Member #476
June 2000
avatar

Yeah, some files have forgotten to add the AL_EXTERN_C macros.

I suppose I could go through svn and fix anything I see.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Wagner Soares
Member #9,011
September 2007
avatar

I really want to fix it through SVN, but I've never used it.
I think now is the time to learn. :P

Thomas Fjellstrom
Member #476
June 2000
avatar

I just committed a few changes related to extern "C" in SVN. All addons main headers, and allegro's main headers all have proper extern "C" declarations now. Some internal or platform headers may be missing them, but you shouldn't include those normally yourself anyway ;)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Peter Wang
Member #23
April 2000

The ustrlen problem was fixed in SVN before your post, but thanks anyway!

GullRaDriel
Member #3,861
September 2003
avatar

An add on for his valuable try to help could be telling him how to use svn for doing a commit.

Not for allegro, but an example.

I tell that because I don't use svn enough to remember the commands, I just search for someone to commit for me each time.

SO it would be helpfull for me as for him ;-)

Thanks for giving a little of your previous time answering him and me.

Don't forget the sarcasms, else it would not be a good a.cc's answer !

;D

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Don't forget the sarcasms, else it would not be a good a.cc's answer !

Sorry, but allegro.cc is primarily a friendly community, only a few of the current regulars have decided to not be friendly.

Quote:

An add on for his valuable try to help could be telling him how to use svn for doing a commit.

Checkout a svn repo: svn co http://site/project-repo/path local-directory
Update a checked out repo: svn up
Check in any changes: svn ci

co == checkout
up == update
ci == checkin

you can substitute the short name for the long name if you like.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

GullRaDriel
Member #3,861
September 2003
avatar

Thomas said:

Sorry, but allegro.cc is primarily a friendly community, only a few of the current regulars have decided to not be friendly.

Well, :-[ , that was just me trying to do some humour :-/

I will do better next time perhaps.

Thanks for the answer.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Wagner Soares
Member #9,011
September 2007
avatar

Quote:

Checkout a svn repo: svn co http://site/project-repo/path local-directory
Update a checked out repo: svn up
Check in any changes: svn ci

co == checkout
up == update
ci == checkin

thanks for everybody
I'm now doing some research about SVN and CVS.
I love coding, and I love to help, so maybe I could do something to speed up things until allegro 5.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

I love coding, and I love to help, so maybe I could do something to speed up things until allegro 5.

And we appreciate help :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: