From ecb0a9c394802b535411ebdc1f4f23aa0edccdf6 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Fri, 14 Feb 2014 18:07:53 +0200 Subject: [PATCH] Removed scaling from nvgTextBounds and nvgVertMetrics and commented the behavior --- src/nanovg.c | 14 ++++++-------- src/nanovg.h | 2 ++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nanovg.c b/src/nanovg.c index 23519ea..f41f05b 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -1664,13 +1664,12 @@ float nvgText(struct NVGcontext* ctx, float x, float y, const char* string, cons float nvgTextBounds(struct NVGcontext* ctx, const char* string, const char* end, float* bounds) { struct NVGstate* state = nvg__getState(ctx); - float scale = 1.0f; // nvg__getFontScale(state); if (state->fontId == FONS_INVALID) return 0; - fonsSetSize(ctx->fs, state->fontSize*scale); - fonsSetSpacing(ctx->fs, state->letterSpacing*scale); - fonsSetBlur(ctx->fs, state->fontBlur*scale); + fonsSetSize(ctx->fs, state->fontSize); + fonsSetSpacing(ctx->fs, state->letterSpacing); + fonsSetBlur(ctx->fs, state->fontBlur); fonsSetAlign(ctx->fs, state->textAlign); fonsSetFont(ctx->fs, state->fontId); @@ -1680,13 +1679,12 @@ float nvgTextBounds(struct NVGcontext* ctx, const char* string, const char* end, void nvgVertMetrics(struct NVGcontext* ctx, float* ascender, float* descender, float* lineh) { struct NVGstate* state = nvg__getState(ctx); - float scale = 1.0f; // nvg__getFontScale(state); if (state->fontId == FONS_INVALID) return; - fonsSetSize(ctx->fs, state->fontSize*scale); - fonsSetSpacing(ctx->fs, state->letterSpacing*scale); - fonsSetBlur(ctx->fs, state->fontBlur*scale); + fonsSetSize(ctx->fs, state->fontSize); + fonsSetSpacing(ctx->fs, state->letterSpacing); + fonsSetBlur(ctx->fs, state->fontBlur); fonsSetAlign(ctx->fs, state->textAlign); fonsSetFont(ctx->fs, state->fontId); diff --git a/src/nanovg.h b/src/nanovg.h index 7926003..06b68b6 100644 --- a/src/nanovg.h +++ b/src/nanovg.h @@ -356,9 +356,11 @@ float nvgText(struct NVGcontext* ctx, float x, float y, const char* string, cons // Measures the specified text string. Parameter bounds should be a pointer to float[4] if // the bounding box of the text should be returned. Returns the width of the measured text. +// Current transform does not affect the measured values. float nvgTextBounds(struct NVGcontext* ctx, const char* string, const char* end, float* bounds); // Returns the vertical metrics based on the current text style. +// Current transform does not affect the measured values. void nvgVertMetrics(struct NVGcontext* ctx, float* ascender, float* descender, float* lineh);