• T
    Remove assumption about Core Text working in 96 DPI · f401f85a
    Tor Arne Vestbø 提交于
    Core Text doesn't actually have a concept of DPI internally, as it
    doesn't rasterize anything by itself, it just generates vector paths
    that get passed along to Core Graphics.
    
    In practice this means Core Text operates in the classical macOS
    logical DPI of 72, with one typographic point corresponding to one
    point in the Core Graphics coordinate system, which for a normal
    bitmap context then corresponds to one pixel -- or two pixels for
    a "retina" context with a 2x scale transform.
    
    Scaling the font point sizes given to HarfBuzz to an assumed DPI
    of 96 is problematic with this in mind, as fonts with optical
    features such as 'trak' tables for tracking, or color glyphs,
    will then base the metrics off of the wrong point size compared
    to what the client asked for.
    
    This in turn causes mismatches between the metrics of the shaped
    text and the actual rasterization, which doesn't include the 72
    to 96 DPI scaling.
    
    If a 96 DPI is needed, such as on the Web, the scaling should be
    done outside of HarfBuzz, allowing the client to keep the DPI of
    the shaping in sync with the rasterization.
    
    The recommended way to do that is by scaling the font point size,
    not by applying a transform to the target Core Graphics context,
    to let Core Text choose the right optical features of the target
    point size, as described in WWDC 2015 session 804:
    
      https://developer.apple.com/videos/play/wwdc2015/804/
    f401f85a
aat-trak.tests 1.2 KB