cbrewster / brewcode

Brew(ster) code editor
MIT License
19 stars 3 forks source link

Add font-kit support #2

Open cbrewster opened 4 years ago

cbrewster commented 4 years ago

Continued from #1

Right now fonts are accessed via hard-coded paths. This is not portable, we should look into using fontkit.

rofrol commented 4 years ago

Plan

Remove usage of https://doc.rust-lang.org/std/macro.include_bytes.html with:

  1. Load system monospace font with font-kit.
  2. Convert it to wgpu_glyph::Font (compiler shows rusttype::Font).

Use this examples

Documentation

Other Examples

Concerns/Alternatives

On my Windows box, font-kit takes just over a minute to compile and over 800k release code size. That seems high for something that's just loading fonts, but on the other hand I don't see any good way to get this down.

cbrewster commented 4 years ago

I prefer to avoid adding large dependencies, but for now this is probably the easiest approach to get the editor much more portable. It may be worth revisiting this later as we probably won't be using everything font-kit has to offer.