Skip to content
Myr

Merge branch 'master' of http://github.com/rygorous/stb into working

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parents 17e82a4, f36b711 · Browse files · 1 file+16 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−9 removed

  • other:+16 added−9 removed

1 file+16 added−9 removed

modified:stb_truetype.h+16 added-9 removed
1383 unmodified lines
13841385void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1)1386{1387 int x0,y0,x1,y1;1388 if (!stbtt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1))1389 x0=y0=x1=y1=0; // e.g. space character1390 // now move to integral bboxes (treating pixels as little squares, what pixels get touched)?1391 if (ix0) *ix0 = STBTT_ifloor(x0 * scale_x + shift_x);1392 if (iy0) *iy0 = -STBTT_iceil (y1 * scale_y + shift_y);1393 if (ix1) *ix1 = STBTT_iceil (x1 * scale_x + shift_x);1394 if (iy1) *iy1 = -STBTT_ifloor(y0 * scale_y + shift_y);1388 if (!stbtt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1)) {1389 // e.g. space character1390 if (ix0) *ix0 = 0;1391 if (iy0) *iy0 = 0;1392 if (ix1) *ix1 = 0;1393 if (iy1) *iy1 = 0;1394 } else {1395 // move to integral bboxes (treating pixels as little squares, what pixels get touched)?1396 if (ix0) *ix0 = STBTT_ifloor( x0 * scale_x + shift_x);1397 if (iy0) *iy0 = STBTT_ifloor(-y1 * scale_y + shift_y);1398 if (ix1) *ix1 = STBTT_iceil ( x1 * scale_x + shift_x);1399 if (iy1) *iy1 = STBTT_iceil (-y0 * scale_y + shift_y);1400 }1401}14021403void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)1404{1405 stbtt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y,0.0f,0.0f, ix0, iy0, ix1, iy1);1406}
238 unmodified lines
1645 e[n].invert = 1;1646 a=j,b=k;1647 }1648 e[n].x0 = p[a].x * scale_x + shift_x;1642 e[n].y0 = p[a].y * y_scale_inv * vsubsample + shift_y;1649 e[n].y0 = (p[a].y * y_scale_inv + shift_y) * vsubsample;1650 e[n].x1 = p[b].x * scale_x + shift_x;1644 e[n].y1 = p[b].y * y_scale_inv * vsubsample + shift_y;1651 e[n].y1 = (p[b].y * y_scale_inv + shift_y) * vsubsample;1652 ++n;1653 }1654 }1655
442 unmodified lines