@ -41,13 +41,14 @@
// Peter LaValle
// Peter LaValle
// Sergey Popov
// Sergey Popov
// Giumo X. Clanjor
// Giumo X. Clanjor
// Higor Euripedes
//
//
// Misc other:
// Misc other:
// Ryan Gordon
// Ryan Gordon
//
//
// VERSION HISTORY
// VERSION HISTORY
//
//
// 1.08 (2015-09-13) document stbtt_Rasterize()
// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges
// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;
// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;
// variant PackFontRanges to pack and render in separate phases;
// variant PackFontRanges to pack and render in separate phases;
// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);
// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);
@ -1695,7 +1696,7 @@ static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, i
//STBTT_assert(e->y0 <= start_point);
//STBTT_assert(e->y0 <= start_point);
if ( ! z ) return z ;
if ( ! z ) return z ;
z - > fdx = dxdy ;
z - > fdx = dxdy ;
z - > fdy = ( 1 / dxdy ) ;
z - > fdy = dxdy ! = 0.0f ? ( 1.0f / dxdy ) : 0.0f ;
z - > fx = e - > x0 + dxdy * ( start_point - e - > y0 ) ;
z - > fx = e - > x0 + dxdy * ( start_point - e - > y0 ) ;
z - > fx - = off_x ;
z - > fx - = off_x ;
z - > direction = e - > invert ? 1.0f : - 1.0f ;
z - > direction = e - > invert ? 1.0f : - 1.0f ;
@ -2098,11 +2099,13 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e,
// insert all edges that start before the bottom of this scanline
// insert all edges that start before the bottom of this scanline
while ( e - > y0 < = scan_y_bottom ) {
while ( e - > y0 < = scan_y_bottom ) {
if ( e - > y0 ! = e - > y1 ) {
stbtt__active_edge * z = stbtt__new_active ( & hh , e , off_x , scan_y_top , userdata ) ;
stbtt__active_edge * z = stbtt__new_active ( & hh , e , off_x , scan_y_top , userdata ) ;
STBTT_assert ( z - > ey > = scan_y_top ) ;
STBTT_assert ( z - > ey > = scan_y_top ) ;
// insert at front
// insert at front
z - > next = active ;
z - > next = active ;
active = z ;
active = z ;
}
+ + e ;
+ + e ;
}
}
@ -2845,7 +2848,7 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, stbtt_fon
ranges [ i ] . v_oversample = ( unsigned char ) spc - > v_oversample ;
ranges [ i ] . v_oversample = ( unsigned char ) spc - > v_oversample ;
for ( j = 0 ; j < ranges [ i ] . num_chars ; + + j ) {
for ( j = 0 ; j < ranges [ i ] . num_chars ; + + j ) {
int x0 , y0 , x1 , y1 ;
int x0 , y0 , x1 , y1 ;
int codepoint = ranges [ i ] . first_unicode_codepoint_in_range ? ranges [ i ] . first_unicode_codepoint_in_range + j : ranges [ i ] . array_of_unicode_codepoints [ j ] ;
int codepoint = ranges [ i ] . array_of_unicode_codepoints = = NULL ? ranges [ i ] . first_unicode_codepoint_in_range + j : ranges [ i ] . array_of_unicode_codepoints [ j ] ;
int glyph = stbtt_FindGlyphIndex ( info , codepoint ) ;
int glyph = stbtt_FindGlyphIndex ( info , codepoint ) ;
stbtt_GetGlyphBitmapBoxSubpixel ( info , glyph ,
stbtt_GetGlyphBitmapBoxSubpixel ( info , glyph ,
scale * spc - > h_oversample ,
scale * spc - > h_oversample ,
@ -2886,7 +2889,7 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, stbtt
if ( r - > was_packed ) {
if ( r - > was_packed ) {
stbtt_packedchar * bc = & ranges [ i ] . chardata_for_range [ j ] ;
stbtt_packedchar * bc = & ranges [ i ] . chardata_for_range [ j ] ;
int advance , lsb , x0 , y0 , x1 , y1 ;
int advance , lsb , x0 , y0 , x1 , y1 ;
int codepoint = ranges [ i ] . first_unicode_codepoint_in_range ? ranges [ i ] . first_unicode_codepoint_in_range + j : ranges [ i ] . array_of_unicode_codepoints [ j ] ;
int codepoint = ranges [ i ] . array_of_unicode_codepoints = = NULL ? ranges [ i ] . first_unicode_codepoint_in_range + j : ranges [ i ] . array_of_unicode_codepoints [ j ] ;
int glyph = stbtt_FindGlyphIndex ( info , codepoint ) ;
int glyph = stbtt_FindGlyphIndex ( info , codepoint ) ;
stbrp_coord pad = ( stbrp_coord ) spc - > padding ;
stbrp_coord pad = ( stbrp_coord ) spc - > padding ;
@ -3189,6 +3192,7 @@ STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *font_collection, const
// FULL VERSION HISTORY
// FULL VERSION HISTORY
//
//
// 1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges
// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;
// 1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;
// allow PackFontRanges to pack and render in separate phases;
// allow PackFontRanges to pack and render in separate phases;
// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);
// fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);