Chlumsky / msdf-atlas-gen

MSDF font atlas generator
MIT License
783 stars 175 forks source link

Wrong Atlas Bounds #104

Closed HITOA closed 3 months ago

HITOA commented 3 months ago

Hi! I tried using msdf atlas gen, producing the atlas image and the atlas layout in a json. But the atlasBounds in the json are wrong? I compiled the tool without vcpkg and without skia, i'm on linux (nixos). To be sure that the atlasBounds for a given glyph was wrong i checked manually. The coordinate are valid, and the AR seems correct. It's just at the wrong place on the atlas. I would like to give more detail but it doesn't produce any log, error msg, or anything similar.

Here is the information for the glyph of the letter 'A' (65)

{
  "unicode": 65,
  "advance": 0.543,
  "planeBounds": {
    "left": -0.039890838206627706,
    "bottom": -0.04678362573099415,
    "right": 0.5838908382066277,
    "top": 0.7017543859649124
  },
  "atlasBounds": {
    "left": 49.5,
    "bottom": 80.5,
    "right": 69.5,
    "top": 104.5
  }
}

Here is the corresponding atlas : ss3r

Any hint or stuff to try and fix that is very wellcome. Thanks!

Chlumsky commented 3 months ago

It's not wrong, it's just measured from the bottom. If you prefer top-down coordinates, use -yorigin top.