- iceil
int iceil(float x)
Undocumented in source. Be warned that the author may not have intended to support it.
- ifloor
int ifloor(float x)
Undocumented in source. Be warned that the author may not have intended to support it.
- new_active
stbtt__active_edge* new_active(stbtt__edge* e, int off_x, float start_point)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_FindGlyphIndex
int stbtt_FindGlyphIndex(const(stbtt_fontinfo)* info, int unicode_codepoint)
If you're going to perform multiple operations on the same character
and you want a speed-up, call this function with the character you're
going to process, then use glyph-based functions instead of the
codepoint-based functions.
- stbtt_FlattenCurves
stbtt__point* stbtt_FlattenCurves(stbtt_vertex* vertices, int num_verts, float objspace_flatness, int** contour_lengths, int* num_contours)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_FreeBitmap
void stbtt_FreeBitmap(ubyte* bitmap)
Frees the allocated bitmap.
- stbtt_FreeShape
void stbtt_FreeShape(stbtt_fontinfo* info, stbtt_vertex* v)
- stbtt_GetCodepointBitmap
ubyte* stbtt_GetCodepointBitmap(stbtt_fontinfo* info, float scale_x, float scale_y, int codepoint, int* width, int* height, int* xoff, int* yoff)
Allocates a large-enough single-channel 8bpp bitmap and renders the
specified character/glyph at the specified scale into it, with
antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque).
*width & *height are filled out with the width & height of the bitmap,
which is stored left-to-right, top-to-bottom.
- stbtt_GetCodepointBitmapBox
void stbtt_GetCodepointBitmapBox(stbtt_fontinfo* font, int codepoint, float scale_x, float scale_y, int* ix0, int* iy0, int* ix1, int* iy1)
Gets the bbox of the bitmap centered around the glyph origin; so the
bitmap width is ix1-ix0, height is iy1-iy0, and location to place
the bitmap top left is (leftSideBearing*scale,iy0).
(Note that the bitmap uses y-increases-down, but the shape uses
y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.)
- stbtt_GetCodepointBitmapBoxSubpixel
void stbtt_GetCodepointBitmapBoxSubpixel(stbtt_fontinfo* font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int* ix0, int* iy0, int* ix1, int* iy1)
Same as stbtt_GetCodepointBitmapBox, but you can specify a subpixel
shift for the character.
- stbtt_GetCodepointBitmapSubpixel
ubyte* stbtt_GetCodepointBitmapSubpixel(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)
The same as stbtt_GetCodepoitnBitmap, but you can specify a subpixel
shift for the character.
- stbtt_GetCodepointBox
int stbtt_GetCodepointBox(stbtt_fontinfo* info, int codepoint, int* x0, int* y0, int* x1, int* y1)
Gets the bounding box of the visible part of the glyph, in unscaled coordinates
- stbtt_GetCodepointHMetrics
void stbtt_GetCodepointHMetrics(stbtt_fontinfo* info, int codepoint, int* advanceWidth, int* leftSideBearing)
leftSideBearing is the offset from the current horizontal position to the left edge of the character
advanceWidth is the offset from the current horizontal position to the next horizontal position
these are expressed in unscaled coordinates
- stbtt_GetCodepointKernAdvance
int stbtt_GetCodepointKernAdvance(stbtt_fontinfo* info, int ch1, int ch2)
an additional amount to add to the 'advance' value between ch1 and ch2
@TODO; for now always returns 0!
- stbtt_GetCodepointShape
int stbtt_GetCodepointShape(stbtt_fontinfo* info, int unicode_codepoint, stbtt_vertex** vertices)
- stbtt_GetFontBoundingBox
void stbtt_GetFontBoundingBox(stbtt_fontinfo* info, int* x0, int* y0, int* x1, int* y1)
the bounding box around all possible characters
- stbtt_GetFontOffsetForIndex
int stbtt_GetFontOffsetForIndex(const(ubyte)* font_collection, int index)
Each .ttf/.ttc file may have more than one font. Each font has a sequential
index number starting from 0. Call this function to get the font offset for
a given index; it returns -1 if the index is out of range. A regular .ttf
file will only define one font and it always be at offset 0, so it will
return '0' for index 0, and -1 for all other indices. You can just skip
this step if you know it's that kind of font.
- stbtt_GetFontVMetrics
void stbtt_GetFontVMetrics(stbtt_fontinfo* info, int* ascent, int* descent, int* lineGap)
Ascent is the coordinate above the baseline the font extends; descent
is the coordinate below the baseline the font extends (i.e. it is typically negative)
lineGap is the spacing between one row's descent and the next row's ascent...
so you should advance the vertical position by "*ascent - *descent + *lineGap"
these are expressed in unscaled coordinates, so you must multiply by
the scale factor for a given size
- stbtt_GetGlyphBitmap
ubyte* stbtt_GetGlyphBitmap(stbtt_fontinfo* info, float scale_x, float scale_y, int glyph, int* width, int* height, int* xoff, int* yoff)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_GetGlyphBitmapBox
void stbtt_GetGlyphBitmapBox(stbtt_fontinfo* font, int glyph, float scale_x, float scale_y, int* ix0, int* iy0, int* ix1, int* iy1)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_GetGlyphBitmapBoxSubpixel
void stbtt_GetGlyphBitmapBoxSubpixel(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)
///////////////////////////////////////////////////////////////////////////
- stbtt_GetGlyphBitmapSubpixel
ubyte* stbtt_GetGlyphBitmapSubpixel(stbtt_fontinfo* info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int* width, int* height, int* xoff, int* yoff)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_GetGlyphBox
int stbtt_GetGlyphBox(stbtt_fontinfo* info, int glyph_index, int* x0, int* y0, int* x1, int* y1)
As above, but takes one or more glyph indices for greater efficiency
- stbtt_GetGlyphHMetrics
void stbtt_GetGlyphHMetrics(stbtt_fontinfo* info, int glyph_index, int* advanceWidth, int* leftSideBearing)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_GetGlyphKernAdvance
int stbtt_GetGlyphKernAdvance(const(stbtt_fontinfo)* info, int glyph1, int glyph2)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_GetGlyphShape
int stbtt_GetGlyphShape(stbtt_fontinfo* info, int glyph_index, stbtt_vertex** pvertices)
- stbtt_InitFont
int stbtt_InitFont(stbtt_fontinfo* info, const(ubyte)* data2, int fontstart)
Given an offset into the file that defines a font, this function builds
the necessary cached info for the rest of the system. You must allocate
the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't
need to do anything special to free it, because the contents are pure
value data with no additional data structures. Returns 0 on failure.
- stbtt_IsGlyphEmpty
int stbtt_IsGlyphEmpty(stbtt_fontinfo* info, int glyph_index)
- stbtt_MakeCodepointBitmap
void stbtt_MakeCodepointBitmap(stbtt_fontinfo* info, ubyte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)
The same as stbtt_GetCodepointBitmap, but you pass in storage for the bitmap
in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap
is clipped to out_w/out_h bytes. Call stbtt_GetCodepointBitmapBox to get the
width and height and positioning info for it first.
- stbtt_MakeCodepointBitmapSubpixel
void stbtt_MakeCodepointBitmapSubpixel(stbtt_fontinfo* info, ubyte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint)
Same as stbtt_MakeCodepointBitmap, but you can specify a subpixel
shift for the character.
- stbtt_MakeGlyphBitmap
void stbtt_MakeGlyphBitmap(stbtt_fontinfo* info, ubyte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_MakeGlyphBitmapSubpixel
void stbtt_MakeGlyphBitmapSubpixel(stbtt_fontinfo* info, ubyte* output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_Rasterize
void stbtt_Rasterize(stbtt__bitmap* result, float flatness_in_pixels, stbtt_vertex* vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_ScaleForMappingEmToPixels
float stbtt_ScaleForMappingEmToPixels(stbtt_fontinfo* info, float pixels)
computes a scale factor to produce a font whose EM size is mapped to
'pixels' tall. This is probably what traditional APIs compute, but
I'm not positive.
- stbtt_ScaleForPixelHeight
float stbtt_ScaleForPixelHeight(stbtt_fontinfo* info, float height)
Computes a scale factor to produce a font whose "height" is 'pixels' tall.
Height is measured as the distance from the highest ascender to the lowest
descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics
and computing:
scale = pixels / (ascent - descent)
so if you prefer to measure height by the ascent only, use a similar calculation.
- stbtt__GetGlyfOffset
int stbtt__GetGlyfOffset(stbtt_fontinfo* info, int glyph_index)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__add_point
void stbtt__add_point(stbtt__point* points, int n, float x, float y)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__close_shape
int stbtt__close_shape(stbtt_vertex* vertices, int num_vertices, int was_off, int start_off, int sx, int sy, int scx, int scy, int cx, int cy)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__fill_active_edges
void stbtt__fill_active_edges(ubyte* scanline, int len, stbtt__active_edge* e, int max_weight)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__find_table
uint stbtt__find_table(const(ubyte)* data, uint fontstart, string tag)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__isfont
bool stbtt__isfont(const(ubyte)* font)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__rasterize
void stbtt__rasterize(stbtt__bitmap* result, stbtt__point* pts, int* wcount, int windings, float scale_x, float scale_y, float shift_x, float shift_y, int off_x, int off_y, int invert)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__rasterize_sorted_edges
void stbtt__rasterize_sorted_edges(stbtt__bitmap* result, stbtt__edge* e, int n, int vsubsample, int off_x, int off_y)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt__tesselate_curve
int stbtt__tesselate_curve(stbtt__point* points, int* num_points, double x0, double y0, double x1, double y1, double x2, double y2, double objspace_flatness_squared, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_setvertex
void stbtt_setvertex(stbtt_vertex* v, ubyte type, int x, int y, int cx, int cy)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_tag
bool stbtt_tag(const(ubyte)* p, string s)
Undocumented in source. Be warned that the author may not have intended to support it.
- stbtt_tag4
bool stbtt_tag4(const(ubyte)* p, ubyte c0, ubyte c1, ubyte c2, ubyte c3)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttBYTE
ubyte ttBYTE(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttCHAR
byte ttCHAR(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttFixed
int ttFixed(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttLONG
int ttLONG(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttSHORT
short ttSHORT(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttULONG
uint ttULONG(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
- ttUSHORT
ushort ttUSHORT(const(ubyte)* p)
Undocumented in source. Be warned that the author may not have intended to support it.
D translation of stb_truetype v0.7 by Sean Barrett More information on http://nothings.org/stb/stb_truetype.h Removed: - texture baking API - font finding in the TTF itself. Make sure there is only one font in the TTF.