public class STBTruetype
extends java.lang.Object
This library processes TrueType files:
Some important concepts to understand to use this library:
Characters are defined by unicode codepoints, e.g. 65 is uppercase A, 231 is lowercase c with a cedilla, 0x7e30 is the hiragana for "ma".
A visual character shape (every codepoint is rendered as some glyph)
A font-specific integer ID representing a glyph
Glyph shapes are defined relative to a baseline, which is the bottom of uppercase characters. Characters extend both above and below the baseline.
As you draw text to the screen, you keep track of a "current point" which is the origin of each character. The current point's vertical position is the baseline. Even "baked fonts" use this model.
The vertical qualities of the font, used to vertically position and space the characters. See docs for GetFontVMetrics.
The preferred interface for specifying font sizes in stb_truetype is to specify how tall the font's vertical extent should be in pixels. If that sounds good enough, skip the next paragraph.
Most font APIs instead use "points", which are a common typographic measurement for describing font size, defined as 72 points per inch. stb_truetype provides a point API for compatibility. However, true "per inch" conventions don't make much sense on computer displays since different monitors have different number of pixels per inch. For example, Windows traditionally uses a convention that there are 96 pixels per inch, thus making 'inch' measurements have nothing to do with inches, and thus effectively defining a point to be 1.333 pixels. Additionally, the TrueType font data provides an explicit scale factor to scale a given font's glyphs to points, but the author has observed that this scale factor is often wrong for non-commercial fonts, thus making fonts scaled in points according to the TrueType spec incoherently sized in practice.
Select how high you want the font to be, in points or pixels. Call #()ScaleForPixelHeight or ScaleForMappingEmToPixels to compute a scale factor
SF that will be used by all other functions.
You need to select a y-coordinate that is the baseline of where your text will appear. Call GetFontBoundingBox to get the baseline-relative bounding
box for all characters. SF*-y0 will be the distance in pixels that the worst-case character could extend above the baseline, so if you want the
top edge of characters to appear at the top of the screen where y=0, then you would set the baseline to SF*-y0.
Set the current point where the first character will appear. The first character could extend left of the current point; this is font dependent. You can either choose a current point that is the leftmost point and hope, or add some padding, or check the bounding box or left-side-bearing of the first character to be displayed and set the current point based on that.
Compute the bounding box of the character. It will contain signed values relative to <current_point, baseline>. I.e. if it returns
x0,y0,x1,y1, then the character should be displayed in the rectangle from <current_point+SF*x0, baseline+SF*y0> to
<current_point+SF*x1,baseline+SF*y1).
Call GetGlyphHMetrics, and compute current_point += SF * advance.
Quality:
Performance:
The system uses the raw data found in the .ttf file without changing it and without building auxiliary data structures. This is a bit inefficient on little-endian systems (the data is big-endian), but assuming you're caching the bitmaps or glyph shapes this shouldn't be a big deal.
It appears to be very hard to programmatically determine what font a given file is in a general way. I provide an API for this, but I don't recommend it.
Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless:
unsigned char ttf_buffer[1<<20];
unsigned char temp_bitmap[512*512];
stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs
GLuint ftex;
void my_stbtt_initfont(void)
{
fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
stbtt_BakeFontBitmap(ttf_buffer,0, 32.0, temp_bitmap,512,512, 32,96, cdata); // no guarantee this fits!
// can free ttf_buffer at this point
glGenTextures(1, &ftex);
glBindTexture(GL_TEXTURE_2D, ftex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 512,512, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_bitmap);
// can free temp_bitmap at this point
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
void my_stbtt_print(float x, float y, char *text)
{
// assume orthographic projection with units = screen pixels, origin at top left
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ftex);
glBegin(GL_QUADS);
while (*text) {
if (*text >= 32 && *text < 128) {
stbtt_aligned_quad q;
stbtt_GetBakedQuad(cdata, 512,512, *text-32, &x,&y,&q,1);//1=opengl & d3d10+,0=d3d9
glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y0);
glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y0);
glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y1);
glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y1);
}
++text;
}
glEnd();
}
Complete program (this compiles): get a single bitmap, print as ASCII art:
char ttf_buffer[1<<25];
int main(int argc, char **argv)
{
stbtt_fontinfo font;
unsigned char *bitmap;
int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20);
fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/arialbd.ttf", "rb"));
stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));
bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0,0);
for (j=0; j < h; ++j) {
for (i=0; i < w; ++i)
putchar(" .:ioVM@"[bitmap[j*w+i]>>5]);
putchar('\n');
}
return 0;
}
Complete program: print "Hello World!" banner, with bugs:
char buffer[24<<20];
unsigned char screen[20][79];
int main(int arg, char **argv)
{
stbtt_fontinfo font;
int i,j,ascent,baseline,ch=0;
float scale, xpos=2; // leave a little padding in case the character extends left
char *text = "Heljo World!";
fread(buffer, 1, 1000000, fopen("c:/windows/fonts/arialbd.ttf", "rb"));
stbtt_InitFont(&font, buffer, 0);
scale = stbtt_ScaleForPixelHeight(&font, 15);
stbtt_GetFontVMetrics(&font, &ascent,0,0);
baseline = (int) (ascent*scale);
while (text[ch]) {
int advance,lsb,x0,y0,x1,y1;
float x_shift = xpos - (float) floor(xpos);
stbtt_GetCodepointHMetrics(&font, text[ch], &advance, &lsb);
stbtt_GetCodepointBitmapBoxSubpixel(&font, text[ch], scale,scale,x_shift,0, &x0,&y0,&x1,&y1);
stbtt_MakeCodepointBitmapSubpixel(&font, &screen[baseline + y0][(int) xpos + x0], x1-x0,y1-y0, 79, scale,scale,x_shift,0, text[ch]);
// note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong
// because this API is really for baking character bitmaps into textures. if you want to render
// a sequence of characters, you really need to render each bitmap to a temp buffer, then
// "alpha blend" that into the working buffer
xpos += (advance * scale);
if (text[ch+1])
xpos += scale*stbtt_GetCodepointKernAdvance(&font, text[ch],text[ch+1]);
++ch;
}
for (j=0; j < 20; ++j) {
for (i=0; i < 78; ++i)
putchar(" .:ioVM@"[screen[j][i]>>5]);
putchar('\n');
}
return 0;
}
You should really just solve this offline, keep your own tables of what font is what, and don't try to get it out of the .ttf file. That's because getting it out of the .ttf file is really hard, because the names in the file can appear in many possible encodings, in many possible languages, and e.g. if you need a case-insensitive comparison, the details of that depend on the encoding & language in a complex way (actually underspecified in truetype, but also gigantic).
But you can use the provided functions in two possible ways:
FindMatchingFont will use *case-sensitive* comparisons on unicode-encoded names to try to find the font you want; you can run this before
calling InitFontGetFontNameString lets you get any of the various strings from the file yourself and do your own comparisons on them. You have to have called
InitFont first.| Modifier and Type | Method and Description |
|---|---|
static int |
nstbtt_BakeFontBitmap(long data,
int offset,
float pixel_height,
long pixels,
int pw,
int ph,
int first_char,
int num_chars,
long chardata)
Unsafe version of:
BakeFontBitmap |
static int |
nstbtt_CompareUTF8toUTF16_bigendian(long s1,
int len1,
long s2,
int len2)
Unsafe version of:
CompareUTF8toUTF16_bigendian |
static int |
nstbtt_FindGlyphIndex(long info,
int unicode_codepoint)
Unsafe version of:
FindGlyphIndex |
static int |
nstbtt_FindMatchingFont(long fontdata,
long name,
int flags)
Unsafe version of:
FindMatchingFont |
static void |
nstbtt_FreeBitmap(long bitmap,
long userdata)
Unsafe version of:
FreeBitmap |
static void |
nstbtt_FreeSDF(long bitmap,
long userdata)
Unsafe version of:
FreeSDF |
static void |
nstbtt_FreeShape(long info,
long vertices)
Unsafe version of:
FreeShape |
static void |
nstbtt_GetBakedQuad(long chardata,
int pw,
int ph,
int char_index,
float[] xpos,
float[] ypos,
long q,
int opengl_fillrule)
Array version of:
nstbtt_GetBakedQuad(long, int, int, int, long, long, long, int) |
static void |
nstbtt_GetBakedQuad(long chardata,
int pw,
int ph,
int char_index,
long xpos,
long ypos,
long q,
int opengl_fillrule)
Unsafe version of:
GetBakedQuad |
static long |
nstbtt_GetCodepointBitmap(long info,
float scale_x,
float scale_y,
int codepoint,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
|
static long |
nstbtt_GetCodepointBitmap(long info,
float scale_x,
float scale_y,
int codepoint,
long width,
long height,
long xoff,
long yoff)
Unsafe version of:
GetCodepointBitmap |
static void |
nstbtt_GetCodepointBitmapBox(long font,
int codepoint,
float scale_x,
float scale_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
|
static void |
nstbtt_GetCodepointBitmapBox(long font,
int codepoint,
float scale_x,
float scale_y,
long ix0,
long iy0,
long ix1,
long iy1)
Unsafe version of:
GetCodepointBitmapBox |
static void |
nstbtt_GetCodepointBitmapBoxSubpixel(long font,
int codepoint,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
|
static void |
nstbtt_GetCodepointBitmapBoxSubpixel(long font,
int codepoint,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
long ix0,
long iy0,
long ix1,
long iy1)
Unsafe version of:
GetCodepointBitmapBoxSubpixel |
static long |
nstbtt_GetCodepointBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
|
static long |
nstbtt_GetCodepointBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint,
long width,
long height,
long xoff,
long yoff)
Unsafe version of:
GetCodepointBitmapSubpixel |
static int |
nstbtt_GetCodepointBox(long info,
int codepoint,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
Array version of:
nstbtt_GetCodepointBox(long, int, long, long, long, long) |
static int |
nstbtt_GetCodepointBox(long info,
int codepoint,
long x0,
long y0,
long x1,
long y1)
Unsafe version of:
GetCodepointBox |
static void |
nstbtt_GetCodepointHMetrics(long info,
int codepoint,
int[] advanceWidth,
int[] leftSideBearing)
Array version of:
nstbtt_GetCodepointHMetrics(long, int, long, long) |
static void |
nstbtt_GetCodepointHMetrics(long info,
int codepoint,
long advanceWidth,
long leftSideBearing)
Unsafe version of:
GetCodepointHMetrics |
static int |
nstbtt_GetCodepointKernAdvance(long info,
int ch1,
int ch2)
Unsafe version of:
GetCodepointKernAdvance |
static long |
nstbtt_GetCodepointSDF(long font,
float scale,
int codepoint,
int padding,
byte onedge_value,
float pixel_dist_scale,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
|
static long |
nstbtt_GetCodepointSDF(long font,
float scale,
int codepoint,
int padding,
byte onedge_value,
float pixel_dist_scale,
long width,
long height,
long xoff,
long yoff)
Unsafe version of:
GetCodepointSDF |
static int |
nstbtt_GetCodepointShape(long info,
int unicode_codepoint,
long vertices)
Unsafe version of:
GetCodepointShape |
static void |
nstbtt_GetFontBoundingBox(long info,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
Array version of:
nstbtt_GetFontBoundingBox(long, long, long, long, long) |
static void |
nstbtt_GetFontBoundingBox(long info,
long x0,
long y0,
long x1,
long y1)
Unsafe version of:
GetFontBoundingBox |
static long |
nstbtt_GetFontNameString(long font,
long length,
int platformID,
int encodingID,
int languageID,
int nameID)
Unsafe version of:
GetFontNameString |
static int |
nstbtt_GetFontOffsetForIndex(long data,
int index)
Unsafe version of:
GetFontOffsetForIndex |
static void |
nstbtt_GetFontVMetrics(long info,
int[] ascent,
int[] descent,
int[] lineGap)
Array version of:
nstbtt_GetFontVMetrics(long, long, long, long) |
static void |
nstbtt_GetFontVMetrics(long info,
long ascent,
long descent,
long lineGap)
Unsafe version of:
GetFontVMetrics |
static int |
nstbtt_GetFontVMetricsOS2(long info,
int[] typoAscent,
int[] typoDescent,
int[] typoLineGap)
Array version of:
nstbtt_GetFontVMetricsOS2(long, long, long, long) |
static int |
nstbtt_GetFontVMetricsOS2(long info,
long typoAscent,
long typoDescent,
long typoLineGap)
Unsafe version of:
GetFontVMetricsOS2 |
static long |
nstbtt_GetGlyphBitmap(long info,
float scale_x,
float scale_y,
int glyph,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
nstbtt_GetGlyphBitmap(long, float, float, int, long, long, long, long) |
static long |
nstbtt_GetGlyphBitmap(long info,
float scale_x,
float scale_y,
int glyph,
long width,
long height,
long xoff,
long yoff)
Unsafe version of:
GetGlyphBitmap |
static void |
nstbtt_GetGlyphBitmapBox(long font,
int glyph,
float scale_x,
float scale_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
|
static void |
nstbtt_GetGlyphBitmapBox(long font,
int glyph,
float scale_x,
float scale_y,
long ix0,
long iy0,
long ix1,
long iy1)
Unsafe version of:
GetGlyphBitmapBox |
static void |
nstbtt_GetGlyphBitmapBoxSubpixel(long font,
int glyph,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
|
static void |
nstbtt_GetGlyphBitmapBoxSubpixel(long font,
int glyph,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
long ix0,
long iy0,
long ix1,
long iy1)
Unsafe version of:
GetGlyphBitmapBoxSubpixel |
static long |
nstbtt_GetGlyphBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
|
static long |
nstbtt_GetGlyphBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph,
long width,
long height,
long xoff,
long yoff)
Unsafe version of:
GetGlyphBitmapSubpixel |
static int |
nstbtt_GetGlyphBox(long info,
int glyph_index,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
Array version of:
nstbtt_GetGlyphBox(long, int, long, long, long, long) |
static int |
nstbtt_GetGlyphBox(long info,
int glyph_index,
long x0,
long y0,
long x1,
long y1)
Unsafe version of:
GetGlyphBox |
static void |
nstbtt_GetGlyphHMetrics(long info,
int glyph_index,
int[] advanceWidth,
int[] leftSideBearing)
Array version of:
nstbtt_GetGlyphHMetrics(long, int, long, long) |
static void |
nstbtt_GetGlyphHMetrics(long info,
int glyph_index,
long advanceWidth,
long leftSideBearing)
Unsafe version of:
GetGlyphHMetrics |
static int |
nstbtt_GetGlyphKernAdvance(long info,
int glyph1,
int glyph2)
Unsafe version of:
GetGlyphKernAdvance |
static long |
nstbtt_GetGlyphSDF(long font,
float scale,
int glyph,
int padding,
byte onedge_value,
float pixel_dist_scale,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
|
static long |
nstbtt_GetGlyphSDF(long font,
float scale,
int glyph,
int padding,
byte onedge_value,
float pixel_dist_scale,
long width,
long height,
long xoff,
long yoff)
Unsafe version of:
GetGlyphSDF |
static int |
nstbtt_GetGlyphShape(long info,
int glyph_index,
long vertices)
Unsafe version of:
GetGlyphShape |
static int |
nstbtt_GetNumberOfFonts(long data)
Unsafe version of:
GetNumberOfFonts |
static void |
nstbtt_GetPackedQuad(long chardata,
int pw,
int ph,
int char_index,
float[] xpos,
float[] ypos,
long q,
int align_to_integer)
Array version of:
nstbtt_GetPackedQuad(long, int, int, int, long, long, long, int) |
static void |
nstbtt_GetPackedQuad(long chardata,
int pw,
int ph,
int char_index,
long xpos,
long ypos,
long q,
int align_to_integer)
Unsafe version of:
GetPackedQuad |
static void |
nstbtt_GetScaledFontVMetrics(long fontdata,
int index,
float size,
float[] ascent,
float[] descent,
float[] lineGap)
Array version of:
nstbtt_GetScaledFontVMetrics(long, int, float, long, long, long) |
static void |
nstbtt_GetScaledFontVMetrics(long fontdata,
int index,
float size,
long ascent,
long descent,
long lineGap)
Unsafe version of:
GetScaledFontVMetrics |
static int |
nstbtt_InitFont(long info,
long data,
int offset)
Unsafe version of:
InitFont |
static int |
nstbtt_IsGlyphEmpty(long info,
int glyph_index)
Unsafe version of:
IsGlyphEmpty |
static void |
nstbtt_MakeCodepointBitmap(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
int codepoint)
Unsafe version of:
MakeCodepointBitmap |
static void |
nstbtt_MakeCodepointBitmapSubpixel(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint)
Unsafe version of:
MakeCodepointBitmapSubpixel |
static void |
nstbtt_MakeCodepointBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
float[] sub_x,
float[] sub_y,
int codepoint)
|
static void |
nstbtt_MakeCodepointBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
long sub_x,
long sub_y,
int codepoint)
Unsafe version of:
MakeCodepointBitmapSubpixelPrefilter |
static void |
nstbtt_MakeGlyphBitmap(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
int glyph)
Unsafe version of:
MakeGlyphBitmap |
static void |
nstbtt_MakeGlyphBitmapSubpixel(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph)
Unsafe version of:
MakeGlyphBitmapSubpixel |
static void |
nstbtt_MakeGlyphBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
float[] sub_x,
float[] sub_y,
int glyph)
|
static void |
nstbtt_MakeGlyphBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
long sub_x,
long sub_y,
int glyph)
Unsafe version of:
MakeGlyphBitmapSubpixelPrefilter |
static int |
nstbtt_PackBegin(long spc,
long pixels,
int width,
int height,
int stride_in_bytes,
int padding,
long alloc_context)
Unsafe version of:
PackBegin |
static void |
nstbtt_PackEnd(long spc)
Unsafe version of:
PackEnd |
static int |
nstbtt_PackFontRange(long spc,
long fontdata,
int font_index,
float font_size,
int first_unicode_char_in_range,
int num_chars_in_range,
long chardata_for_range)
Unsafe version of:
PackFontRange |
static int |
nstbtt_PackFontRanges(long spc,
long fontdata,
int font_index,
long ranges,
int num_ranges)
Unsafe version of:
PackFontRanges |
static int |
nstbtt_PackFontRangesGatherRects(long spc,
long info,
long ranges,
int num_ranges,
long rects)
Unsafe version of:
PackFontRangesGatherRects |
static void |
nstbtt_PackFontRangesPackRects(long spc,
long rects,
int num_rects)
Unsafe version of:
PackFontRangesPackRects |
static int |
nstbtt_PackFontRangesRenderIntoRects(long spc,
long info,
long ranges,
int num_ranges,
long rects)
Unsafe version of:
PackFontRangesRenderIntoRects |
static void |
nstbtt_PackSetOversampling(long spc,
int h_oversample,
int v_oversample)
Unsafe version of:
PackSetOversampling |
static void |
nstbtt_PackSetSkipMissingCodepoints(long spc,
int skip)
Unsafe version of:
PackSetSkipMissingCodepoints |
static void |
nstbtt_Rasterize(long result,
float flatness_in_pixels,
long vertices,
int num_verts,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int x_off,
int y_off,
int invert,
long alloc_context)
Unsafe version of:
Rasterize |
static float |
nstbtt_ScaleForMappingEmToPixels(long info,
float pixels)
Unsafe version of:
ScaleForMappingEmToPixels |
static float |
nstbtt_ScaleForPixelHeight(long info,
float pixels)
Unsafe version of:
ScaleForPixelHeight |
static int |
stbtt_BakeFontBitmap(java.nio.ByteBuffer data,
float pixel_height,
java.nio.ByteBuffer pixels,
int pw,
int ph,
int first_char,
STBTTBakedChar.Buffer chardata)
Bakes a font to a bitmap for use as texture.
|
static boolean |
stbtt_CompareUTF8toUTF16_bigendian(java.nio.ByteBuffer s1,
java.nio.ByteBuffer s2)
Returns 1/0 whether the first string interpreted as utf8 is identical to the second string interpreted as big-endian utf16...
|
static int |
stbtt_FindGlyphIndex(STBTTFontinfo 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.
|
static int |
stbtt_FindMatchingFont(java.nio.ByteBuffer fontdata,
java.nio.ByteBuffer name,
int flags)
Returns the offset (not index) of the font that matches, or -1 if none.
|
static int |
stbtt_FindMatchingFont(java.nio.ByteBuffer fontdata,
java.lang.CharSequence name,
int flags)
Returns the offset (not index) of the font that matches, or -1 if none.
|
static void |
stbtt_FreeBitmap(java.nio.ByteBuffer bitmap)
Frees a bitmap allocated by
GetCodepointBitmap, GetCodepointBitmapSubpixel, GetGlyphBitmap or GetGlyphBitmapSubpixel. |
static void |
stbtt_FreeBitmap(java.nio.ByteBuffer bitmap,
long userdata)
Frees a bitmap allocated by
GetCodepointBitmap, GetCodepointBitmapSubpixel, GetGlyphBitmap or GetGlyphBitmapSubpixel. |
static void |
stbtt_FreeSDF(java.nio.ByteBuffer bitmap)
Frees an SDF bitmap.
|
static void |
stbtt_FreeSDF(java.nio.ByteBuffer bitmap,
long userdata)
Frees an SDF bitmap.
|
static void |
stbtt_FreeShape(STBTTFontinfo info,
STBTTVertex.Buffer vertices)
Frees the data allocated by
GetCodepointShape and GetGlyphShape. |
static void |
stbtt_GetBakedQuad(STBTTBakedChar.Buffer chardata,
int pw,
int ph,
int char_index,
float[] xpos,
float[] ypos,
STBTTAlignedQuad q,
boolean opengl_fillrule)
Array version of:
GetBakedQuad |
static void |
stbtt_GetBakedQuad(STBTTBakedChar.Buffer chardata,
int pw,
int ph,
int char_index,
java.nio.FloatBuffer xpos,
java.nio.FloatBuffer ypos,
STBTTAlignedQuad q,
boolean opengl_fillrule)
Computes quad to draw for a given char and advances the current position.
|
static java.nio.ByteBuffer |
stbtt_GetCodepointBitmap(STBTTFontinfo info,
float scale_x,
float scale_y,
int codepoint,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
GetCodepointBitmap |
static java.nio.ByteBuffer |
stbtt_GetCodepointBitmap(STBTTFontinfo info,
float scale_x,
float scale_y,
int codepoint,
java.nio.IntBuffer width,
java.nio.IntBuffer height,
java.nio.IntBuffer xoff,
java.nio.IntBuffer yoff)
Allocates a large-enough single-channel 8bpp bitmap and renders the specified character/glyph at the specified scale into it, with antialiasing.
|
static void |
stbtt_GetCodepointBitmapBox(STBTTFontinfo font,
int codepoint,
float scale_x,
float scale_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
Array version of:
GetCodepointBitmapBox |
static void |
stbtt_GetCodepointBitmapBox(STBTTFontinfo font,
int codepoint,
float scale_x,
float scale_y,
java.nio.IntBuffer ix0,
java.nio.IntBuffer iy0,
java.nio.IntBuffer ix1,
java.nio.IntBuffer iy1)
Get 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). |
static void |
stbtt_GetCodepointBitmapBoxSubpixel(STBTTFontinfo font,
int codepoint,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
Array version of:
GetCodepointBitmapBoxSubpixel |
static void |
stbtt_GetCodepointBitmapBoxSubpixel(STBTTFontinfo font,
int codepoint,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
java.nio.IntBuffer ix0,
java.nio.IntBuffer iy0,
java.nio.IntBuffer ix1,
java.nio.IntBuffer iy1)
Same as
GetCodepointBitmapBox, but you can specify a subpixel shift for the character. |
static java.nio.ByteBuffer |
stbtt_GetCodepointBitmapSubpixel(STBTTFontinfo info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
GetCodepointBitmapSubpixel |
static java.nio.ByteBuffer |
stbtt_GetCodepointBitmapSubpixel(STBTTFontinfo info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint,
java.nio.IntBuffer width,
java.nio.IntBuffer height,
java.nio.IntBuffer xoff,
java.nio.IntBuffer yoff)
Same as
GetCodepointBitmap, but you can specify a subpixel shift for the character. |
static boolean |
stbtt_GetCodepointBox(STBTTFontinfo info,
int codepoint,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
Array version of:
GetCodepointBox |
static boolean |
stbtt_GetCodepointBox(STBTTFontinfo info,
int codepoint,
java.nio.IntBuffer x0,
java.nio.IntBuffer y0,
java.nio.IntBuffer x1,
java.nio.IntBuffer y1)
Gets the bounding box of the visible part of the glyph, in unscaled coordinates.
|
static void |
stbtt_GetCodepointHMetrics(STBTTFontinfo info,
int codepoint,
int[] advanceWidth,
int[] leftSideBearing)
Array version of:
GetCodepointHMetrics |
static void |
stbtt_GetCodepointHMetrics(STBTTFontinfo info,
int codepoint,
java.nio.IntBuffer advanceWidth,
java.nio.IntBuffer leftSideBearing)
Returns horizontal metrics for the specified codepoint.
|
static int |
stbtt_GetCodepointKernAdvance(STBTTFontinfo info,
int ch1,
int ch2)
Returns the additional amount to add to the
advance value between ch1 and ch2. |
static java.nio.ByteBuffer |
stbtt_GetCodepointSDF(STBTTFontinfo font,
float scale,
int codepoint,
int padding,
byte onedge_value,
float pixel_dist_scale,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
GetCodepointSDF |
static java.nio.ByteBuffer |
stbtt_GetCodepointSDF(STBTTFontinfo font,
float scale,
int codepoint,
int padding,
byte onedge_value,
float pixel_dist_scale,
java.nio.IntBuffer width,
java.nio.IntBuffer height,
java.nio.IntBuffer xoff,
java.nio.IntBuffer yoff)
Codepoint version of
GetGlyphSDF. |
static STBTTVertex.Buffer |
stbtt_GetCodepointShape(STBTTFontinfo info,
int unicode_codepoint)
Returns number of vertices and fills
*vertices with the pointer to them |
static int |
stbtt_GetCodepointShape(STBTTFontinfo info,
int unicode_codepoint,
org.lwjgl.PointerBuffer vertices)
Returns number of vertices and fills
*vertices with the pointer to them |
static void |
stbtt_GetFontBoundingBox(STBTTFontinfo info,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
Array version of:
GetFontBoundingBox |
static void |
stbtt_GetFontBoundingBox(STBTTFontinfo info,
java.nio.IntBuffer x0,
java.nio.IntBuffer y0,
java.nio.IntBuffer x1,
java.nio.IntBuffer y1)
Returns the bounding box around all possible characters.
|
static java.nio.ByteBuffer |
stbtt_GetFontNameString(STBTTFontinfo font,
int platformID,
int encodingID,
int languageID,
int nameID)
Returns the string (which may be big-endian double byte, e.g.
|
static int |
stbtt_GetFontOffsetForIndex(java.nio.ByteBuffer data,
int index)
Each .ttf/.ttc file may have more than one font.
|
static void |
stbtt_GetFontVMetrics(STBTTFontinfo info,
int[] ascent,
int[] descent,
int[] lineGap)
Array version of:
GetFontVMetrics |
static void |
stbtt_GetFontVMetrics(STBTTFontinfo info,
java.nio.IntBuffer ascent,
java.nio.IntBuffer descent,
java.nio.IntBuffer lineGap)
Returns vertical metrics for the specified font.
|
static boolean |
stbtt_GetFontVMetricsOS2(STBTTFontinfo info,
int[] typoAscent,
int[] typoDescent,
int[] typoLineGap)
Array version of:
GetFontVMetricsOS2 |
static boolean |
stbtt_GetFontVMetricsOS2(STBTTFontinfo info,
java.nio.IntBuffer typoAscent,
java.nio.IntBuffer typoDescent,
java.nio.IntBuffer typoLineGap)
Analogous to
GetFontVMetrics, but returns the "typographic" values from the OS/2 table (specific to MS/Windows TTF files). |
static java.nio.ByteBuffer |
stbtt_GetGlyphBitmap(STBTTFontinfo info,
float scale_x,
float scale_y,
int glyph,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
GetGlyphBitmap |
static java.nio.ByteBuffer |
stbtt_GetGlyphBitmap(STBTTFontinfo info,
float scale_x,
float scale_y,
int glyph,
java.nio.IntBuffer width,
java.nio.IntBuffer height,
java.nio.IntBuffer xoff,
java.nio.IntBuffer yoff)
Allocates a large-enough single-channel 8bpp bitmap and renders the specified character/glyph at the specified scale into it, with antialiasing.
|
static void |
stbtt_GetGlyphBitmapBox(STBTTFontinfo font,
int glyph,
float scale_x,
float scale_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
Array version of:
GetGlyphBitmapBox |
static void |
stbtt_GetGlyphBitmapBox(STBTTFontinfo font,
int glyph,
float scale_x,
float scale_y,
java.nio.IntBuffer ix0,
java.nio.IntBuffer iy0,
java.nio.IntBuffer ix1,
java.nio.IntBuffer iy1)
Get 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). |
static void |
stbtt_GetGlyphBitmapBoxSubpixel(STBTTFontinfo font,
int glyph,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
Array version of:
GetGlyphBitmapBoxSubpixel |
static void |
stbtt_GetGlyphBitmapBoxSubpixel(STBTTFontinfo font,
int glyph,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
java.nio.IntBuffer ix0,
java.nio.IntBuffer iy0,
java.nio.IntBuffer ix1,
java.nio.IntBuffer iy1)
Same as
GetGlyphBitmapBox, but you can specify a subpixel shift for the character. |
static java.nio.ByteBuffer |
stbtt_GetGlyphBitmapSubpixel(STBTTFontinfo info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
GetGlyphBitmapSubpixel |
static java.nio.ByteBuffer |
stbtt_GetGlyphBitmapSubpixel(STBTTFontinfo info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph,
java.nio.IntBuffer width,
java.nio.IntBuffer height,
java.nio.IntBuffer xoff,
java.nio.IntBuffer yoff)
Same as
GetGlyphBitmap, but you can specify a subpixel shift for the character. |
static boolean |
stbtt_GetGlyphBox(STBTTFontinfo info,
int glyph_index,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
Array version of:
GetGlyphBox |
static boolean |
stbtt_GetGlyphBox(STBTTFontinfo info,
int glyph_index,
java.nio.IntBuffer x0,
java.nio.IntBuffer y0,
java.nio.IntBuffer x1,
java.nio.IntBuffer y1)
Glyph version of
GetCodepointBox, for greater efficiency. |
static void |
stbtt_GetGlyphHMetrics(STBTTFontinfo info,
int glyph_index,
int[] advanceWidth,
int[] leftSideBearing)
Array version of:
GetGlyphHMetrics |
static void |
stbtt_GetGlyphHMetrics(STBTTFontinfo info,
int glyph_index,
java.nio.IntBuffer advanceWidth,
java.nio.IntBuffer leftSideBearing)
Glyph version of
GetCodepointHMetrics, for greater efficiency. |
static int |
stbtt_GetGlyphKernAdvance(STBTTFontinfo info,
int glyph1,
int glyph2)
Glyph version of
GetCodepointKernAdvance, for greater efficiency. |
static java.nio.ByteBuffer |
stbtt_GetGlyphSDF(STBTTFontinfo font,
float scale,
int glyph,
int padding,
byte onedge_value,
float pixel_dist_scale,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
Array version of:
GetGlyphSDF |
static java.nio.ByteBuffer |
stbtt_GetGlyphSDF(STBTTFontinfo font,
float scale,
int glyph,
int padding,
byte onedge_value,
float pixel_dist_scale,
java.nio.IntBuffer width,
java.nio.IntBuffer height,
java.nio.IntBuffer xoff,
java.nio.IntBuffer yoff)
Computes a discretized SDF field for a single character, suitable for storing in a single-channel texture, sampling with bilinear filtering, and
testing against larger than some threshold to produce scalable fonts.
|
static STBTTVertex.Buffer |
stbtt_GetGlyphShape(STBTTFontinfo info,
int glyph_index)
Glyph version of
GetCodepointShape, for greater efficiency. |
static int |
stbtt_GetGlyphShape(STBTTFontinfo info,
int glyph_index,
org.lwjgl.PointerBuffer vertices)
Glyph version of
GetCodepointShape, for greater efficiency. |
static int |
stbtt_GetNumberOfFonts(java.nio.ByteBuffer data)
Determines the number of fonts in a font file.
|
static void |
stbtt_GetPackedQuad(STBTTPackedchar.Buffer chardata,
int pw,
int ph,
int char_index,
float[] xpos,
float[] ypos,
STBTTAlignedQuad q,
boolean align_to_integer)
Array version of:
GetPackedQuad |
static void |
stbtt_GetPackedQuad(STBTTPackedchar.Buffer chardata,
int pw,
int ph,
int char_index,
java.nio.FloatBuffer xpos,
java.nio.FloatBuffer ypos,
STBTTAlignedQuad q,
boolean align_to_integer)
Computes quad to draw for a given char and advances the current position.
|
static void |
stbtt_GetScaledFontVMetrics(java.nio.ByteBuffer fontdata,
int index,
float size,
float[] ascent,
float[] descent,
float[] lineGap)
Array version of:
GetScaledFontVMetrics |
static void |
stbtt_GetScaledFontVMetrics(java.nio.ByteBuffer fontdata,
int index,
float size,
java.nio.FloatBuffer ascent,
java.nio.FloatBuffer descent,
java.nio.FloatBuffer lineGap)
Query the font vertical metrics without having to create a font first.
|
static boolean |
stbtt_InitFont(STBTTFontinfo info,
java.nio.ByteBuffer data)
Given an offset into the file that defines a font, this function builds the necessary cached info for the rest of the system.
|
static boolean |
stbtt_InitFont(STBTTFontinfo info,
java.nio.ByteBuffer data,
int offset)
Given an offset into the file that defines a font, this function builds the necessary cached info for the rest of the system.
|
static boolean |
stbtt_IsGlyphEmpty(STBTTFontinfo info,
int glyph_index)
Returns non-zero if nothing is drawn for this glyph.
|
static void |
stbtt_MakeCodepointBitmap(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
int codepoint)
Same as
GetCodepointBitmap, but you pass in storage for the bitmap in the form of output, with row spacing of out_stride bytes. |
static void |
stbtt_MakeCodepointBitmapSubpixel(STBTTFontinfo info,
java.nio.ByteBuffer 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
MakeCodepointBitmap, but you can specify a subpixel shift for the character. |
static void |
stbtt_MakeCodepointBitmapSubpixelPrefilter(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
float[] sub_x,
float[] sub_y,
int codepoint)
Array version of:
MakeCodepointBitmapSubpixelPrefilter |
static void |
stbtt_MakeCodepointBitmapSubpixelPrefilter(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
java.nio.FloatBuffer sub_x,
java.nio.FloatBuffer sub_y,
int codepoint)
Same as
MakeCodepointBitmapSubpixel, but prefiltering is performed (see PackSetOversampling). |
static void |
stbtt_MakeGlyphBitmap(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
int glyph)
Same as
GetGlyphBitmap, but you pass in storage for the bitmap in the form of output, with row spacing of out_stride bytes. |
static void |
stbtt_MakeGlyphBitmapSubpixel(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph)
Same as
MakeGlyphBitmap, but you can specify a subpixel shift for the character. |
static void |
stbtt_MakeGlyphBitmapSubpixelPrefilter(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
float[] sub_x,
float[] sub_y,
int glyph)
Array version of:
MakeGlyphBitmapSubpixelPrefilter |
static void |
stbtt_MakeGlyphBitmapSubpixelPrefilter(STBTTFontinfo info,
java.nio.ByteBuffer output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
java.nio.FloatBuffer sub_x,
java.nio.FloatBuffer sub_y,
int glyph)
Same as
MakeGlyphBitmapSubpixel, but prefiltering is performed (see PackSetOversampling). |
static boolean |
stbtt_PackBegin(STBTTPackContext spc,
java.nio.ByteBuffer pixels,
int width,
int height,
int stride_in_bytes,
int padding)
Initializes a packing context stored in the passed-in
stbtt_pack_context. |
static boolean |
stbtt_PackBegin(STBTTPackContext spc,
java.nio.ByteBuffer pixels,
int width,
int height,
int stride_in_bytes,
int padding,
long alloc_context)
Initializes a packing context stored in the passed-in
stbtt_pack_context. |
static void |
stbtt_PackEnd(STBTTPackContext spc)
Cleans up the packing context and frees all memory.
|
static boolean |
stbtt_PackFontRange(STBTTPackContext spc,
java.nio.ByteBuffer fontdata,
int font_index,
float font_size,
int first_unicode_char_in_range,
STBTTPackedchar.Buffer chardata_for_range)
Creates character bitmaps from the
font_index'th font found in fontdata (use font_index=0 if you don't know what that is). |
static boolean |
stbtt_PackFontRanges(STBTTPackContext spc,
java.nio.ByteBuffer fontdata,
int font_index,
STBTTPackRange.Buffer ranges)
Creates character bitmaps from multiple ranges of characters stored in ranges.
|
static int |
stbtt_PackFontRangesGatherRects(STBTTPackContext spc,
STBTTFontinfo info,
STBTTPackRange.Buffer ranges,
STBRPRect.Buffer rects)
Calling these functions in sequence is roughly equivalent to calling
PackFontRanges. |
static void |
stbtt_PackFontRangesPackRects(STBTTPackContext spc,
STBRPRect.Buffer rects)
|
static boolean |
stbtt_PackFontRangesRenderIntoRects(STBTTPackContext spc,
STBTTFontinfo info,
STBTTPackRange.Buffer ranges,
STBRPRect.Buffer rects)
|
static void |
stbtt_PackSetOversampling(STBTTPackContext spc,
int h_oversample,
int v_oversample)
Oversampling a font increases the quality by allowing higher-quality subpixel positioning, and is especially valuable at smaller text sizes.
|
static void |
stbtt_PackSetSkipMissingCodepoints(STBTTPackContext spc,
boolean skip)
If
skip != 0, this tells stb_truetype to skip any codepoints for which there is no corresponding glyph. |
static int |
STBTT_POINT_SIZE(int font_size)
Converts the full height of a character from ascender to descender, as computed by
ScaleForPixelHeight, to a point size as computed by
ScaleForMappingEmToPixels. |
static void |
stbtt_Rasterize(STBTTBitmap result,
float flatness_in_pixels,
STBTTVertex.Buffer vertices,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int x_off,
int y_off,
boolean invert)
Rasterize a shape with quadratic beziers into a bitmap.
|
static float |
stbtt_ScaleForMappingEmToPixels(STBTTFontinfo info,
float pixels)
Computes a scale factor to produce a font whose EM size is mapped to
pixels tall. |
static float |
stbtt_ScaleForPixelHeight(STBTTFontinfo info,
float pixels)
Computes a scale factor to produce a font whose "height" is
pixels tall. |
public static final byte STBTT_vmove
public static final byte STBTT_vline
public static final byte STBTT_vcurve
public static final byte STBTT_vcubic
public static final int STBTT_MACSTYLE_DONTCARE
FindMatchingFont.public static final int STBTT_MACSTYLE_BOLD
FindMatchingFont.public static final int STBTT_MACSTYLE_ITALIC
FindMatchingFont.public static final int STBTT_MACSTYLE_UNDERSCORE
FindMatchingFont.public static final int STBTT_MACSTYLE_NONE
FindMatchingFont.public static final int STBTT_PLATFORM_ID_UNICODE
public static final int STBTT_PLATFORM_ID_MAC
public static final int STBTT_PLATFORM_ID_ISO
public static final int STBTT_PLATFORM_ID_MICROSOFT
public static final int STBTT_UNICODE_EID_UNICODE_1_0
PLATFORM_ID_UNICODE.public static final int STBTT_UNICODE_EID_UNICODE_1_1
PLATFORM_ID_UNICODE.public static final int STBTT_UNICODE_EID_ISO_10646
PLATFORM_ID_UNICODE.public static final int STBTT_UNICODE_EID_UNICODE_2_0_BMP
PLATFORM_ID_UNICODE.public static final int STBTT_UNICODE_EID_UNICODE_2_0_FULL
PLATFORM_ID_UNICODE.public static final int STBTT_MS_EID_SYMBOL
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_EID_UNICODE_BMP
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_EID_SHIFTJIS
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_EID_UNICODE_FULL
PLATFORM_ID_MICROSOFT.public static final int STBTT_MAC_EID_ROMAN
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_JAPANESE
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_CHINESE_TRAD
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_KOREAN
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_ARABIC
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_HEBREW
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_GREEK
PLATFORM_ID_MAC.public static final int STBTT_MAC_EID_RUSSIAN
PLATFORM_ID_MAC.public static final int STBTT_MS_LANG_ENGLISH
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_CHINESE
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_DUTCH
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_FRENCH
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_GERMAN
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_HEBREW
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_ITALIAN
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_JAPANESE
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_KOREAN
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_RUSSIAN
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_SPANISH
PLATFORM_ID_MICROSOFT.public static final int STBTT_MS_LANG_SWEDISH
PLATFORM_ID_MICROSOFT.public static final int STBTT_MAC_LANG_ENGLISH
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_ARABIC
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_DUTCH
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_FRENCH
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_GERMAN
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_HEBREW
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_ITALIAN
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_JAPANESE
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_KOREAN
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_RUSSIAN
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_SPANISH
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_SWEDISH
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_CHINESE_SIMPLIFIED
PLATFORM_ID_MAC.public static final int STBTT_MAC_LANG_CHINESE_TRAD
PLATFORM_ID_MAC.public static int nstbtt_BakeFontBitmap(long data,
int offset,
float pixel_height,
long pixels,
int pw,
int ph,
int first_char,
int num_chars,
long chardata)
BakeFontBitmapnum_chars - the number of characters to bake, starting at first_charpublic static int stbtt_BakeFontBitmap(java.nio.ByteBuffer data,
float pixel_height,
java.nio.ByteBuffer pixels,
int pw,
int ph,
int first_char,
STBTTBakedChar.Buffer chardata)
This uses a very simply packing, use with GetBakedQuad.
data - the font datapixel_height - the font height, in pixelspixels - a buffer in which to write the font bitmappw - the bitmap width, in pixelsph - the bitmap height, in pixelsfirst_char - the first character to bakechardata - an array of STBTTBakedChar structs, it's num_chars longpublic static void nstbtt_GetBakedQuad(long chardata,
int pw,
int ph,
int char_index,
long xpos,
long ypos,
long q,
int opengl_fillrule)
GetBakedQuadpublic static void stbtt_GetBakedQuad(STBTTBakedChar.Buffer chardata, int pw, int ph, int char_index, java.nio.FloatBuffer xpos, java.nio.FloatBuffer ypos, STBTTAlignedQuad q, boolean opengl_fillrule)
The coordinate system used assumes y increases downwards. Characters will extend both above and below the current position; see discussion of "BASELINE" above.
chardata - an array of STBTTBakedChar structspw - the bitmap width, in pixelsph - the bitmap height, in pixelschar_index - the character index in the chardata arrayxpos - the current x position, in screen pixel spaceypos - the current y position, in screen pixel spaceq - an STBTTAlignedQuad struct in which to return the quad to drawopengl_fillrule - 1 if opengl fill rule; 0 if DX9 or earlierpublic static void nstbtt_GetScaledFontVMetrics(long fontdata,
int index,
float size,
long ascent,
long descent,
long lineGap)
GetScaledFontVMetricspublic static void stbtt_GetScaledFontVMetrics(java.nio.ByteBuffer fontdata,
int index,
float size,
java.nio.FloatBuffer ascent,
java.nio.FloatBuffer descent,
java.nio.FloatBuffer lineGap)
index - the font index (use 0 if you don't know what that is)size - the font height, in pixelsascent - returns the coordinate above the baseline the font extendsdescent - returns the coordinate below the baseline the font extends (i.e. it is typically negative)lineGap - returns the spacing between one row's descent and the next row's ascentpublic static int nstbtt_PackBegin(long spc,
long pixels,
int width,
int height,
int stride_in_bytes,
int padding,
long alloc_context)
PackBeginpublic static boolean stbtt_PackBegin(STBTTPackContext spc, @Nullable java.nio.ByteBuffer pixels, int width, int height, int stride_in_bytes, int padding, long alloc_context)
stbtt_pack_context. Future calls using this context will pack characters into the bitmap
passed in here: a 1-channel bitmap that is width x height.spc - an STBTTPackContext structpixels - a buffer in which to store the bitmap datawidth - the bitmap width, in pixelsheight - the bitmap height, in pixelsstride_in_bytes - the distance from one row to the next (or 0 to mean they are packed tightly together)padding - the amount of padding to leave between each character (normally you want '1' for bitmaps you'll use as textures with bilinear filtering)alloc_context - a pointer to an allocation contextpublic static boolean stbtt_PackBegin(STBTTPackContext spc, @Nullable java.nio.ByteBuffer pixels, int width, int height, int stride_in_bytes, int padding)
stbtt_pack_context. Future calls using this context will pack characters into the bitmap
passed in here: a 1-channel bitmap that is width x height.spc - an STBTTPackContext structpixels - a buffer in which to store the bitmap datawidth - the bitmap width, in pixelsheight - the bitmap height, in pixelsstride_in_bytes - the distance from one row to the next (or 0 to mean they are packed tightly together)padding - the amount of padding to leave between each character (normally you want '1' for bitmaps you'll use as textures with bilinear filtering)public static void nstbtt_PackEnd(long spc)
PackEndpublic static void stbtt_PackEnd(STBTTPackContext spc)
spc - an STBTTPackContext structpublic static int STBTT_POINT_SIZE(int font_size)
ScaleForPixelHeight, to a point size as computed by
ScaleForMappingEmToPixels.font_size - the full height of a characterpublic static int nstbtt_PackFontRange(long spc,
long fontdata,
int font_index,
float font_size,
int first_unicode_char_in_range,
int num_chars_in_range,
long chardata_for_range)
PackFontRangenum_chars_in_range - the number of unicode code points in the rangepublic static boolean stbtt_PackFontRange(STBTTPackContext spc, java.nio.ByteBuffer fontdata, int font_index, float font_size, int first_unicode_char_in_range, STBTTPackedchar.Buffer chardata_for_range)
font_index'th font found in fontdata (use font_index=0 if you don't know what that is). It creates
num_chars_in_range bitmaps for characters with unicode values starting at first_unicode_char_in_range and increasing. Data for how to
render them is stored in chardata_for_range; pass these to GetPackedQuad to get back renderable quads.spc - an STBTTPackContext structfontdata - the font datafont_index - the font index (use 0 if you don't know what that isfont_size - the full height of the character from ascender to descender, as computed by ScaleForPixelHeight. To use a point size as computed by
ScaleForMappingEmToPixels, wrap the font size in STBTT_POINT_SIZE(int) and pass the result, i.e.:
..., 20 , ... // font max minus min y is 20 pixels tall
..., STBTT_POINT_SIZE(20), ... // 'M' is 20 pixels tallfirst_unicode_char_in_range - the first unicode code point in the rangechardata_for_range - an array of STBTTPackedchar structspublic static int nstbtt_PackFontRanges(long spc,
long fontdata,
int font_index,
long ranges,
int num_ranges)
PackFontRangesnum_ranges - the number of STBTTPackRange structs in rangespublic static boolean stbtt_PackFontRanges(STBTTPackContext spc, java.nio.ByteBuffer fontdata, int font_index, STBTTPackRange.Buffer ranges)
PackFontRange. Note that you can call this multiple times within a single PackBegin/PackEnd.spc - an STBTTPackContext structfontdata - the font datafont_index - the font index (use 0 if you don't know what that is)ranges - an array of STBTTPackRange structspublic static void nstbtt_PackSetOversampling(long spc,
int h_oversample,
int v_oversample)
PackSetOversamplingpublic static void stbtt_PackSetOversampling(STBTTPackContext spc, int h_oversample, int v_oversample)
This function sets the amount of oversampling for all following calls to PackFontRange or PackFontRangesGatherRects for a given pack context. The
default (no oversampling) is achieved by h_oversample=1, v_oversample=1. The total number of pixels required is
h_oversample*v_oversample larger than the default; for example, 2x2 oversampling requires 4x the storage of 1x1. For best results, render
oversampled textures with bilinear filtering. Look at the readme in
stb/tests/oversample for information about oversampled fonts.
To use with PackFontRangesGather etc., you must set it before calls to PackFontRangesGatherRects.
spc - an STBTTPackContext structh_oversample - the horizontal oversampling amountv_oversample - the vertical oversampling amountpublic static void nstbtt_PackSetSkipMissingCodepoints(long spc,
int skip)
PackSetSkipMissingCodepointspublic static void stbtt_PackSetSkipMissingCodepoints(STBTTPackContext spc, boolean skip)
skip != 0, this tells stb_truetype to skip any codepoints for which there is no corresponding glyph. If skip=0, which is the
default, then codepoints without a glyph recived the font's "missing character" glyph, typically an empty box by convention.spc - an STBTTPackContext structskip - the skip flagpublic static void nstbtt_GetPackedQuad(long chardata,
int pw,
int ph,
int char_index,
long xpos,
long ypos,
long q,
int align_to_integer)
GetPackedQuadpublic static void stbtt_GetPackedQuad(STBTTPackedchar.Buffer chardata, int pw, int ph, int char_index, java.nio.FloatBuffer xpos, java.nio.FloatBuffer ypos, STBTTAlignedQuad q, boolean align_to_integer)
The coordinate system used assumes y increases downwards. Characters will extend both above and below the current position; see discussion of "BASELINE" above.
chardata - an array of STBTTPackedchar structspw - the bitmap width, in pixelsph - the bitmap height, in pixelschar_index - the character index in the chardata arrayxpos - the current x position, in screen pixel spaceypos - the current y position, in screen pixel spaceq - an STBTTAlignedQuad struct in which to return the quad to drawalign_to_integer - 1 to align the quad to integer coordinatespublic static int nstbtt_PackFontRangesGatherRects(long spc,
long info,
long ranges,
int num_ranges,
long rects)
PackFontRangesGatherRectsnum_ranges - the number of STBTTPackRange structs in rangespublic static int stbtt_PackFontRangesGatherRects(STBTTPackContext spc, STBTTFontinfo info, STBTTPackRange.Buffer ranges, STBRPRect.Buffer rects)
PackFontRanges. If you want 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 of PackFontRanges and create a custom version using these functions,
e.g. call PackFontRangesGatherRects multiple times, building up a single array of rects, then call PackFontRangesPackRects once, then call
PackFontRangesRenderIntoRects repeatedly. This may result in a better packing than calling PackFontRanges multiple times (or it may not).spc - an STBTTPackContext structinfo - an STBTTFontinfo structranges - an array of STBTTPackRange structsrects - an array of STBRPRect structs. It must be big enough to accommodate all characters in the given ranges.rectspublic static void nstbtt_PackFontRangesPackRects(long spc,
long rects,
int num_rects)
PackFontRangesPackRectsnum_rects - the number of structs in rectspublic static void stbtt_PackFontRangesPackRects(STBTTPackContext spc, STBRPRect.Buffer rects)
spc - an STBTTPackContext structrects - an array of STBRPRect structspublic static int nstbtt_PackFontRangesRenderIntoRects(long spc,
long info,
long ranges,
int num_ranges,
long rects)
PackFontRangesRenderIntoRectsnum_ranges - the number of STBTTPackRange structs in rangespublic static boolean stbtt_PackFontRangesRenderIntoRects(STBTTPackContext spc, STBTTFontinfo info, STBTTPackRange.Buffer ranges, STBRPRect.Buffer rects)
spc - an STBTTPackContext structinfo - an STBTTFontinfo structranges - an array of STBTTPackRange structsrects - an array of STBRPRect structs. It must be big enough to accommodate all characters in the given ranges.public static int nstbtt_GetNumberOfFonts(long data)
GetNumberOfFontspublic static int stbtt_GetNumberOfFonts(java.nio.ByteBuffer data)
TrueType collection (.ttc) files may contain multiple fonts, while TrueType font (.ttf) files only contain one font. The number of fonts can be used
for indexing with GetFontOffsetForIndex where the index is between zero and one less than the total fonts. If an error occurs, -1 is returned.
data - the font datapublic static int nstbtt_GetFontOffsetForIndex(long data,
int index)
GetFontOffsetForIndexpublic static int stbtt_GetFontOffsetForIndex(java.nio.ByteBuffer data,
int index)
data - the font dataindex - the font indexpublic static int nstbtt_InitFont(long info,
long data,
int offset)
InitFontpublic static boolean stbtt_InitFont(STBTTFontinfo info, java.nio.ByteBuffer data, int offset)
STBTTFontinfo 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.info - an STBTTFontinfo structdata - the font dataoffset - the font data offsetpublic static boolean stbtt_InitFont(STBTTFontinfo info, java.nio.ByteBuffer data)
STBTTFontinfo 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.info - an STBTTFontinfo structdata - the font datapublic static int nstbtt_FindGlyphIndex(long info,
int unicode_codepoint)
FindGlyphIndexpublic static int stbtt_FindGlyphIndex(STBTTFontinfo info, int unicode_codepoint)
info - an STBTTFontinfo structunicode_codepoint - the unicode code pointpublic static float nstbtt_ScaleForPixelHeight(long info,
float pixels)
ScaleForPixelHeightpublic static float stbtt_ScaleForPixelHeight(STBTTFontinfo info, float pixels)
pixels tall. Height is measured as the distance from the highest ascender to the
lowest descender; in other words, it's equivalent to calling GetFontVMetrics and computing:
scale = pixels / (ascent - descent)
so if you prefer to measure height by the ascent only, use a similar calculation.
info - an STBTTFontinfo structpixels - the font height, in pixelspublic static float nstbtt_ScaleForMappingEmToPixels(long info,
float pixels)
ScaleForMappingEmToPixelspublic static float stbtt_ScaleForMappingEmToPixels(STBTTFontinfo info, float pixels)
pixels tall. This is probably what traditional APIs compute, but I'm not
positive.info - an STBTTFontinfo structpixels - the font height, in pixelspublic static void nstbtt_GetFontVMetrics(long info,
long ascent,
long descent,
long lineGap)
GetFontVMetricspublic static void stbtt_GetFontVMetrics(STBTTFontinfo info, @Nullable java.nio.IntBuffer ascent, @Nullable java.nio.IntBuffer descent, @Nullable java.nio.IntBuffer lineGap)
*ascent - *descent + *lineGap
The returned values are expressed in unscaled coordinates, so you must multiply by the scale factor for a given size.
info - an STBTTFontinfo structascent - returns the coordinate above the baseline the font extendsdescent - returns the coordinate below the baseline the font extends (i.e. it is typically negative)lineGap - returns the spacing between one row's descent and the next row's ascentpublic static int nstbtt_GetFontVMetricsOS2(long info,
long typoAscent,
long typoDescent,
long typoLineGap)
GetFontVMetricsOS2public static boolean stbtt_GetFontVMetricsOS2(STBTTFontinfo info, @Nullable java.nio.IntBuffer typoAscent, @Nullable java.nio.IntBuffer typoDescent, @Nullable java.nio.IntBuffer typoLineGap)
GetFontVMetrics, but returns the "typographic" values from the OS/2 table (specific to MS/Windows TTF files).info - an STBTTFontinfo structtypoAscent - returns the coordinate above the baseline the font extendstypoDescent - returns the coordinate below the baseline the font extends (i.e. it is typically negative)typoLineGap - returns the spacing between one row's descent and the next row's ascentpublic static void nstbtt_GetFontBoundingBox(long info,
long x0,
long y0,
long x1,
long y1)
GetFontBoundingBoxpublic static void stbtt_GetFontBoundingBox(STBTTFontinfo info, java.nio.IntBuffer x0, java.nio.IntBuffer y0, java.nio.IntBuffer x1, java.nio.IntBuffer y1)
info - an STBTTFontinfo structx0 - the left coordinatey0 - the bottom coordinatex1 - the right coordinatey1 - the top coordinatepublic static void nstbtt_GetCodepointHMetrics(long info,
int codepoint,
long advanceWidth,
long leftSideBearing)
GetCodepointHMetricspublic static void stbtt_GetCodepointHMetrics(STBTTFontinfo info, int codepoint, @Nullable java.nio.IntBuffer advanceWidth, @Nullable java.nio.IntBuffer leftSideBearing)
The returned values are expressed in unscaled coordinates.
info - an STBTTFontinfo structcodepoint - the unicode codepointadvanceWidth - the offset from the current horizontal position to the next horizontal positionleftSideBearing - the offset from the current horizontal position to the left edge of the characterpublic static int nstbtt_GetCodepointKernAdvance(long info,
int ch1,
int ch2)
GetCodepointKernAdvancepublic static int stbtt_GetCodepointKernAdvance(STBTTFontinfo info, int ch1, int ch2)
advance value between ch1 and ch2.info - an STBTTFontinfo structch1 - the first unicode codepointch2 - the second unicode codepointpublic static int nstbtt_GetCodepointBox(long info,
int codepoint,
long x0,
long y0,
long x1,
long y1)
GetCodepointBoxpublic static boolean stbtt_GetCodepointBox(STBTTFontinfo info, int codepoint, @Nullable java.nio.IntBuffer x0, @Nullable java.nio.IntBuffer y0, @Nullable java.nio.IntBuffer x1, @Nullable java.nio.IntBuffer y1)
info - an STBTTFontinfo structcodepoint - the unicode codepointx0 - returns the left coordinatey0 - returns the bottom coordinatex1 - returns the right coordinatey1 - returns the top coordinatepublic static void nstbtt_GetGlyphHMetrics(long info,
int glyph_index,
long advanceWidth,
long leftSideBearing)
GetGlyphHMetricspublic static void stbtt_GetGlyphHMetrics(STBTTFontinfo info, int glyph_index, @Nullable java.nio.IntBuffer advanceWidth, @Nullable java.nio.IntBuffer leftSideBearing)
GetCodepointHMetrics, for greater efficiency.info - an STBTTFontinfo structglyph_index - the glyph indexadvanceWidth - the offset from the current horizontal position to the next horizontal positionleftSideBearing - the offset from the current horizontal position to the left edge of the characterpublic static int nstbtt_GetGlyphKernAdvance(long info,
int glyph1,
int glyph2)
GetGlyphKernAdvancepublic static int stbtt_GetGlyphKernAdvance(STBTTFontinfo info, int glyph1, int glyph2)
GetCodepointKernAdvance, for greater efficiency.info - an STBTTFontinfo structglyph1 - the first glyph indexglyph2 - the second glyph indexpublic static int nstbtt_GetGlyphBox(long info,
int glyph_index,
long x0,
long y0,
long x1,
long y1)
GetGlyphBoxpublic static boolean stbtt_GetGlyphBox(STBTTFontinfo info, int glyph_index, @Nullable java.nio.IntBuffer x0, @Nullable java.nio.IntBuffer y0, @Nullable java.nio.IntBuffer x1, @Nullable java.nio.IntBuffer y1)
GetCodepointBox, for greater efficiency.info - an STBTTFontinfo structglyph_index - the glyph indexx0 - returns the left coordinatey0 - returns the bottom coordinatex1 - returns the right coordinatey1 - returns the top coordinatepublic static int nstbtt_IsGlyphEmpty(long info,
int glyph_index)
IsGlyphEmptypublic static boolean stbtt_IsGlyphEmpty(STBTTFontinfo info, int glyph_index)
info - an STBTTFontinfo structglyph_index - the glyph indexpublic static int nstbtt_GetCodepointShape(long info,
int unicode_codepoint,
long vertices)
GetCodepointShapepublic static int stbtt_GetCodepointShape(STBTTFontinfo info, int unicode_codepoint, org.lwjgl.PointerBuffer vertices)
*vertices with the pointer to them
The shape is a series of contours. Each one starts with a vmove, then consists of a series of mixed vline and vcurve segments. A vline draws a
line from previous endpoint to its x,y; a vcurve draws a quadratic bezier from previous endpoint to its x,y, using cx,cy as
the bezier control point.
The STBTTVertex values are expressed in "unscaled" coordinates.
info - an STBTTFontinfo structunicode_codepoint - the unicode codepointvertices - returns a pointer to an array of STBTTVertex structs@Nullable public static STBTTVertex.Buffer stbtt_GetCodepointShape(STBTTFontinfo info, int unicode_codepoint)
*vertices with the pointer to them
The shape is a series of contours. Each one starts with a vmove, then consists of a series of mixed vline and vcurve segments. A vline draws a
line from previous endpoint to its x,y; a vcurve draws a quadratic bezier from previous endpoint to its x,y, using cx,cy as
the bezier control point.
The STBTTVertex values are expressed in "unscaled" coordinates.
info - an STBTTFontinfo structunicode_codepoint - the unicode codepointpublic static int nstbtt_GetGlyphShape(long info,
int glyph_index,
long vertices)
GetGlyphShapepublic static int stbtt_GetGlyphShape(STBTTFontinfo info, int glyph_index, org.lwjgl.PointerBuffer vertices)
GetCodepointShape, for greater efficiency.info - an STBTTFontinfo structglyph_index - the unicode codepointvertices - returns a pointer to an array of STBTTVertex structs@Nullable public static STBTTVertex.Buffer stbtt_GetGlyphShape(STBTTFontinfo info, int glyph_index)
GetCodepointShape, for greater efficiency.info - an STBTTFontinfo structglyph_index - the unicode codepointpublic static void nstbtt_FreeShape(long info,
long vertices)
FreeShapepublic static void stbtt_FreeShape(STBTTFontinfo info, STBTTVertex.Buffer vertices)
GetCodepointShape and GetGlyphShape.info - an STBTTFontinfo structvertices - the array of STBTTVertex structs to freepublic static void nstbtt_FreeBitmap(long bitmap,
long userdata)
FreeBitmappublic static void stbtt_FreeBitmap(java.nio.ByteBuffer bitmap,
long userdata)
GetCodepointBitmap, GetCodepointBitmapSubpixel, GetGlyphBitmap or GetGlyphBitmapSubpixel.bitmap - the bitmap to freeuserdata - a pointer to an allocation contextpublic static void stbtt_FreeBitmap(java.nio.ByteBuffer bitmap)
GetCodepointBitmap, GetCodepointBitmapSubpixel, GetGlyphBitmap or GetGlyphBitmapSubpixel.bitmap - the bitmap to freepublic static long nstbtt_GetCodepointBitmap(long info,
float scale_x,
float scale_y,
int codepoint,
long width,
long height,
long xoff,
long yoff)
GetCodepointBitmap@Nullable public static java.nio.ByteBuffer stbtt_GetCodepointBitmap(STBTTFontinfo info, float scale_x, float scale_y, int codepoint, java.nio.IntBuffer width, java.nio.IntBuffer height, @Nullable java.nio.IntBuffer xoff, @Nullable java.nio.IntBuffer yoff)
info - an STBTTFontinfo structscale_x - the horizontal scalescale_y - the vertical scalecodepoint - the unicode codepoint to renderwidth - returns the bitmap widthheight - returns the bitmap heightxoff - returns the horizontal offset in pixel space from the glyph origin to the left of the bitmapyoff - returns the vertical offset in pixel space from the glyph origin to the top of the bitmappublic static long nstbtt_GetCodepointBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint,
long width,
long height,
long xoff,
long yoff)
GetCodepointBitmapSubpixel@Nullable public static java.nio.ByteBuffer stbtt_GetCodepointBitmapSubpixel(STBTTFontinfo info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, java.nio.IntBuffer width, java.nio.IntBuffer height, @Nullable java.nio.IntBuffer xoff, @Nullable java.nio.IntBuffer yoff)
GetCodepointBitmap, but you can specify a subpixel shift for the character.info - an STBTTFontinfo structscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftcodepoint - the unicode codepoint to renderwidth - returns the bitmap widthheight - returns the bitmap heightxoff - returns the horizontal offset in pixel space from the glyph origin to the left of the bitmapyoff - returns the vertical offset in pixel space from the glyph origin to the top of the bitmappublic static void nstbtt_MakeCodepointBitmap(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
int codepoint)
MakeCodepointBitmappublic static void stbtt_MakeCodepointBitmap(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)
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 GetCodepointBitmapBox to get the width and height and positioning info for it first.info - an STBTTFontinfo structoutput - the bitmap storageout_w - the bitmap widthout_h - the bitmap heightout_stride - the row stride, in bytesscale_x - the horizontal scalescale_y - the vertical scalecodepoint - the unicode codepoint to renderpublic static void nstbtt_MakeCodepointBitmapSubpixel(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint)
MakeCodepointBitmapSubpixelpublic static void stbtt_MakeCodepointBitmapSubpixel(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint)
MakeCodepointBitmap, but you can specify a subpixel shift for the character.info - an STBTTFontinfo structoutput - the bitmap storageout_w - the bitmap widthout_h - the bitmap heightout_stride - the row stride, in bytesscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftcodepoint - the unicode codepoint to renderpublic static void nstbtt_MakeCodepointBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
long sub_x,
long sub_y,
int codepoint)
MakeCodepointBitmapSubpixelPrefilterpublic static void stbtt_MakeCodepointBitmapSubpixelPrefilter(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, java.nio.FloatBuffer sub_x, java.nio.FloatBuffer sub_y, int codepoint)
MakeCodepointBitmapSubpixel, but prefiltering is performed (see PackSetOversampling).info - an STBTTFontinfo structoutput - the bitmap storageout_w - the bitmap widthout_h - the bitmap heightout_stride - the row stride, in bytesscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftoversample_x - the horizontal oversampling amountoversample_y - the vertical oversampling amountsub_x - returns the horizontal oversample shiftsub_y - returns the vertical oversample shiftcodepoint - the unicode codepoint to renderpublic static void nstbtt_GetCodepointBitmapBox(long font,
int codepoint,
float scale_x,
float scale_y,
long ix0,
long iy0,
long ix1,
long iy1)
GetCodepointBitmapBoxpublic static void stbtt_GetCodepointBitmapBox(STBTTFontinfo font, int codepoint, float scale_x, float scale_y, @Nullable java.nio.IntBuffer ix0, @Nullable java.nio.IntBuffer iy0, @Nullable java.nio.IntBuffer ix1, @Nullable java.nio.IntBuffer iy1)
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.
font - an STBTTFontinfo structcodepoint - the unicode codepointscale_x - the horizontal scalescale_y - the vertical scaleix0 - returns the left coordinateiy0 - returns the bottom coordinateix1 - returns the right coordinateiy1 - returns the top coordinatepublic static void nstbtt_GetCodepointBitmapBoxSubpixel(long font,
int codepoint,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
long ix0,
long iy0,
long ix1,
long iy1)
GetCodepointBitmapBoxSubpixelpublic static void stbtt_GetCodepointBitmapBoxSubpixel(STBTTFontinfo font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, @Nullable java.nio.IntBuffer ix0, @Nullable java.nio.IntBuffer iy0, @Nullable java.nio.IntBuffer ix1, @Nullable java.nio.IntBuffer iy1)
GetCodepointBitmapBox, but you can specify a subpixel shift for the character.font - an STBTTFontinfo structcodepoint - the unicode codepointscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftix0 - returns the left coordinateiy0 - returns the bottom coordinateix1 - returns the right coordinateiy1 - returns the top coordinatepublic static long nstbtt_GetGlyphBitmap(long info,
float scale_x,
float scale_y,
int glyph,
long width,
long height,
long xoff,
long yoff)
GetGlyphBitmap@Nullable public static java.nio.ByteBuffer stbtt_GetGlyphBitmap(STBTTFontinfo info, float scale_x, float scale_y, int glyph, java.nio.IntBuffer width, java.nio.IntBuffer height, @Nullable java.nio.IntBuffer xoff, @Nullable java.nio.IntBuffer yoff)
info - an STBTTFontinfo structscale_x - the horizontal scalescale_y - the vertical scaleglyph - the glyph index to renderwidth - returns the bitmap widthheight - returns the bitmap heightxoff - returns the horizontal offset in pixel space from the glyph origin to the left of the bitmapyoff - returns the vertical offset in pixel space from the glyph origin to the top of the bitmappublic static long nstbtt_GetGlyphBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph,
long width,
long height,
long xoff,
long yoff)
GetGlyphBitmapSubpixel@Nullable public static java.nio.ByteBuffer stbtt_GetGlyphBitmapSubpixel(STBTTFontinfo info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, java.nio.IntBuffer width, java.nio.IntBuffer height, @Nullable java.nio.IntBuffer xoff, @Nullable java.nio.IntBuffer yoff)
GetGlyphBitmap, but you can specify a subpixel shift for the character.info - an STBTTFontinfo structscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftglyph - the glyph index to renderwidth - returns the bitmap widthheight - returns the bitmap heightxoff - returns the horizontal offset in pixel space from the glyph origin to the left of the bitmapyoff - returns the vertical offset in pixel space from the glyph origin to the top of the bitmappublic static void nstbtt_MakeGlyphBitmap(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
int glyph)
MakeGlyphBitmappublic static void stbtt_MakeGlyphBitmap(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph)
GetGlyphBitmap, 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 GetGlyphBitmapBox to get the width and height and positioning info for it first.info - an STBTTFontinfo structoutput - the bitmap storageout_w - the bitmap widthout_h - the bitmap heightout_stride - the row stride, in bytesscale_x - the horizontal scalescale_y - the vertical scaleglyph - the glyph index to renderpublic static void nstbtt_MakeGlyphBitmapSubpixel(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph)
MakeGlyphBitmapSubpixelpublic static void stbtt_MakeGlyphBitmapSubpixel(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph)
MakeGlyphBitmap, but you can specify a subpixel shift for the character.info - an STBTTFontinfo structoutput - the bitmap storageout_w - the bitmap widthout_h - the bitmap heightout_stride - the row stride, in bytesscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftglyph - the glyph index to renderpublic static void nstbtt_MakeGlyphBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
long sub_x,
long sub_y,
int glyph)
MakeGlyphBitmapSubpixelPrefilterpublic static void stbtt_MakeGlyphBitmapSubpixelPrefilter(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, java.nio.FloatBuffer sub_x, java.nio.FloatBuffer sub_y, int glyph)
MakeGlyphBitmapSubpixel, but prefiltering is performed (see PackSetOversampling).info - an STBTTFontinfo structoutput - the bitmap storageout_w - the bitmap widthout_h - the bitmap heightout_stride - the row stride, in bytesscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftoversample_x - the horizontal oversampling amountoversample_y - the vertical oversampling amountsub_x - returns the horizontal oversample shiftsub_y - returns the vertical oversample shiftglyph - the glyph index to renderpublic static void nstbtt_GetGlyphBitmapBox(long font,
int glyph,
float scale_x,
float scale_y,
long ix0,
long iy0,
long ix1,
long iy1)
GetGlyphBitmapBoxpublic static void stbtt_GetGlyphBitmapBox(STBTTFontinfo font, int glyph, float scale_x, float scale_y, @Nullable java.nio.IntBuffer ix0, @Nullable java.nio.IntBuffer iy0, @Nullable java.nio.IntBuffer ix1, @Nullable java.nio.IntBuffer iy1)
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 GlyphBitmapBox and GlyphBox are inverted.
font - an STBTTFontinfo structglyph - the glyph indexscale_x - the horizontal scalescale_y - the vertical scaleix0 - returns the left coordinateiy0 - returns the bottom coordinateix1 - returns the right coordinateiy1 - returns the top coordinatepublic static void nstbtt_GetGlyphBitmapBoxSubpixel(long font,
int glyph,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
long ix0,
long iy0,
long ix1,
long iy1)
GetGlyphBitmapBoxSubpixelpublic static void stbtt_GetGlyphBitmapBoxSubpixel(STBTTFontinfo font, int glyph, float scale_x, float scale_y, float shift_x, float shift_y, @Nullable java.nio.IntBuffer ix0, @Nullable java.nio.IntBuffer iy0, @Nullable java.nio.IntBuffer ix1, @Nullable java.nio.IntBuffer iy1)
GetGlyphBitmapBox, but you can specify a subpixel shift for the character.font - an STBTTFontinfo structglyph - the glyph indexscale_x - the horizontal scalescale_y - the vertical scaleshift_x - the horizontal subpixel shiftshift_y - the vertical subpixel shiftix0 - returns the left coordinateiy0 - returns the bottom coordinateix1 - returns the right coordinateiy1 - returns the top coordinatepublic static void nstbtt_Rasterize(long result,
float flatness_in_pixels,
long vertices,
int num_verts,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int x_off,
int y_off,
int invert,
long alloc_context)
Rasterizenum_verts - number of vertices in above arraypublic static void stbtt_Rasterize(STBTTBitmap result, float flatness_in_pixels, STBTTVertex.Buffer vertices, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, boolean invert)
result - 1-channel bitmap to draw intoflatness_in_pixels - allowable error of curve in pixelsvertices - array of vertices defining shapescale_x - horizontal scale applied to input verticesscale_y - vertical scale applied to input verticesshift_x - horizontal translation applied to input verticesshift_y - vertical translation applied to input verticesx_off - another horizontal translation applied to inputy_off - another vertical translation applied to inputinvert - if non-zero, vertically flip shapepublic static void nstbtt_FreeSDF(long bitmap,
long userdata)
FreeSDFpublic static void stbtt_FreeSDF(java.nio.ByteBuffer bitmap,
long userdata)
bitmap - the SDF bitmap to freeuserdata - a pointer to an allocation contextpublic static void stbtt_FreeSDF(java.nio.ByteBuffer bitmap)
bitmap - the SDF bitmap to freepublic static long nstbtt_GetGlyphSDF(long font,
float scale,
int glyph,
int padding,
byte onedge_value,
float pixel_dist_scale,
long width,
long height,
long xoff,
long yoff)
GetGlyphSDF@Nullable public static java.nio.ByteBuffer stbtt_GetGlyphSDF(STBTTFontinfo font, float scale, int glyph, int padding, byte onedge_value, float pixel_dist_scale, java.nio.IntBuffer width, java.nio.IntBuffer height, java.nio.IntBuffer xoff, java.nio.IntBuffer yoff)
pixel_dist_scale & onedge_value are a scale & bias that allows you to make optimal use of the limited 0..255 for your
application, trading off precision and special effects. SDF values outside the range 0..255 are clamped to 0..255.
Example:
scale = stbtt_ScaleForPixelHeight(22)
padding = 5
onedge_value = 180
pixel_dist_scale = 180/5.0 = 36.0
This will create an SDF bitmap in which the character is about 22 pixels high but the whole bitmap is about 22+5+5=32 pixels high. To produce a
filled shape, sample the SDF at each pixel and fill the pixel if the SDF value is greater than or equal to 180/255. (You'll actually want to
antialias, which is beyond the scope of this example.) Additionally, you can compute offset outlines (e.g. to stroke the character border inside &
outside, or only outside). For example, to fill outside the character up to 3 SDF pixels, you would compare against (180-36.0*3)/255 = 72/255.
The above choice of variables maps a range from 5 pixels outside the shape to 2 pixels inside the shape to 0..255; this is intended primarily
for apply outside effects only (the interior range is needed to allow proper antialiasing of the font at smaller sizes).
The function computes the SDF analytically at each SDF pixel, not by e.g. building a higher-res bitmap and approximating it. In theory the quality should be as high as possible for an SDF of this size & representation, but unclear if this is true in practice (perhaps building a higher-res bitmap and computing from that can allow drop-out prevention).
The algorithm has not been optimized at all, so expect it to be slow if computing lots of characters or very large sizes.
font - an STBTTFontinfo structscale - controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmapglyph - the glyph to generate the SDF forpadding - extra "pixels" around the character which are filled with the distance to the character (not 0), which allows effects like bit outlinesonedge_value - value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character)pixel_dist_scale - what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale). If positive, > onedge_value
is inside; if negative, < onedge_value is inside.width - output width of the SDF bitmap (including padding)height - output height of the SDF bitmap (including padding)xoff - output horizontal origin of the characteryoff - output vertical origin of the characterpublic static long nstbtt_GetCodepointSDF(long font,
float scale,
int codepoint,
int padding,
byte onedge_value,
float pixel_dist_scale,
long width,
long height,
long xoff,
long yoff)
GetCodepointSDF@Nullable public static java.nio.ByteBuffer stbtt_GetCodepointSDF(STBTTFontinfo font, float scale, int codepoint, int padding, byte onedge_value, float pixel_dist_scale, java.nio.IntBuffer width, java.nio.IntBuffer height, java.nio.IntBuffer xoff, java.nio.IntBuffer yoff)
GetGlyphSDF.font - an STBTTFontinfo structscale - controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmapcodepoint - the codepoint to generate the SDF forpadding - extra "pixels" around the character which are filled with the distance to the character (not 0), which allows effects like bit outlinesonedge_value - value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character)pixel_dist_scale - what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale). If positive, > onedge_value
is inside; if negative, < onedge_value is inside.width - output width of the SDF bitmap (including padding)height - output height of the SDF bitmap (including padding)xoff - output horizontal origin of the characteryoff - output vertical origin of the characterpublic static int nstbtt_FindMatchingFont(long fontdata,
long name,
int flags)
FindMatchingFontpublic static int stbtt_FindMatchingFont(java.nio.ByteBuffer fontdata,
java.nio.ByteBuffer name,
int flags)
If you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold". If you use any other flag, use a font name like "Arial"; this checks the
macStyle header field; I don't know if fonts set this consistently.
fontdata - the font dataname - the font nameflags - the style flags. One of:MACSTYLE_DONTCARE | MACSTYLE_BOLD | MACSTYLE_ITALIC | MACSTYLE_UNDERSCORE | MACSTYLE_NONE |
public static int stbtt_FindMatchingFont(java.nio.ByteBuffer fontdata,
java.lang.CharSequence name,
int flags)
If you use STBTT_MACSTYLE_DONTCARE, use a font name like "Arial Bold". If you use any other flag, use a font name like "Arial"; this checks the
macStyle header field; I don't know if fonts set this consistently.
fontdata - the font dataname - the font nameflags - the style flags. One of:MACSTYLE_DONTCARE | MACSTYLE_BOLD | MACSTYLE_ITALIC | MACSTYLE_UNDERSCORE | MACSTYLE_NONE |
public static int nstbtt_CompareUTF8toUTF16_bigendian(long s1,
int len1,
long s2,
int len2)
CompareUTF8toUTF16_bigendianlen1 - the length of the first string, in byteslen2 - the length of the second string, in bytespublic static boolean stbtt_CompareUTF8toUTF16_bigendian(java.nio.ByteBuffer s1,
java.nio.ByteBuffer s2)
GetFontNameString.s1 - the first strings2 - the second stringpublic static long nstbtt_GetFontNameString(long font,
long length,
int platformID,
int encodingID,
int languageID,
int nameID)
GetFontNameStringlength - returns the string length, in bytes@Nullable public static java.nio.ByteBuffer stbtt_GetFontNameString(STBTTFontinfo font, int platformID, int encodingID, int languageID, int nameID)
*length.
See the truetype spec:
font - an STBTTFontinfo structplatformID - the platform ID. One of:PLATFORM_ID_UNICODE | PLATFORM_ID_MAC | PLATFORM_ID_ISO | PLATFORM_ID_MICROSOFT |
encodingID - the encoding ID. One of:languageID - the language ID. One of:nameID - the name IDpublic static void nstbtt_GetBakedQuad(long chardata,
int pw,
int ph,
int char_index,
float[] xpos,
float[] ypos,
long q,
int opengl_fillrule)
nstbtt_GetBakedQuad(long, int, int, int, long, long, long, int)public static void stbtt_GetBakedQuad(STBTTBakedChar.Buffer chardata, int pw, int ph, int char_index, float[] xpos, float[] ypos, STBTTAlignedQuad q, boolean opengl_fillrule)
GetBakedQuadpublic static void nstbtt_GetScaledFontVMetrics(long fontdata,
int index,
float size,
float[] ascent,
float[] descent,
float[] lineGap)
nstbtt_GetScaledFontVMetrics(long, int, float, long, long, long)public static void stbtt_GetScaledFontVMetrics(java.nio.ByteBuffer fontdata,
int index,
float size,
float[] ascent,
float[] descent,
float[] lineGap)
GetScaledFontVMetricspublic static void nstbtt_GetPackedQuad(long chardata,
int pw,
int ph,
int char_index,
float[] xpos,
float[] ypos,
long q,
int align_to_integer)
nstbtt_GetPackedQuad(long, int, int, int, long, long, long, int)public static void stbtt_GetPackedQuad(STBTTPackedchar.Buffer chardata, int pw, int ph, int char_index, float[] xpos, float[] ypos, STBTTAlignedQuad q, boolean align_to_integer)
GetPackedQuadpublic static void nstbtt_GetFontVMetrics(long info,
int[] ascent,
int[] descent,
int[] lineGap)
nstbtt_GetFontVMetrics(long, long, long, long)public static void stbtt_GetFontVMetrics(STBTTFontinfo info, @Nullable int[] ascent, @Nullable int[] descent, @Nullable int[] lineGap)
GetFontVMetricspublic static int nstbtt_GetFontVMetricsOS2(long info,
int[] typoAscent,
int[] typoDescent,
int[] typoLineGap)
nstbtt_GetFontVMetricsOS2(long, long, long, long)public static boolean stbtt_GetFontVMetricsOS2(STBTTFontinfo info, @Nullable int[] typoAscent, @Nullable int[] typoDescent, @Nullable int[] typoLineGap)
GetFontVMetricsOS2public static void nstbtt_GetFontBoundingBox(long info,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
nstbtt_GetFontBoundingBox(long, long, long, long, long)public static void stbtt_GetFontBoundingBox(STBTTFontinfo info, int[] x0, int[] y0, int[] x1, int[] y1)
GetFontBoundingBoxpublic static void nstbtt_GetCodepointHMetrics(long info,
int codepoint,
int[] advanceWidth,
int[] leftSideBearing)
nstbtt_GetCodepointHMetrics(long, int, long, long)public static void stbtt_GetCodepointHMetrics(STBTTFontinfo info, int codepoint, @Nullable int[] advanceWidth, @Nullable int[] leftSideBearing)
GetCodepointHMetricspublic static int nstbtt_GetCodepointBox(long info,
int codepoint,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
nstbtt_GetCodepointBox(long, int, long, long, long, long)public static boolean stbtt_GetCodepointBox(STBTTFontinfo info, int codepoint, @Nullable int[] x0, @Nullable int[] y0, @Nullable int[] x1, @Nullable int[] y1)
GetCodepointBoxpublic static void nstbtt_GetGlyphHMetrics(long info,
int glyph_index,
int[] advanceWidth,
int[] leftSideBearing)
nstbtt_GetGlyphHMetrics(long, int, long, long)public static void stbtt_GetGlyphHMetrics(STBTTFontinfo info, int glyph_index, @Nullable int[] advanceWidth, @Nullable int[] leftSideBearing)
GetGlyphHMetricspublic static int nstbtt_GetGlyphBox(long info,
int glyph_index,
int[] x0,
int[] y0,
int[] x1,
int[] y1)
nstbtt_GetGlyphBox(long, int, long, long, long, long)public static boolean stbtt_GetGlyphBox(STBTTFontinfo info, int glyph_index, @Nullable int[] x0, @Nullable int[] y0, @Nullable int[] x1, @Nullable int[] y1)
GetGlyphBoxpublic static long nstbtt_GetCodepointBitmap(long info,
float scale_x,
float scale_y,
int codepoint,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
@Nullable public static java.nio.ByteBuffer stbtt_GetCodepointBitmap(STBTTFontinfo info, float scale_x, float scale_y, int codepoint, int[] width, int[] height, @Nullable int[] xoff, @Nullable int[] yoff)
GetCodepointBitmappublic static long nstbtt_GetCodepointBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int codepoint,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
@Nullable public static java.nio.ByteBuffer stbtt_GetCodepointBitmapSubpixel(STBTTFontinfo info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int[] width, int[] height, @Nullable int[] xoff, @Nullable int[] yoff)
GetCodepointBitmapSubpixelpublic static void nstbtt_MakeCodepointBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
float[] sub_x,
float[] sub_y,
int codepoint)
public static void stbtt_MakeCodepointBitmapSubpixelPrefilter(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float[] sub_x, float[] sub_y, int codepoint)
MakeCodepointBitmapSubpixelPrefilterpublic static void nstbtt_GetCodepointBitmapBox(long font,
int codepoint,
float scale_x,
float scale_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
public static void stbtt_GetCodepointBitmapBox(STBTTFontinfo font, int codepoint, float scale_x, float scale_y, @Nullable int[] ix0, @Nullable int[] iy0, @Nullable int[] ix1, @Nullable int[] iy1)
GetCodepointBitmapBoxpublic static void nstbtt_GetCodepointBitmapBoxSubpixel(long font,
int codepoint,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
public static void stbtt_GetCodepointBitmapBoxSubpixel(STBTTFontinfo font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, @Nullable int[] ix0, @Nullable int[] iy0, @Nullable int[] ix1, @Nullable int[] iy1)
GetCodepointBitmapBoxSubpixelpublic static long nstbtt_GetGlyphBitmap(long info,
float scale_x,
float scale_y,
int glyph,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
nstbtt_GetGlyphBitmap(long, float, float, int, long, long, long, long)@Nullable public static java.nio.ByteBuffer stbtt_GetGlyphBitmap(STBTTFontinfo info, float scale_x, float scale_y, int glyph, int[] width, int[] height, @Nullable int[] xoff, @Nullable int[] yoff)
GetGlyphBitmappublic static long nstbtt_GetGlyphBitmapSubpixel(long info,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int glyph,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
@Nullable public static java.nio.ByteBuffer stbtt_GetGlyphBitmapSubpixel(STBTTFontinfo info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int[] width, int[] height, @Nullable int[] xoff, @Nullable int[] yoff)
GetGlyphBitmapSubpixelpublic static void nstbtt_MakeGlyphBitmapSubpixelPrefilter(long info,
long output,
int out_w,
int out_h,
int out_stride,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int oversample_x,
int oversample_y,
float[] sub_x,
float[] sub_y,
int glyph)
public static void stbtt_MakeGlyphBitmapSubpixelPrefilter(STBTTFontinfo info, java.nio.ByteBuffer output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float[] sub_x, float[] sub_y, int glyph)
MakeGlyphBitmapSubpixelPrefilterpublic static void nstbtt_GetGlyphBitmapBox(long font,
int glyph,
float scale_x,
float scale_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
public static void stbtt_GetGlyphBitmapBox(STBTTFontinfo font, int glyph, float scale_x, float scale_y, @Nullable int[] ix0, @Nullable int[] iy0, @Nullable int[] ix1, @Nullable int[] iy1)
GetGlyphBitmapBoxpublic static void nstbtt_GetGlyphBitmapBoxSubpixel(long font,
int glyph,
float scale_x,
float scale_y,
float shift_x,
float shift_y,
int[] ix0,
int[] iy0,
int[] ix1,
int[] iy1)
public static void stbtt_GetGlyphBitmapBoxSubpixel(STBTTFontinfo font, int glyph, float scale_x, float scale_y, float shift_x, float shift_y, @Nullable int[] ix0, @Nullable int[] iy0, @Nullable int[] ix1, @Nullable int[] iy1)
GetGlyphBitmapBoxSubpixelpublic static long nstbtt_GetGlyphSDF(long font,
float scale,
int glyph,
int padding,
byte onedge_value,
float pixel_dist_scale,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
@Nullable public static java.nio.ByteBuffer stbtt_GetGlyphSDF(STBTTFontinfo font, float scale, int glyph, int padding, byte onedge_value, float pixel_dist_scale, int[] width, int[] height, int[] xoff, int[] yoff)
GetGlyphSDFpublic static long nstbtt_GetCodepointSDF(long font,
float scale,
int codepoint,
int padding,
byte onedge_value,
float pixel_dist_scale,
int[] width,
int[] height,
int[] xoff,
int[] yoff)
@Nullable public static java.nio.ByteBuffer stbtt_GetCodepointSDF(STBTTFontinfo font, float scale, int codepoint, int padding, byte onedge_value, float pixel_dist_scale, int[] width, int[] height, int[] xoff, int[] yoff)
GetCodepointSDFCopyright LWJGL. All Rights Reserved. License terms.