Skip to content
Myr

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

1 file+7 added−6 removed

modified:stb_truetype.h+7 added-6 removed
48 unmodified lines
49// 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 function
434 unmodified lines
492 float x0,y0,s0,t0; // top-left493 float x1,y1,s1,t1; // bottom-right494} stbtt_aligned_quad;495495STBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, // same data as above496STBTT_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 earlier
91 unmodified lines
592//593// To use with PackFontRangesGather etc., you must set it before calls594// call to PackFontRangesGatherRects.595595STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, // same data as above596STBTT_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 lines
3285 }3286 return bottom_y;3287}32883288STBTT_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)3289STBTT_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);32963297 q->x0 = round_x + d3d_bias;
435 unmodified lines
3733 range.font_size = font_size;3734 return stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1);3735}37363736STBTT_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)3737STBTT_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;37413742 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