[VORG] Hook up to hb-ot-font's v_origin
Fixes https://github.com/harfbuzz/harfbuzz/issues/544 Test added with NotoSansCJK, eg. with U+FF38.
This commit is contained in:
parent
097ecfd4a9
commit
48ed598a35
|
@ -31,7 +31,6 @@
|
||||||
#include "hb-ot-hmtx-table.hh"
|
#include "hb-ot-hmtx-table.hh"
|
||||||
#include "hb-ot-kern-table.hh"
|
#include "hb-ot-kern-table.hh"
|
||||||
#include "hb-ot-post-table.hh"
|
#include "hb-ot-post-table.hh"
|
||||||
#include "hb-ot-vorg-table.hh"
|
|
||||||
#include "hb-ot-color-cbdt-table.hh"
|
#include "hb-ot-color-cbdt-table.hh"
|
||||||
#include "hb-ot-layout-gdef-table.hh"
|
#include "hb-ot-layout-gdef-table.hh"
|
||||||
#include "hb-ot-layout-gsub-table.hh"
|
#include "hb-ot-layout-gsub-table.hh"
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "hb-ot-kern-table.hh"
|
#include "hb-ot-kern-table.hh"
|
||||||
#include "hb-ot-post-table.hh"
|
#include "hb-ot-post-table.hh"
|
||||||
#include "hb-ot-glyf-table.hh"
|
#include "hb-ot-glyf-table.hh"
|
||||||
|
#include "hb-ot-vorg-table.hh"
|
||||||
#include "hb-ot-color-cbdt-table.hh"
|
#include "hb-ot-color-cbdt-table.hh"
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,9 +139,15 @@ hb_ot_get_glyph_v_origin (hb_font_t *font,
|
||||||
|
|
||||||
*x = font->get_glyph_h_advance (glyph) / 2;
|
*x = font->get_glyph_h_advance (glyph) / 2;
|
||||||
|
|
||||||
|
const OT::VORG &VORG = *ot_face->VORG.get ();
|
||||||
|
if (VORG.has_data ())
|
||||||
|
{
|
||||||
|
*y = font->em_scale_y (VORG.get_y_origin (glyph));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
hb_glyph_extents_t extents = {0};
|
hb_glyph_extents_t extents = {0};
|
||||||
bool ret = ot_face->glyf->get_extents (glyph, &extents);
|
if (ot_face->glyf->get_extents (glyph, &extents))
|
||||||
if (ret)
|
|
||||||
{
|
{
|
||||||
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx.get ();
|
const OT::vmtx_accelerator_t &vmtx = *ot_face->vmtx.get ();
|
||||||
hb_position_t tsb = vmtx.get_side_bearing (glyph);
|
hb_position_t tsb = vmtx.get_side_bearing (glyph);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace OT {
|
||||||
|
|
||||||
struct VertOriginMetric
|
struct VertOriginMetric
|
||||||
{
|
{
|
||||||
inline int cmp (hb_codepoint_t g) const { return -glyph.cmp (g); }
|
inline int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,9 @@ struct VORG
|
||||||
|
|
||||||
inline int get_y_origin (hb_codepoint_t glyph) const
|
inline int get_y_origin (hb_codepoint_t glyph) const
|
||||||
{
|
{
|
||||||
vertYOrigins.bsearch (glyph);
|
int i = vertYOrigins.bsearch (glyph);
|
||||||
|
if (i != -1)
|
||||||
|
return vertYOrigins[i].vertOriginY;
|
||||||
|
|
||||||
return defaultVertOriginY;
|
return defaultVertOriginY;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -1,3 +1,4 @@
|
||||||
../fonts/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t --font-funcs=ft:U+300C:[uni300C.vert=0@-512,-578+0,-1024]
|
../fonts/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t --font-funcs=ft:U+300C:[uni300C.vert=0@-512,-578+0,-1024]
|
||||||
../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ft:U+0041,U+0042:[gid1=0@-654,-2128+0,-2789|gid2=1@-665,-2125+0,-2789]
|
../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ft:U+0041,U+0042:[gid1=0@-654,-2128+0,-2789|gid2=1@-665,-2125+0,-2789]
|
||||||
../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-1468+0,-2048|gid2=1@-665,-1462+0,-2048]
|
../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-1468+0,-2048|gid2=1@-665,-1462+0,-2048]
|
||||||
|
../fonts/4cbbc461be066fccc611dcc634af6e8cb2705537.ttf:--direction=t --font-funcs=ot:U+FF38:[gid2=0@-500,-867+0,-1000]
|
||||||
|
|
Loading…
Reference in New Issue