Checkpoint

This commit is contained in:
Nathan Sobo 2023-09-05 12:16:21 -06:00
parent 0307cb8a88
commit 9ec7569e09
10 changed files with 217 additions and 130 deletions

View file

@ -1,6 +1,6 @@
use crate::{
elements::AnyRootElement,
fonts::TextStyle,
fonts::{TextStyle, TextStyleRefinement},
geometry::{rect::RectF, Size},
json::ToJson,
keymap_matcher::{Binding, KeymapContext, Keystroke, MatchResult},
@ -235,6 +235,10 @@ impl<'a> WindowContext<'a> {
.push_back(Effect::RepaintWindow { window });
}
pub fn rem_size(&self) -> f32 {
16.
}
pub fn layout_engine(&mut self) -> Option<&mut LayoutEngine> {
self.window.layout_engines.last_mut()
}
@ -1284,8 +1288,14 @@ impl<'a> WindowContext<'a> {
.unwrap_or(TextStyle::default(&self.font_cache))
}
pub fn push_text_style(&mut self, style: TextStyle) {
pub fn push_text_style(&mut self, refinement: &TextStyleRefinement) -> Result<()> {
let mut style = self.text_style();
style.refine(refinement, self.font_cache())?;
dbg!(&style);
self.window.text_style_stack.push(style);
Ok(())
}
pub fn pop_text_style(&mut self) {