How to get SBT Glyph Shape

Started by christianriekoff, January 09, 2018, 09:56:46

Previous topic - Next topic

christianriekoff

I try to get the glyph shapes from a ttf font using sbt however I seem to get it wrong

try (MemoryStack stack = stackPush()) {
	PointerBuffer myVertices = stack.callocPointer(1);
	int myNumberOfVertices = stbtt_GetCodepointShape(_myInfo, theCodePoint, myVertices);
	STBTTVertex.Buffer myVertexBuffer = STBTTVertex.create(myVertices.address(),myNumberOfVertices);
	for(int i = 0; i < myNumberOfVertices;i++){
		STBTTVertex myVertex = myVertexBuffer.get(i);
		CCLog.info(myVertex.type(), myVertex.x(), myVertex.y());
	}
	return myNumberOfVertices;
}


this is the example output for the ( char

[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:68:<init>] [INFO] ( : 11 : 124 : -450 : 679 : 1612 : false : 15
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -67 : -28352 : 10083
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 0 : 0 : 32728
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 3 : 1 : 0
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 0 : 0 : 3
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -67 : 24912 : -19686
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 26 : 0 : 21344
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -80 : 32701 : 0
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 0 : -19452 : 32701
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -67 : 32464 : -19582
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -126 : 0 : 32320
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -16 : 32701 : 0
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 0 : -19582 : 32701
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -67 : -32352 : -19582
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] -126 : 0 : -32064
[Tue Jan 09 10:51:52 CET 2018] [CCFont Line:229:codepointShape] [INFO] 112 : 32701 : 0


So type, x, y values make no sense can anyone point me in the right direction I couldn't find any examples or forum entries on this.

Thanks in advance Christian

spasi

Hey Christian,

STBTTVertex.create(myVertices.address(),myNumberOfVertices)


should be

STBTTVertex.create(myVertices.get(0),myNumberOfVertices)

christianriekoff