Skip to content

Commit

Permalink
Add underline metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmaciel committed Oct 22, 2023
1 parent beebb24 commit a8ccbcd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions stb_truetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -2657,6 +2657,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);
Expand Down

0 comments on commit a8ccbcd

Please sign in to comment.