Open ltqsoft opened 5 years ago
Do you have more information, like a working/non working example ?
Here is my example code:
int main() { texture_atlas_t atlas = texture_atlas_new(512, 512, 3); texture_font_t font = texture_font_new_from_file(atlas, 32, "Arial.ttf"); font->rendermode = RENDER_SIGNED_DISTANCE_FIELD; printf("Loaded %d glyphs\n", texture_font_load_glyphs(font, ALLCHARS)); getchar(); }
I built the project without using cmake this time (just manually add source files), and at the second time the exception has been thrown at a different line. If those works on your machine, may be I should rebuild FreeType, or I did messed something up with source files.
Do you know which line is faulty?
The program stopped at texture_atlas.c, line 98. And here are some content in my own source file, is it different?
94 for( i=0; i<height; ++i ) 95 { 96 memcpy( self->data+((y+i)self->width + x ) charsize depth, 97 data + (istride) charsize, width charsize * depth ); 98 }
From these information it is difficult to identify the problem. You should print all information (x,y,i,charsize,depth,etc.) to see if there's weird values.
I think there's a problem with loading the NULL glyph, if I comment it out, the program runs successfully (but I yet don't know if it works correctly).
Why do you get a NULL glyph?
Oops, I mean the glyph represent the NULL character ('\0'), it was loaded first of all by the texture_font_init(...) function.
Can you track (e.g. using printf) what is the faulty line?
Program crashed with access violation error when I set texture atlas depth to 3, it worked fine with depth=1. The other depth settings are yet to be checked so I don't know it also works or not.