Merge branch 'stbtt_const_chardata' of https://github.com/cdwfs/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 3afc3de, f5519a8 · Browse files · 1 file·+7 added−6 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+7 added−6 removed
- other:+7 added−6 removed
Provenance
- Commit
b280541- Tree
7437efd- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent 1
3afc3de- Parent 2
f5519a8
1 file changed+7 added−6 removed
modified:stb_truetype.h+7 added-6 removed
48 unmodified lines49 // Giumo X. Clanjor50 // Higor Euripedes51 // Thomas Fields52 // Derek Vinyard53+// Cort Stratton54 //55 // VERSION HISTORY56 //57 // 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts, num-fonts-in-TTC function434 unmodified lines492 float x0,y0,s0,t0; // top-left493 float x1,y1,s1,t1; // bottom-right494 } stbtt_aligned_quad;495 495-STBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, // same data as above496+STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, // same data as above497 int char_index, // character to display498 float *xpos, float *ypos, // pointers to current position in screen pixel space499 stbtt_aligned_quad *q, // output: quad to draw500 int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier91 unmodified lines592 //593 // To use with PackFontRangesGather etc., you must set it before calls594 // call to PackFontRangesGatherRects.595 595-STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, // same data as above596+STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above597 int char_index, // character to display598 float *xpos, float *ypos, // pointers to current position in screen pixel space599 stbtt_aligned_quad *q, // output: quad to draw600 int align_to_integer);2684 unmodified lines3285 }3286 return bottom_y;3287 }3288 3288-STBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)3289+STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)3290 {3291 float d3d_bias = opengl_fillrule ? 0 : -0.5f;3292 float ipw = 1.0f / pw, iph = 1.0f / ph;3292- stbtt_bakedchar *b = chardata + char_index;3293+ const stbtt_bakedchar *b = chardata + char_index;3294 int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f);3295 int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f);3296 3297 q->x0 = round_x + d3d_bias;435 unmodified lines3733 range.font_size = font_size;3734 return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1);3735 }3736 3736-STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)3737+STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)3738 {3739 float ipw = 1.0f / pw, iph = 1.0f / ph;3739- stbtt_packedchar *b = chardata + char_index;3740+ const stbtt_packedchar *b = chardata + char_index;3741 3742 if (align_to_integer) {3743 float x = (float) STBTT_ifloor((*xpos + b->xoff) + 0.5f);3744 float y = (float) STBTT_ifloor((*ypos + b->yoff) + 0.5f);315 unmodified lines