nanogui: abort due to invisible characters in a string


Previous by date: 16 Nov 2011 07:02:13 -0000 Re: libmwin, Greg Haerr
Next by date: 16 Nov 2011 07:02:13 -0000 Portrait mode image display problem., Don Heyse
Previous in thread:
Next in thread:

Subject: abort due to invisible characters in a string
From: "guylecordier" ####@####.####
Date: 16 Nov 2011 07:02:13 -0000
Message-Id: <C275C947E76D4700959330A94568B0BF@nom317d481a7de>

Hello all,



I have some invisible characters in a string to use them as marker and in a specific configuration of size of characters and window I get an assert when GrText() is called.



Example:

Char* MyString="A\nB";

Font proportional   1st character description=0x20   width of A=12pixels   width of B=12pixels    

Window width= 24pixels

Nano-X V0.92



When GrText() is called, linear8_drawpixel() aborts with 

User assertion failed: "x >= 0 && x < psd->xres", at fblin8.c:55



I think it is due to the test in gen_gettextsize() which is not similar to the test in gen_gettextbits() in genfont.c



gen_gettextsize() assumes the size of char '\n' = 0pixel

but gen_gettextbits() assumes char '\n' =1st char = SPACE



I did this modification in gen_gettextsize() of genfont.c 

-      if(c >= pf->firstchar && c < pf->firstchar+pf->size)

        width += pf->width[c - pf->firstchar];



+      /* if char not in font, map to first character by default*/

+      if(c < pf->firstchar || c >= pf->firstchar+pf->size)

+        c = pf->firstchar;

       width += pf->width[c - pf->firstchar];



Regards,

Guy



Previous by date: 16 Nov 2011 07:02:13 -0000 Re: libmwin, Greg Haerr
Next by date: 16 Nov 2011 07:02:13 -0000 Portrait mode image display problem., Don Heyse
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.