paragui-dev
[Top][All Lists]
Advanced

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

Re: [paragui-dev] PG_Font Repost - plaintext version


From: Alexander Pipelka
Subject: Re: [paragui-dev] PG_Font Repost - plaintext version
Date: 24 Apr 2002 08:47:58 +0200

Maybe you didn't notice it but PG_Font has a non public constructor.
That means you cannot create PG_Font objects by yourself.

Why do you want to do that ?

Just use 'PG_Widget::SetFontName("myfont.ttf");'.
That much easier i think.

If you take a look at the simple.zip file.
It's structured like this:

simple.theme
simple/font.ttf
simple/*.png

If you would like to access simple.theme you would pass "simple.theme"
to PG_FileArchive. If you want to access "font.ttf" in there you need
"simple/font.ttf" !!

Got it ?

Alex


Am Mit, 2002-04-24 um 03.41 schrieb Mark Krosky:
> I forgot about the HTML tags.  Here's a plaintext version.  (When I cut 
> from the browser to my E-Mail, it wound up making a "rich text" 
> message.)  What's the policy for this list?  Plaintext only, or is rich 
> text allowed?
> 
> 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?
> 
> 
> _______________________________________________
> paragui-dev mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-dev
> 






reply via email to

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