Checkpoint

This commit is contained in:
Nathan Sobo 2023-09-20 12:03:37 -06:00
parent 83dae46ec6
commit 5b0e333967
16 changed files with 794 additions and 582 deletions

View file

@ -18,7 +18,11 @@ use core_graphics::{
};
use core_text::{font::CTFont, line::CTLine, string_attributes::kCTFontAttributeName};
use font_kit::{
handle::Handle, hinting::HintingOptions, metrics::Metrics, source::SystemSource,
handle::Handle,
hinting::HintingOptions,
metrics::Metrics,
properties::{Style as FontkitStyle, Weight as FontkitWeight},
source::SystemSource,
sources::mem::MemSource,
};
use parking_lot::RwLock;
@ -187,8 +191,8 @@ impl TextSystemState {
let idx = font_kit::matching::find_best_match(
&candidates,
&font_kit::properties::Properties {
style,
weight,
style: style.into(),
weight: weight.into(),
stretch: Default::default(),
},
)?;
@ -589,6 +593,22 @@ impl From<Vector2F> for Size<f32> {
}
}
impl From<FontWeight> for FontkitWeight {
fn from(value: FontWeight) -> Self {
FontkitWeight(value.0)
}
}
impl From<FontStyle> for FontkitStyle {
fn from(style: FontStyle) -> Self {
match style {
FontStyle::Normal => FontkitStyle::Normal,
FontStyle::Italic => FontkitStyle::Italic,
FontStyle::Oblique => FontkitStyle::Oblique,
}
}
}
// #[cfg(test)]
// mod tests {
// use super::*;