[OTVAR] Exact definition of “bounding box” in a variable font.

In a nutshell: the exact definition of the "bounding box" used to calculate metrics (LSB & TSB in HMTX-HVAR/VMTX-VVAR). Will the rasterizer use a fixed bounding box for all the instances (like the one stored in glyf table), of the dynamically calculated bounding box, one for one distance?


  • The bounding box computed by the rasterizer -- the "phantom" points -- is derived (in a TT-flavoured font) solely using the 'glyf' and 'gvar' tables: the 'glyf' table provides phantom points for the default instance, and the 'gvar' table provides deltas that describe how the phantom points get translated for non-default instances, in the same way as it describes other points.

    Note: In the 'gvar' table, the number of glyph points is equal to the number of points in the glyph description in the 'glyf' table, plus the four phantom points (the last 4 points in 'gvar' point numbering).

    The hmtx/HVAR and vmtx/VVAR tables are expected to produce the same results as the rasterizer phantom points, modulo that the phantom points can potentially be adjusted by hints whereas hmtx/etc. values are not (just as in a non-variable font).

  • Belleve InvisBelleve Invis Posts: 183
    edited August 2
    @Peter Constable The phamtom points already had side bearing.
    Let's consider the situation for VVAR. We have a glyph with only two points, z1 and z2, with their (default) coordinates being y1 and y2 (y1 < y2), and the delta under the chosen instance being δy1 and δy2. In vmtx and VVAR the TSB is defined as t + δt, and the advance height is h + δh.

    Following the definition of glyf’s bounding box, the ymax would become y2, and the vertical origin would be y2 + t in the default instance. This is the peaceful old world we know.

    However in the variable world, the advance height would become h + δh, which is simple. However the top side bearing is now t + δt, and the definition of vertical origin become ambiguous now:

    -        If we follow the glyf’s ymax then the vertical origin would become y2 + t + δt.

    -        If we follow the true bounding box, the vertical origin would become max(y1 + δy1, y2 + δy2) + t + δt. This is a complex formula and it is even not representable in the OTVar’s “value + delta” manner, as the designers expected.

  • Belleve InvisBelleve Invis Posts: 183
    This problem gets more serious for CFF2: given that the "true bound" of a glyph is not representable in "value + delta" mechanism, and there is no phantom point in CFF2, how can we encode the top side bearing if we want the vertical origin being a fixed, or a simple varible quantity? If we eliminate TSB some rasterizer would make use a constant TSB and make the metrics incorrect.
Sign In or Register to comment.