From d22c95a493a245a1af9b062ec12163b2a8f5c957 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 6 Dec 2023 15:50:04 -0800 Subject: [PATCH] read advance from JSON --- src/Wellspring.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Wellspring.c b/src/Wellspring.c index 96b92d7..67e2649 100644 --- a/src/Wellspring.c +++ b/src/Wellspring.c @@ -127,7 +127,7 @@ typedef struct PackedChar { float atlasLeft, atlasTop, atlasRight, atlasBottom; float planeLeft, planeTop, planeRight, planeBottom; - int xAdvance; + float xAdvance; } PackedChar; 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); PackedChar *packedChar = &font->packer.ranges[charRangeIndex].data[font->packer.ranges[charRangeIndex].charCount - 1]; - - int bearing; - stbtt_GetCodepointHMetrics(&font->fontInfo, codepoint, &packedChar->xAdvance, &bearing); + packedChar->xAdvance = json_object_get_double(currentGlyphObject, "advance"); if (json_object_has_key(currentGlyphObject, "atlasBounds")) {