diff --git a/src/nanovg.c b/src/nanovg.c index 4119d0d8..23f4bbe8 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -2543,7 +2543,7 @@ void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const ch NVGtextRow rows[2]; int nrows = 0, i; int oldAlign = state->textAlign; - int haling = state->textAlign & (NVG_ALIGN_LEFT | NVG_ALIGN_CENTER | NVG_ALIGN_RIGHT); + int halign = state->textAlign & (NVG_ALIGN_LEFT | NVG_ALIGN_CENTER | NVG_ALIGN_RIGHT); int valign = state->textAlign & (NVG_ALIGN_TOP | NVG_ALIGN_MIDDLE | NVG_ALIGN_BOTTOM | NVG_ALIGN_BASELINE); float lineh = 0; @@ -2556,11 +2556,11 @@ void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const ch while ((nrows = nvgTextBreakLines(ctx, string, end, breakRowWidth, rows, 2))) { for (i = 0; i < nrows; i++) { NVGtextRow* row = &rows[i]; - if (haling & NVG_ALIGN_LEFT) + if (halign & NVG_ALIGN_LEFT) nvgText(ctx, x, y, row->start, row->end); - else if (haling & NVG_ALIGN_CENTER) + else if (halign & NVG_ALIGN_CENTER) nvgText(ctx, x + breakRowWidth*0.5f - row->width*0.5f, y, row->start, row->end); - else if (haling & NVG_ALIGN_RIGHT) + else if (halign & NVG_ALIGN_RIGHT) nvgText(ctx, x + breakRowWidth - row->width, y, row->start, row->end); y += lineh * state->lineHeight; } @@ -2861,7 +2861,7 @@ void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, co float invscale = 1.0f / scale; int nrows = 0, i; int oldAlign = state->textAlign; - int haling = state->textAlign & (NVG_ALIGN_LEFT | NVG_ALIGN_CENTER | NVG_ALIGN_RIGHT); + int halign = state->textAlign & (NVG_ALIGN_LEFT | NVG_ALIGN_CENTER | NVG_ALIGN_RIGHT); int valign = state->textAlign & (NVG_ALIGN_TOP | NVG_ALIGN_MIDDLE | NVG_ALIGN_BOTTOM | NVG_ALIGN_BASELINE); float lineh = 0, rminy = 0, rmaxy = 0; float minx, miny, maxx, maxy; @@ -2893,11 +2893,11 @@ void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, co NVGtextRow* row = &rows[i]; float rminx, rmaxx, dx = 0; // Horizontal bounds - if (haling & NVG_ALIGN_LEFT) + if (halign & NVG_ALIGN_LEFT) dx = 0; - else if (haling & NVG_ALIGN_CENTER) + else if (halign & NVG_ALIGN_CENTER) dx = breakRowWidth*0.5f - row->width*0.5f; - else if (haling & NVG_ALIGN_RIGHT) + else if (halign & NVG_ALIGN_RIGHT) dx = breakRowWidth - row->width; rminx = x + row->minx + dx; rmaxx = x + row->maxx + dx; diff --git a/src/nanovg.h b/src/nanovg.h index cb63e52e..0d90570f 100644 --- a/src/nanovg.h +++ b/src/nanovg.h @@ -537,7 +537,7 @@ void nvgStroke(NVGcontext* ctx); // const char* txt = "Text me up."; // nvgTextBounds(vg, x,y, txt, NULL, bounds); // nvgBeginPath(vg); -// nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]); +// nvgRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]); // nvgFill(vg); // // Note: currently only solid color fill is supported for text.