From 02dc29d18a7b67edf0eaa5d125be22eec6cfebb7 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 6 Feb 2020 11:15:48 +0100 Subject: =?UTF-8?q?Highlight=20bold=20/=20italic=20/=20monospace=20?= =?UTF-8?q?=F0=9F=8E=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 7136b2bd..4a92d096 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,6 +65,8 @@ pub struct Typesetter { style: LayoutStyle, /// The standard library scope. scope: Scope, + /// Whether to render debug boxes. + debug: bool, } /// The font loader type used in the [`Typesetter`]. @@ -83,6 +85,7 @@ impl Typesetter { loader: RefCell::new(FontLoader::new(provider)), style: LayoutStyle::default(), scope: Scope::with_std(), + debug: false, } } @@ -96,6 +99,11 @@ impl Typesetter { self.style.page = style; } + /// Set whether to render debug boxes. + pub fn set_debug(&mut self, debug: bool) { + self.debug = debug; + } + /// A reference to the backing font loader. pub fn loader(&self) -> &GlobalFontLoader { &self.loader @@ -126,7 +134,7 @@ impl Typesetter { axes: LayoutAxes::new(LeftToRight, TopToBottom), alignment: LayoutAlignment::new(Origin, Origin), nested: false, - debug: false, + debug: self.debug, }, ).await } -- cgit v1.2.3