unjs / fontaine

Automatic font fallback based on font metrics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getMetricsForFamily returns null for all fonts on 0.3.0

AleksandrHovhannisyan opened this issue Β· comments

πŸ› The bug

Only reproducible on fontaine@0.3.0. May have regressed with the changes in c0f6483. To reproduce, clone the repo I created below, run npm install, and then node index.js.

Invoking getMetricsForFamily returns null for any legitimate font. Only reproducible in other packages that install fontaine, but not in fontaine itself in the test environment.

πŸ› οΈ To reproduce

https://github.com/AleksandrHovhannisyan/fontaine-131

🌈 Expected behaviour

The function should not return null. It's unclear why tests pass locally, but when I tried using fontaine@0.3.0 locally in my project, I was getting null no matter what I tried.

ℹ️ Additional context

No response

@michaeltaranto Sorry to bother you, but I was wondering if you have any thoughts on what could be causing this issue. Are you able to repro it on your end? I can repro on WSL and mac. The Node version doesn't seem to matter.

This is almost certainly an issue with fontaine rather than the upstream library. Let me take a look.

@danielroe That did the trick, thanks for the quick fix!