Beispiel #1
1
DaoxGlyph* DaoxFont_LoadGlyph( DaoxFont *self, size_t codepoint )
{
	DaoxGlyph *glyph = DaoxGlyph_New();
	stbtt_vertex *vertices = NULL;
	int id = stbtt_FindGlyphIndex( & self->info, codepoint );
	int i, num_verts = stbtt_GetGlyphShape( & self->info, id, & vertices );

	stbtt_GetGlyphHMetrics( & self->info, id, & glyph->advanceWidth, & glyph->leftSideBearing );

	DMap_Insert( self->glyphs, (void*) codepoint, glyph );
	DaoxPath_SetRelativeMode( glyph->shape, 0 );
	for(i=0; i<num_verts; ++i){
		stbtt_vertex_type x = vertices[i].x;
		stbtt_vertex_type y = vertices[i].y;
		stbtt_vertex_type cx = vertices[i].cx;
		stbtt_vertex_type cy = vertices[i].cy;
		switch( vertices[i].type ){
		case STBTT_vmove :
			if( i ) DaoxPath_Close( glyph->shape );
			DaoxPath_MoveTo( glyph->shape, x, y );
			break;
		case STBTT_vline :
			DaoxPath_LineTo( glyph->shape, x, y );
			break;
		case STBTT_vcurve :
			DaoxPath_QuadTo( glyph->shape, cx, cy, x, y );
			break;
		}
	}
	if( i ) DaoxPath_Close( glyph->shape );
	stbtt_FreeShape( & self->info, vertices );

	return glyph;
}
static inline jint wrapped_Java_com_badlogic_gdx_graphics_g2d_stbtt_StbTrueType_getGlyphShape
(JNIEnv* env, jclass clazz, jlong info, jint glyphIndex, jlongArray obj_vertices, long long* vertices) {

//@line:121

		stbtt_vertex* verticesAddr = 0;
		int result = stbtt_GetGlyphShape((stbtt_fontinfo*)info, glyphIndex, &verticesAddr);
		vertices[0] = (jlong)verticesAddr;
		return result;
	
}