|
@@ -29,7 +29,7 @@
|
|
|
// "Zer" on mollyrocket (with fix)
|
|
|
// Cass Everitt
|
|
|
// stoiko (Haemimont Games)
|
|
|
-// Brian Hook
|
|
|
+// Brian Hook
|
|
|
// Walter van Niftrik
|
|
|
// David Gow
|
|
|
// David Given
|
|
@@ -218,7 +218,7 @@
|
|
|
// Curve tesselation 120 LOC \__ 550 LOC Bitmap creation
|
|
|
// Bitmap management 100 LOC /
|
|
|
// Baked bitmap interface 70 LOC /
|
|
|
-// Font name matching & access 150 LOC ---- 150
|
|
|
+// Font name matching & access 150 LOC ---- 150
|
|
|
// C runtime library abstraction 60 LOC ---- 60
|
|
|
//
|
|
|
//
|
|
@@ -311,7 +311,7 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
-#endif
|
|
|
+#endif
|
|
|
//
|
|
|
// Output:
|
|
|
//
|
|
@@ -325,9 +325,9 @@ int main(int argc, char **argv)
|
|
|
// :@@. M@M
|
|
|
// @@@o@@@@
|
|
|
// :M@@V:@@.
|
|
|
-//
|
|
|
+//
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
-//
|
|
|
+//
|
|
|
// Complete program: print "Hello World!" banner, with bugs
|
|
|
//
|
|
|
#if 0
|
|
@@ -599,7 +599,7 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, stbt
|
|
|
// Calling these functions in sequence is roughly equivalent to calling
|
|
|
// stbtt_PackFontRanges(). If you more control over the packing of multiple
|
|
|
// fonts, or if you want to pack custom data into a font texture, take a look
|
|
|
-// at the source to of stbtt_PackFontRanges() and create a custom version
|
|
|
+// at the source to of stbtt_PackFontRanges() and create a custom version
|
|
|
// using these functions, e.g. call GatherRects multiple times,
|
|
|
// building up a single array of rects, then call PackRects once,
|
|
|
// then call RenderIntoRects repeatedly. This may result in a
|
|
@@ -1350,7 +1350,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s
|
|
|
if (i != 0)
|
|
|
num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy);
|
|
|
|
|
|
- // now start the new one
|
|
|
+ // now start the new one
|
|
|
start_off = !(flags & 1);
|
|
|
if (start_off) {
|
|
|
// if we start off with an off-curve point, then when we need to find a point on the curve
|
|
@@ -1403,7 +1403,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s
|
|
|
int comp_num_verts = 0, i;
|
|
|
stbtt_vertex *comp_verts = 0, *tmp = 0;
|
|
|
float mtx[6] = {1,0,0,1,0,0}, m, n;
|
|
|
-
|
|
|
+
|
|
|
flags = ttSHORT(comp); comp+=2;
|
|
|
gidx = ttSHORT(comp); comp+=2;
|
|
|
|
|
@@ -1433,7 +1433,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s
|
|
|
mtx[2] = ttSHORT(comp)/16384.0f; comp+=2;
|
|
|
mtx[3] = ttSHORT(comp)/16384.0f; comp+=2;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Find transformation scales.
|
|
|
m = (float) STBTT_sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]);
|
|
|
n = (float) STBTT_sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]);
|
|
@@ -1691,7 +1691,7 @@ static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, i
|
|
|
float dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
|
|
|
STBTT_assert(z != NULL);
|
|
|
if (!z) return z;
|
|
|
-
|
|
|
+
|
|
|
// round dx down to avoid overshooting
|
|
|
if (dxdy < 0)
|
|
|
z->dx = -STBTT_ifloor(STBTT_FIX * -dxdy);
|
|
@@ -1769,7 +1769,7 @@ static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__ac
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
e = e->next;
|
|
|
}
|
|
|
}
|
|
@@ -2441,7 +2441,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
|
|
|
{
|
|
|
int ix0,iy0,ix1,iy1;
|
|
|
stbtt__bitmap gbm;
|
|
|
- stbtt_vertex *vertices;
|
|
|
+ stbtt_vertex *vertices;
|
|
|
int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);
|
|
|
|
|
|
if (scale_x == 0) scale_x = scale_y;
|
|
@@ -2464,7 +2464,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
|
|
|
if (height) *height = gbm.h;
|
|
|
if (xoff ) *xoff = ix0;
|
|
|
if (yoff ) *yoff = iy0;
|
|
|
-
|
|
|
+
|
|
|
if (gbm.w && gbm.h) {
|
|
|
gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata);
|
|
|
if (gbm.pixels) {
|
|
@@ -2475,7 +2475,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
|
|
|
}
|
|
|
STBTT_free(vertices, info->userdata);
|
|
|
return gbm.pixels;
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff)
|
|
|
{
|
|
@@ -2487,7 +2487,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigne
|
|
|
int ix0,iy0;
|
|
|
stbtt_vertex *vertices;
|
|
|
int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);
|
|
|
- stbtt__bitmap gbm;
|
|
|
+ stbtt__bitmap gbm;
|
|
|
|
|
|
stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0,&iy0,0,0);
|
|
|
gbm.pixels = output;
|
|
@@ -2509,7 +2509,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *
|
|
|
STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff)
|
|
|
{
|
|
|
return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff);
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint)
|
|
|
{
|
|
@@ -2519,7 +2519,7 @@ STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, uns
|
|
|
STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff)
|
|
|
{
|
|
|
return stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f,0.0f, codepoint, width,height,xoff,yoff);
|
|
|
-}
|
|
|
+}
|
|
|
|
|
|
STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)
|
|
|
{
|
|
@@ -2644,7 +2644,7 @@ static void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_node *no
|
|
|
con->y = 0;
|
|
|
con->bottom_y = 0;
|
|
|
STBTT__NOTUSED(nodes);
|
|
|
- STBTT__NOTUSED(num_nodes);
|
|
|
+ STBTT__NOTUSED(num_nodes);
|
|
|
}
|
|
|
|
|
|
static void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects)
|
|
@@ -2996,7 +2996,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd
|
|
|
n = 0;
|
|
|
for (i=0; i < num_ranges; ++i)
|
|
|
n += ranges[i].num_chars;
|
|
|
-
|
|
|
+
|
|
|
rects = (stbrp_rect *) STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context);
|
|
|
if (rects == NULL)
|
|
|
return 0;
|
|
@@ -3007,7 +3007,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd
|
|
|
n = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects);
|
|
|
|
|
|
stbtt_PackFontRangesPackRects(spc, rects, n);
|
|
|
-
|
|
|
+
|
|
|
return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects);
|
|
|
|
|
|
STBTT_free(rects, spc->user_allocator_context);
|
|
@@ -3060,7 +3060,7 @@ STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, i
|
|
|
//
|
|
|
|
|
|
// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string
|
|
|
-static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
|
|
|
+static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
|
|
|
{
|
|
|
stbtt_int32 i=0;
|
|
|
|
|
@@ -3099,7 +3099,7 @@ static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
-STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)
|
|
|
+STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)
|
|
|
{
|
|
|
return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((const stbtt_uint8*) s1, len1, (const stbtt_uint8*) s2, len2);
|
|
|
}
|