Merge 903ccec4f681416985c01ee759b09907590c3157 into 5c205738c191bcb0abc65c4febfa9bd25ff35234

This commit is contained in:
Daniel Ribeiro Maciel 2024-11-22 05:13:11 +00:00 committed by GitHub
commit f0b5d00469
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -785,6 +785,11 @@ STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAsc
STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1);
// the bounding box around all possible characters
STBTT_DEF int stbtt_GetFontUnderlineMetrics(const stbtt_fontinfo *info, int *position, int *thickness);
// the underline position and thickness as defined in the "post" table
//
// Returns 1 on success (table present), 0 on failure.
STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing);
// leftSideBearing is the offset from the current horizontal position to the left edge of the character
// advanceWidth is the offset from the current horizontal position to the next horizontal position
@ -2657,6 +2662,16 @@ STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int
*y1 = ttSHORT(info->data + info->head + 42);
}
STBTT_DEF int stbtt_GetFontUnderlineMetrics(const stbtt_fontinfo *info, int *position, int *thickness)
{
int tab = stbtt__find_table(info->data, info->fontstart, "post");
if (!tab)
return 0;
*position = ttSHORT(info->data + tab + 8);
*thickness = ttSHORT(info->data + tab + 10);
return 1;
}
STBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float height)
{
int fheight = ttSHORT(info->data + info->hhea + 4) - ttSHORT(info->data + info->hhea + 6);