nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
26.38k stars 7.69k forks source link

stb_truetype: Support vertical layout #1418

Open Cerallin opened 1 year ago

Cerallin commented 1 year ago

Users may sometimes want to typeset glyphs vertically (especially CJK), and that's what vhea and vmtx are for.

This PR adds 3 functions shown below to support vertical layouts.

STBTT_DEF void stbtt_GetFontHMetrics(const stbtt_fontinfo *info, int *vertTypoAscender, int *vertTypoDescender, int *vertTypoLineGap);
STBTT_DEF void stbtt_GetGlyphVMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceHeight, int *topSideBearing);
STBTT_DEF void stbtt_GetCodepointVMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceHeight, int *topSideBearing);