paragui-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-dev] PG_Font Bug Clarification


From: Mark Krosky
Subject: [paragui-dev] PG_Font Bug Clarification
Date: Tue, 23 Apr 2002 20:01:32 -0500

Here is a minimal example that reproduces the bug:

- start with tut1.cpp from the documentation

Under
#include "pgapplication.h"
Add
#include <pgfont.h>
Over
app.Run();
Add
PG_Font font("font.ttf");
It compiles, but does not link.
Problem: link error, because PG_Font constructor and destructor are not
found.
It looks like PG_Font is not appropriately defined in the library.

[I have my compiler recognizing the paragui headers as part of the standard include path; you'll need to change the <> to "" if you haven't done that.]

[More details below]

> I noticed a weird problem with PG_Font. I tried declaring a PG_Font object
> and get a compile error. Is this problem only in the Windows version, or
> is it present in all versions?

: What kind of error ? Where is the exact location of the error in the code ?

I was getting both a link error and a compile error.

I had to include the struct
struct PG_FontDataInternal {
        SDL_Color color;
        int alpha;
        int style;

        int size;
        int index;
        std::string name;

        Uint32 dummy1;
        Uint32 dummy2;

        PG_FontFaceCacheItem* FaceCache;

};

in my header somewhere in order to get things to compile.
[This struct was not used in my code, but it was used and undeclared in the ParaGUI headers.]

I manually included the PG_Font constructor and destructor in order to get it to link.

PG_Font::PG_Font(const char* fontfile, int size, int index) {
        my_internaldata = new PG_FontDataInternal;
        my_internaldata->FaceCache = NULL;

        my_internaldata->name = fontfile;
        my_internaldata->size = size;
        my_internaldata->index = index;
        my_internaldata->color.r = 255;
        my_internaldata->color.g = 255;
        my_internaldata->color.b = 255;
        my_internaldata->alpha = 255;
        my_internaldata->style = 0;

        my_internaldata->FaceCache = PG_FontEngine::LoadFontFace(fontfile, size, index);
        
        if(my_internaldata->FaceCache == NULL) {
                PG_LogERR("Unable to create font (name=\"%s\", size=\"%i\", index=\"%i\"", fontfile, size, index);
        }
}

PG_Font::~PG_Font() {
        delete my_internaldata;
}

> I had to take the relevant part of the ParaGUI source and put it in my
> application to get PG_Font to work

: Which part did you modify to get it working ?

I put in the above 2 segments.  I also had problems with the headers
#include <pglog.h>
#include <facecache.h>

I think that facecache.h is in a different directory from the other headers, which causes problems.

> Also, when I used "font.ttf" in the font constructor, ParaGUI was not abl
 
> to figure out to extract it from the theme file. When I manually extracted
> font.ttf from simple.zip, it worked. Can someone confirm this bug?

: Did you specify the subdir where the font file is located ? Alex

Why do I need to do that?  In simple.zip, everything is located in the same directory?  Are you saying that I need to do "simple\font.ttf" rather than "font.ttf"?  I thought that once I specify the "simple" theme, it automatically knows where to look?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]