memononen/nanovg

Stroked Text

Closed this issue · 1 comments

How can I created stroked text using NanoVG?

void RenderText(string font, string text, float x, float y, NVGcolor fill, NVGcolor outline, float thickness, int text_align = NVG_ALIGN_LEFT | NVG_ALIGN_TOP) {
nvgFontFace(nvg_ctx, font.c_str());
nvgFontSize(nvg_ctx, size);
nvgTextAlign(nvg_ctx, text_align);
nvgFillColor(nvg_ctx, fill);
nvgStrokeWidth(nvg_ctx, thickness);
nvgStrokeColor(nvg_ctx, outline);
nvgText(nvg_ctx, x, y, text.c_str(), text.c_str() + text.size());
}

I've been trying to do it like this but it doesn't work. SDL_ttf supports font outlines, and I need to see if NanoVG provides a similar feature, but so far it doesn't seem to be.