summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Crayford <tcrayford@googlemail.com>2017-01-10 13:58:54 +0000
committerJoe Wilm <jwilm@users.noreply.github.com>2017-01-12 21:19:40 -0800
commitf85cc353a68fa67b9ac7985c38412c103221e24d (patch)
treed51d411d1cd95fa5c8d30a15798a8e17b954089a /src
parent32cfca772798d13e9c96c5d66250f6ca5ae9baef (diff)
make thin stroke rendering configurable
Makes thin stroke rendering for darwin configurable by a new toplevel key under `font:` in the config file. Defaults to false, has no impact on non macos.
Diffstat (limited to 'src')
-rw-r--r--src/config.rs11
-rw-r--r--src/display.rs2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs
index e9cd505a..2665c3b3 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -890,6 +890,12 @@ impl Config {
self.render_timer
}
+ #[inline]
+ pub fn use_thin_strokes(&self) -> bool {
+ self.font.use_thin_strokes
+ }
+
+
pub fn path(&self) -> Option<&Path> {
self.config_path
.as_ref()
@@ -1034,6 +1040,9 @@ pub struct Font {
/// Extra spacing per character
offset: FontOffset,
+
+ #[serde(default="true_bool")]
+ use_thin_strokes: bool
}
fn default_bold_desc() -> FontDescription {
@@ -1082,6 +1091,7 @@ impl Default for Font {
bold: FontDescription::new_with_family("Menlo"),
italic: FontDescription::new_with_family("Menlo"),
size: Size::new(11.0),
+ use_thin_strokes: true,
offset: FontOffset {
x: 0.0,
y: 0.0
@@ -1098,6 +1108,7 @@ impl Default for Font {
bold: FontDescription::new_with_family("monospace"),
italic: FontDescription::new_with_family("monospace"),
size: Size::new(11.0),
+ use_thin_strokes: false,
offset: FontOffset {
// TODO should improve freetype metrics... shouldn't need such
// drastic offsets for the default!
diff --git a/src/display.rs b/src/display.rs
index 5aa3bac4..18ba33c5 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -148,7 +148,7 @@ impl Display {
println!("device_pixel_ratio: {}", dpr);
- let rasterizer = font::Rasterizer::new(dpi.x(), dpi.y(), dpr)?;
+ let rasterizer = font::Rasterizer::new(dpi.x(), dpi.y(), dpr, config.use_thin_strokes())?;
// Create renderer
let mut renderer = QuadRenderer::new(config, size)?;