From 6cb9fe9064a037224b6560b69b441b72e787fa94 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 19 Mar 2021 22:36:13 +0100 Subject: =?UTF-8?q?Text=20colors=20=F0=9F=A6=A9=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/exec/context.rs | 1 + src/exec/state.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/exec') diff --git a/src/exec/context.rs b/src/exec/context.rs index 311619cc..761977fc 100644 --- a/src/exec/context.rs +++ b/src/exec/context.rs @@ -178,6 +178,7 @@ impl<'a> ExecContext<'a> { font_size: self.state.font.font_size(), top_edge: self.state.font.top_edge, bottom_edge: self.state.font.bottom_edge, + color: self.state.font.color, } } diff --git a/src/exec/state.rs b/src/exec/state.rs index 6775f394..f66694fd 100644 --- a/src/exec/state.rs +++ b/src/exec/state.rs @@ -2,8 +2,9 @@ use std::rc::Rc; use fontdock::{fallback, FallbackTree, FontStretch, FontStyle, FontVariant, FontWeight}; +use crate::color::{Color, RgbaColor}; use crate::geom::*; -use crate::layout::VerticalFontMetric; +use crate::layout::{Fill, VerticalFontMetric}; use crate::paper::{Paper, PaperClass, PAPER_A4}; /// The evaluation state. @@ -115,6 +116,8 @@ pub struct FontState { /// Whether the emphasis toggle is active or inactive. This determines /// whether the next `_` makes italic or non-italic. pub emph: bool, + /// The glyph fill color / texture. + pub color: Fill, } impl FontState { @@ -149,6 +152,7 @@ impl Default for FontState { scale: Linear::ONE, strong: false, emph: false, + color: Fill::Color(Color::Rgba(RgbaColor::BLACK)), } } } -- cgit v1.2.3