Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CSS Font Matching #58

Open
CryZe opened this issue Dec 28, 2022 · 1 comment
Open

Implement CSS Font Matching #58

CryZe opened this issue Dec 28, 2022 · 1 comment

Comments

@CryZe
Copy link
Contributor

CryZe commented Dec 28, 2022

cosmic-text currently implements a very basic 1:1 matching algorithm where if anything doesn't perfectly match, the font will never be chosen:

cosmic-text/src/attrs.rs

Lines 166 to 175 in b9fef72

pub fn matches(&self, face: &fontdb::FaceInfo) -> bool {
//TODO: smarter way of including emoji
face.post_script_name.contains("Emoji") ||
(
face.style == self.style &&
face.weight == self.weight &&
face.stretch == self.stretch &&
face.monospaced == self.monospaced
)
}

It should implement the CSS Fonts Module Level 3 - 5. Font Matching Algorithm.

Also it's super odd how Emoji is considered the fallback font and not the actual specified fallback font.

@CryZe
Copy link
Contributor Author

CryZe commented Dec 28, 2022

Oh looks like #48 covers this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant