Skip to main content

parse_msdf_metrics

Function parse_msdf_metrics 

Source
pub fn parse_msdf_metrics(
    json: &str,
    texture_id: u32,
) -> Result<MsdfFont, String>
Expand description

Parse MSDF font metrics from a JSON string (msdf-atlas-gen format).

Expected JSON format:

{
  "atlas": { "width": 256, "height": 256, "distanceRange": 4, "size": 32 },
  "metrics": { "lineHeight": 1.2 },
  "glyphs": [
    {
      "unicode": 65,
      "advance": 0.6,
      "atlasBounds": { "left": 0, "bottom": 32, "right": 24, "top": 0 },
      "planeBounds": { "left": 0, "bottom": -0.1, "right": 0.6, "top": 0.9 }
    }
  ]
}