Using a custom font in Scenic fails with `Unknown message: 0x38`

I’m trying to load a custom font like this:

    Scenic.Cache.Hash.compute(File.read!(@font_path), :sha) |> IO.inspect()
    Scenic.Cache.File.load(@font_path, @font_hash) |> IO.inspect()
    Scenic.Cache.File.read(@font_path, @font_hash) |> IO.inspect()

    graph =
      Graph.build(font: @font_hash, font_size: 24)

This is the output when using the font:

"cu1h9EqFbnBMyCyDDqtWtMh2lOw"
{:ok, "cu1h9EqFbnBMyCyDDqtWtMh2lOw"}
{:ok,
 <<0, 1, 0, 0, 0, 20, 1, 0, 0, 4, 0, 64, 71, 80, 79, 83, 39, 13, 154, 194, 0, 4,
   82, 12, 0, 0, 117, 60, 71, 83, 85, 66, 177, 57, 193, 22, 0, 4, 199, 72, 0, 0,
   0, 146, 76, 84, 83, 72, ...>>}
Unknown message: 0x38
WARNING Excess message bytes! 313343

So it looks like loading/reading the file works fine, but when I use it I get the error message.
It’s a ttf font.

Anyone got an idea what could be wrong?

I just tried this out myself and I am able to load the file into the cache without any seeming errors (TTF file). But I get the excess message bytes error trying to set the font on the graph

Heard from @boydm in Slack that this doesn’t work in 0.7.0 but it’ll be fixed in 0.8.0

let me know if it is fixed for you in 0.8 Definitely fixed a but there.

I am not guaranteeing that the font system is the end-all-be-all for every font. Won’t be surprised at all if there are some that simply fail.

2 Likes