Hello Guest

How to get SBT Glyph Shape

  • 2 Replies
  • 398 Views
How to get SBT Glyph Shape
« on: January 09, 2018, 09:56:46 »
I try to get the glyph shapes from a ttf font using sbt however I seem to get it wrong

Code: [Select]
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

Code: [Select]
[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
« Last Edit: January 09, 2018, 10:02:05 by christianriekoff »

*

Offline spasi

  • *****
  • 2006
    • WebHotelier
Re: How to get SBT Glyph Shape
« Reply #1 on: January 09, 2018, 11:35:46 »
Hey Christian,

Code: [Select]
STBTTVertex.create(myVertices.address(),myNumberOfVertices)
should be

Code: [Select]
STBTTVertex.create(myVertices.get(0),myNumberOfVertices)

Re: How to get SBT Glyph Shape
« Reply #2 on: January 09, 2018, 12:47:15 »
Great thanks a lot!