nanogui: segfault creating font from .fnt file


Previous by date: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Junior
Next by date: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Greg Haerr
Previous in thread: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Junior
Next in thread: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Greg Haerr

Subject: Re: [nanogui] segfault creating font from .fnt file
From: "Greg Haerr" ####@####.####
Date: 12 Jun 2007 06:09:12 +0100
Message-Id: <1b3c01c7acaf$ac7c4cb0$6401a8c0@winXP>

Well, if you're falling through the for() loop below, it means
that your font name isn't matching.  In the builtin case, its
not supposed to be a path, just a simple text string.  Stick
some printfs in the loop to see why the match isn't matching.
Make sure your name is specified in genfont.c.

Also, you could always return &pf[0] rather than 0 in the
non-match case, that will get you the first builtin font.

Regards,

Greg


> FNTNAME "/fonts/bdf/font.fnt"
>

Perhaps I'm misunderstanding this but for these fonts, which are fixed size,
I assume the
height will be 0. correct? as in
GrCreateFont(FONTNAME, 0, NULL);

I'm getting a segfaule because the GdCreateFonts returns 0 at :

/* check builtin fonts first for speed*/
    if (!height && (fontclass == MWLF_CLASS_ANY || fontclass ==
MWLF_CLASS_BUILTIN)) {
        for(i = 0; i < scrinfo.fonts; ++i) {
            if(!strcmpi(pf[i].name, fontname)) {
                pf[i].fontsize = pf[i].cfont->height;
                pf[i].fontattr = fontattr;
                EPRINTF("1 createfont: (height == 0) found builtin font %s
(%d)\n", fontname, i);
                return (PMWFONT)&pf[i];
            }
        }
        /*
         * Specified height=0 and no builtin font matched name.
         * if not font found with other renderer, no font
         * will be loaded, and 0 returned.
         *
         * We used to return the first builtin font.  If a font
         * return needs to be guaranteed, specify a non-zero
         * height, and the closest builtin font to the specified
         * height will always be returned.
         */
    }

Any size I use returns "not found". Am I using this correctly?



Previous by date: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Junior
Next by date: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Greg Haerr
Previous in thread: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Junior
Next in thread: 12 Jun 2007 06:09:12 +0100 Re: segfault creating font from .fnt file, Greg Haerr


Powered by ezmlm-browse 0.20.