Skip to content
Myr

debugging truetype crash

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent 067a1d1 · Browse files · 2 files+14 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−1 removed

  • tests:+14 added−1 removed

2 files+14 added−1 removed

modified:tests/stb.dsp+1 added-1 removed
64 unmodified lines
65# PROP Intermediate_Dir "Debug\stb"66# PROP Ignore_Export_Lib 067# PROP Target_Dir ""68# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c69# ADD CPP /nologo /MTd /W3 /GX /Zd /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "MAIN_TEST" /FR /FD /GZ /c69# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "TT_TEST" /FR /FD /GZ /c70# SUBTRACT CPP /YX71# ADD BASE RSC /l 0x409 /d "_DEBUG"72# ADD RSC /l 0x409 /d "_DEBUG"73BSC32=bscmake.exe
79 unmodified lines
modified:tests/test_truetype.c+13 added
2 unmodified lines
34#include <stdio.h>56char ttf_buffer[1<<25];7unsigned char output[512*100];89#ifdef TT_TEST1011void debug(void)12{13 stbtt_fontinfo font;14 fread(ttf_buffer, 1, 1<<25, fopen("c:/x/lm/LiberationMono-Regular.ttf", "rb"));15 stbtt_InitFont(&font, ttf_buffer, 0);1617 stbtt_MakeGlyphBitmap(&font, output, 6, 9, 512, 5.172414E-03f, 5.172414E-03f, 54);18}1920int main(int argc, char **argv)21{22 stbtt_fontinfo font;23 unsigned char *bitmap;24 int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 34807), s = (argc > 2 ? atoi(argv[2]) : 32);2526 debug();2728 fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/mingliu.ttc", "rb"));2930 stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));31 bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, (float)s), c, &w, &h, 0,0);
9 unmodified lines