mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
linux: fix wrong font selection
With the switch to font-kit for finding the best matching font we started to actually use the result of `load_font`, which, as it turns out, had a bug all along :) The problem was that `FontSystem::get_font_matches` *ignores* the family of the passed in attribute set, so the returned candidate set always always contained *all* fonts. This lead to a seemingly random font being selected. Signed-off-by: Niklas Wimmer <mail@nwimmer.me>
This commit is contained in:
parent
d5e0817fbc
commit
5003504031
@ -217,11 +217,17 @@ impl LinuxTextSystemState {
|
||||
_features: FontFeatures,
|
||||
) -> Result<SmallVec<[FontId; 4]>> {
|
||||
let mut font_ids = SmallVec::new();
|
||||
|
||||
let family = self
|
||||
.font_system
|
||||
.get_font_matches(Attrs::new().family(cosmic_text::Family::Name(name)));
|
||||
for font in family.as_ref() {
|
||||
let font = self.font_system.get_font(*font).unwrap();
|
||||
.db()
|
||||
.faces()
|
||||
.filter(|face| face.families.iter().any(|family| *name == family.0))
|
||||
.map(|face| face.id)
|
||||
.collect::<SmallVec<[_; 4]>>();
|
||||
|
||||
for font in family {
|
||||
let font = self.font_system.get_font(font).unwrap();
|
||||
if font.as_swash().charmap().map('m') == 0 {
|
||||
self.font_system.db_mut().remove_face(font.id());
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user