mirror of
https://github.com/memononen/nanovg
synced 2026-09-26 16:19:07 +03:00
small typo fix and documentation fix
This commit is contained in:
parent
397f3300bc
commit
f0088489f8
2 changed files with 9 additions and 9 deletions
16
src/nanovg.c
16
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;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue