2 pointsby peksi7 hours ago1 comment
  • nigardev5 hours ago
    wrestled with this exact problem on a landing page last year. ended up manually tweaking padding per font family which is obviously garbage. the js solution is cleaner but curious how it handles web fonts that are still loading. do you use font-display swap or wait for load to measure
    • peksi4 hours ago
      Glad to know that I'm not alone with this problem!

      I'm using opentype.js to parse the font. This happens without the browser renderer, so it's not affected by the CSS font state.

      ( For solely rendered font manipulation there's also 'await document.fonts.ready' which resolves once the document has loaded the fonts

      https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet... )

      Edit: Didn't read the question fully on the first go