For the simplest case of " " words, a quick binary search in
`supported` vec will suffice, instead of using `slice::contains()`
for all monospace fonts, where some of them may support thousands of
codepoints.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
When matching on weights smaller than normal, "equal or smaller"
weight restriction may cause monospace fallback to fail, depending
on font support at such weights for the text to be shaped.
So remove that restriction, and calculate weight differences instead
of offsets.
In case of no exact weight match, and with all other factors being
equal, smaller weights will be picked before bigger ones. So, this
should generally not cause any behavioral changes when matching on
normal weight or bigger.
Should fixpop-os/cosmic-term#104.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This should/could improve fallback order.
This could also probably be utilized for non-Monospace fallback too.
But I didn't want to touch that code to avoid accidentally breaking
anything.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
A combination of some ideas:
* Try all Monospace fonts before giving up.
* Relax exact weight restriction on font matching when trying Monospace
fall-back. Try smaller weights if needed.
* Make the fall-back try order weight-offset aware, AND script-aware.
* And finally, add the option to adjust the font size of glyphs using
fall-back Monospace fonts, so the width of them matches the default
font width.
For my use-case, the current fall-back attempt always fails with
Arabic script. And none of the Arabic-supporting Monospace fonts in
my system also support medium weight. So, if my default font is set
to medium weight, script-aware fall-back alone will still not work.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit adds a new ShapeBuffer type, which contains some buffers tha
are commonly re-created during the shaping process. New APIs are added
that take this structure, and old APIs are turned into wrappers around
the new API.
The goal is to reduce the number of per-layout allocations that happen
in a typical layout call.
* WIP VI wrapper for editor
* WIP: block cursor
* Create Edit trait, run CI on all feature options
* Add prints describing build steps to ci.sh
* Custom rendering for Vi editor
* Clippy fixes
* More clippy fixes
* Show clippy results in CI
* Fix for Redox
* Fix clippy lint
* Add vi feature to enable vi-style editor
* Add escape to libcosmic text box