export distanceRange
continuous-integration/drone/push Build is passing Details

pull/1/head
cosmonaut 2023-12-08 00:06:36 -08:00
parent 355e98bb19
commit 086e452e15
2 changed files with 8 additions and 2 deletions

View File

@ -115,7 +115,8 @@ WELLSPRINGAPI Wellspring_Font* Wellspring_CreateFont(
uint32_t fontBytesLength, uint32_t fontBytesLength,
const uint8_t *atlasJsonBytes, const uint8_t *atlasJsonBytes,
uint32_t atlasJsonBytesLength, uint32_t atlasJsonBytesLength,
float *pPixelsPerEm float *pPixelsPerEm,
float *pDistanceRange
); );
/* Batches are not thread-safe, recommend one batch per thread. */ /* Batches are not thread-safe, recommend one batch per thread. */

View File

@ -155,6 +155,7 @@ typedef struct Font
float descender; float descender;
float lineHeight; float lineHeight;
float pixelsPerEm; float pixelsPerEm;
float distanceRange;
float scale; float scale;
float kerningScale; // kerning values from stb_tt are in a different scale float kerningScale; // kerning values from stb_tt are in a different scale
@ -351,7 +352,8 @@ Wellspring_Font* Wellspring_CreateFont(
uint32_t fontBytesLength, uint32_t fontBytesLength,
const uint8_t *atlasJsonBytes, const uint8_t *atlasJsonBytes,
uint32_t atlasJsonBytesLength, uint32_t atlasJsonBytesLength,
float *pPixelsPerEm float *pPixelsPerEm,
float *pDistanceRange
) { ) {
Font *font = Wellspring_malloc(sizeof(Font)); Font *font = Wellspring_malloc(sizeof(Font));
@ -399,6 +401,7 @@ Wellspring_Font* Wellspring_CreateFont(
font->packer.width = json_object_get_uint(atlasObject, "width"); font->packer.width = json_object_get_uint(atlasObject, "width");
font->packer.height = json_object_get_uint(atlasObject, "height"); font->packer.height = json_object_get_uint(atlasObject, "height");
font->pixelsPerEm = json_object_get_double(atlasObject, "size"); font->pixelsPerEm = json_object_get_double(atlasObject, "size");
font->distanceRange = json_object_get_double(atlasObject, "distanceRange");
font->ascender = json_object_get_double(metricsObject, "ascender"); font->ascender = json_object_get_double(metricsObject, "ascender");
font->descender = json_object_get_double(metricsObject, "descender"); font->descender = json_object_get_double(metricsObject, "descender");
@ -480,6 +483,8 @@ Wellspring_Font* Wellspring_CreateFont(
Wellspring_free(jsonRoot); Wellspring_free(jsonRoot);
*pPixelsPerEm = font->pixelsPerEm; *pPixelsPerEm = font->pixelsPerEm;
*pDistanceRange = font->distanceRange;
return (Wellspring_Font*) font; return (Wellspring_Font*) font;
} }