From f0088489f842f4be237743c60148bd81f0938491 Mon Sep 17 00:00:00 2001 From: Nat! Date: Thu, 4 Aug 2022 01:05:05 +0200 Subject: [PATCH] small typo fix and documentation fix --- src/nanovg.c | 16 ++++++++-------- src/nanovg.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/nanovg.c b/src/nanovg.c index 61826e8..4e8dcee 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -2540,7 +2540,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; @@ -2553,11 +2553,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; } @@ -2858,7 +2858,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; @@ -2890,11 +2890,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 cb63e52..0d90570 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.