From 70b78b68a851a07484804c5344181579718d265e Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Mon, 24 Jun 2024 02:36:27 +0300 Subject: [PATCH] style/font: use web font style The second String is not used anywhere so the Rust compiler will complain like below. The font-style is actually useful so let's set it. warning: field `1` is never read --> /home/adi/workspace/web/deps/plotters/plotters/src/style/font/web.rs:21:37 | 21 | pub struct FontDataInternal(String, String); | ---------------- ^^^^^^ | field in this struct | = note: `FontDataInternal` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 21 | pub struct FontDataInternal(String, ()); | ~~ warning: `plotters` (lib) generated 1 warning --- plotters/src/style/font/web.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotters/src/style/font/web.rs b/plotters/src/style/font/web.rs index e70e7b1a..7af99965 100644 --- a/plotters/src/style/font/web.rs +++ b/plotters/src/style/font/web.rs @@ -34,7 +34,7 @@ impl FontData for FontDataInternal { let body = document.body().unwrap(); let span = document.create_element("span").unwrap(); span.set_text_content(Some(text)); - span.set_attribute("style", &format!("display: inline-block; font-family:{}; font-size: {}px; position: fixed; top: 100%", self.0, size)).unwrap(); + span.set_attribute("style", &format!("display: inline-block; font-family:{}; font-style:{}; font-size: {}px; position: fixed; top: 100%", self.0, self.1, size)).unwrap(); let span = span.into(); body.append_with_node_1(&span).unwrap(); let elem = JsCast::dyn_into::(span).unwrap();