read advance from JSON
continuous-integration/drone/push Build is passing Details

pull/1/head
cosmonaut 2023-12-06 15:50:04 -08:00
parent 7fa1c279ce
commit d22c95a493
1 changed files with 2 additions and 4 deletions

View File

@ -127,7 +127,7 @@ typedef struct PackedChar
{ {
float atlasLeft, atlasTop, atlasRight, atlasBottom; float atlasLeft, atlasTop, atlasRight, atlasBottom;
float planeLeft, planeTop, planeRight, planeBottom; float planeLeft, planeTop, planeRight, planeBottom;
int xAdvance; float xAdvance;
} PackedChar; } PackedChar;
typedef struct CharRange typedef struct CharRange
@ -436,9 +436,7 @@ Wellspring_Font* Wellspring_CreateFont(
font->packer.ranges[charRangeIndex].data = Wellspring_realloc(font->packer.ranges[charRangeIndex].data, sizeof(PackedChar) * font->packer.ranges[charRangeIndex].charCount); font->packer.ranges[charRangeIndex].data = Wellspring_realloc(font->packer.ranges[charRangeIndex].data, sizeof(PackedChar) * font->packer.ranges[charRangeIndex].charCount);
PackedChar *packedChar = &font->packer.ranges[charRangeIndex].data[font->packer.ranges[charRangeIndex].charCount - 1]; PackedChar *packedChar = &font->packer.ranges[charRangeIndex].data[font->packer.ranges[charRangeIndex].charCount - 1];
packedChar->xAdvance = json_object_get_double(currentGlyphObject, "advance");
int bearing;
stbtt_GetCodepointHMetrics(&font->fontInfo, codepoint, &packedChar->xAdvance, &bearing);
if (json_object_has_key(currentGlyphObject, "atlasBounds")) if (json_object_has_key(currentGlyphObject, "atlasBounds"))
{ {