summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-29 13:21:25 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-29 13:28:19 +0200
commit2c6127dea611944abb09a0d38375ad7cf9baced0 (patch)
tree6572d169d4ce26edc38a880860ebae2f49639fb8 /src/layout
parent7d15dc634b3be1b6e284bb6b2450e3736d3e6e8d (diff)
Refactor state
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/par.rs4
-rw-r--r--src/layout/shaping.rs10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/layout/par.rs b/src/layout/par.rs
index 03d7efd5..a88a0f0b 100644
--- a/src/layout/par.rs
+++ b/src/layout/par.rs
@@ -5,7 +5,7 @@ use unicode_bidi::{BidiInfo, Level};
use xi_unicode::LineBreakIterator;
use super::*;
-use crate::exec::TextState;
+use crate::exec::FontState;
use crate::util::{EcoString, RangeExt, SliceExt};
type Range = std::ops::Range<usize>;
@@ -29,7 +29,7 @@ pub enum ParChild {
/// Spacing between other nodes.
Spacing(Length),
/// A run of text and how to align it in its line.
- Text(EcoString, Align, Rc<TextState>),
+ Text(EcoString, Align, Rc<FontState>),
/// Any child node and how to align it in its line.
Any(LayoutNode, Align),
}
diff --git a/src/layout/shaping.rs b/src/layout/shaping.rs
index 0cfb01a8..3ede5122 100644
--- a/src/layout/shaping.rs
+++ b/src/layout/shaping.rs
@@ -5,7 +5,7 @@ use std::ops::Range;
use rustybuzz::UnicodeBuffer;
use super::{Element, Frame, Glyph, LayoutContext, Text};
-use crate::exec::{LineState, TextState};
+use crate::exec::{FontState, LineState};
use crate::font::{Face, FaceId, FontVariant, LineMetrics};
use crate::geom::{Dir, Length, Point, Size};
use crate::layout::Geometry;
@@ -23,7 +23,7 @@ pub struct ShapedText<'a> {
/// The text direction.
pub dir: Dir,
/// The properties used for font selection.
- pub state: &'a TextState,
+ pub state: &'a FontState,
/// The font size.
pub size: Size,
/// The baseline from the top of the frame.
@@ -185,7 +185,7 @@ pub fn shape<'a>(
ctx: &mut LayoutContext,
text: &'a str,
dir: Dir,
- state: &'a TextState,
+ state: &'a FontState,
) -> ShapedText<'a> {
let mut glyphs = vec![];
if !text.is_empty() {
@@ -346,7 +346,7 @@ fn shape_segment<'a>(
fn measure(
ctx: &mut LayoutContext,
glyphs: &[ShapedGlyph],
- state: &TextState,
+ state: &FontState,
) -> (Size, Length) {
let mut width = Length::zero();
let mut top = Length::zero();
@@ -386,7 +386,7 @@ fn decorate(
pos: Point,
width: Length,
face_id: FaceId,
- state: &TextState,
+ state: &FontState,
) {
let mut apply = |substate: &LineState, metrics: fn(&Face) -> &LineMetrics| {
let metrics = metrics(ctx.fonts.get(face_id));