Closed SNSTRUTHERS closed 5 years ago
Nanovg does not support stroked text.
su 10. maalisk. 2019 klo 10.45 Simon NE Struthers notifications@github.com kirjoitti:
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.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/memononen/nanovg/issues/533, or mute the thread https://github.com/notifications/unsubscribe-auth/AFAbyCNpQOM9vmUXTBDmE0DqjWgBl9zQks5vVMYygaJpZM4bnJHX .
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.