It's not SDL, but stb_truetype.h (https://github.com/nothings/stb/blob/master/stb_truetype.h) is a header-only lib which takes care of the 'tricky stuff' (rasterize font bitmap from TTF file, and provide font metrics), it doesn't give you text rendering out-of-the box though since it's 3D API agnostic. Here's a simple NanoVG (https://github.com/memononen/nanovg) demo which uses stb_truetype.h for its text rendering:
http://floooh.github.io/oryol/TestNanoVG.html Cheers, -Floh. Am Samstag, 25. Oktober 2014 02:27:01 UTC+2 schrieb Robert Clawson: > > Hi Everyone, > > I am having some success compiling my SDL graphics based application using > Emscripten but I have run into an issue. I was previously using the SDL_ttf > library for rendering text. So far I haven't been able to get this to work > for me with Emscripten. In my main application, the code crashes in the > _SDL_SoftBlit function which is blitting my text surface to the screen. I > can only suspect that the SDL_Surface created by TTF_RenderText_Solid is > somehow invalid (I did try checking for NULL). I also tried to create a > very simple test, and while the test does not crash, it also does not print > out any text, but only a black rectangle. > > To access the font file, I am using a "--preload-file blah.ttf" compile > flag, and then in the code I simply do TTF_OpenFont("blah.ttf", 22); > > I suspect I am doing something wrong. Does anyone have any ideas as to > what I can do differently, or a simple working example I can reference? > > Thanks. > > > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
