Sixthhokage2 / ohboy

Automatically exported from code.google.com/p/ohboy
GNU General Public License v2.0
0 stars 1 forks source link

Patch for /ubytegui/font.c #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Fixes errors when bulding without TTF font support.

Original issue reported on code.google.com by hi-...@team.lasyk.net on 9 Aug 2011 at 3:29

Attachments:

GoogleCodeExporter commented 9 years ago
I can't see what this patch does, it seems to only change the indentation.

Builds without TTF build fine without this patch, can you add more detail what 
this is fixing please?

Original comment by clac...@gmail.com on 10 Aug 2011 at 4:34

GoogleCodeExporter commented 9 years ago
note that i build in windows using codeblocks and the official Caanoo SDK, 
maybe it doesn't happen in linux...

font.c has 2 main fields of instructions: one for using when UBYTE_USE_FREETYPE 
is true, and another for using when UBYTE_USE_FREETYPE is false (you set this 
in the makefile)

When i build the project without UBYTE_USE_FREETYPE (for using Sfont), the 
compiler ignores this:

#include "ft2build.h"
#include "freetype.h"

#include "font.h"
#include "pixmap.h"

because #ifdef UBYTE_USE_FREETYPE is false. (up to this point everything is ok)

But for whatever reason it doesn't ignore the rest, and handles it as if it was 
not included in the #ifdef UBYTE_USE_FREETYPE field. 
Then i get errors when compiling because it reads FT_Init_FreeType, 
FT_Set_Char_Size etc... which are defined in the freetype.h and ft2build.h, but 
that files are not being included because #ifdef UBYTE_USE_FREETYPE is false.

but if i change the indentation a little, it recognizes the rest of the code as 
belonging to the #ifdef UBYTE_USE_FREETYPE field, and ignores it as it should.

When i was testing Sfont before adding it here, i had to delete all this code, 
because i always got the same error.

But with this fix, i can build both with and without TTF without problems.
Maybe this only fixes build errors in windows...

Original comment by hiban1...@gmail.com on 10 Aug 2011 at 10:14

GoogleCodeExporter commented 9 years ago
I've definitely built this under windows (not recently, at least a few months 
now) as my Windows build was missing ttf libs. This sounds like some weird 
compiler bug or incorrect makefile settings. You could try using gcc -E for 
diagnostics.

Original comment by clac...@gmail.com on 11 Aug 2011 at 5:09

GoogleCodeExporter commented 9 years ago
it's definitely not a makefile error, maybe codeblocks or the compiler is a bit 
picky about the indentations...
If this patch works ok for you, you could add it, so people using the same 
environment as me won't have errors when compiling...

no idea of how to use gcc -E... i'm a noob at all this, lol

Original comment by hiban1...@gmail.com on 11 Aug 2011 at 9:34

GoogleCodeExporter commented 9 years ago
This issue was closed by revision bdd2c957dfd8.

Original comment by clac...@gmail.com on 12 Aug 2011 at 3:42