summaryrefslogtreecommitdiffstats
path: root/font/src/darwin/mod.rs
diff options
context:
space:
mode:
authorJade Michael Thornton <jademichael@jmthornton.net>2020-06-04 15:24:09 -0500
committerGitHub <noreply@github.com>2020-06-04 20:24:09 +0000
commit1e32e5a5154a2e765ca0b3ab8e50e4c01bbe5d18 (patch)
tree84cc5c6339ea08185be8565e383729c960b4ff01 /font/src/darwin/mod.rs
parente6475c6753503da42446ec50fd2b797d5b89fe79 (diff)
Fix font rendering regression on macOS
This fixes a regression introduced in 77f2d6e853f1ad54e6dc844a811b78daeb463e76. Fixes #3809.
Diffstat (limited to 'font/src/darwin/mod.rs')
-rw-r--r--font/src/darwin/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs
index 2c8d238e..f754c997 100644
--- a/font/src/darwin/mod.rs
+++ b/font/src/darwin/mod.rs
@@ -515,8 +515,12 @@ impl Font {
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
);
+ let is_colored = self.is_colored();
+
// Set background color for graphics context.
- cg_context.set_rgb_fill_color(0.0, 0.0, 0.0, 0.0);
+ let bg_a = if is_colored { 0.0 } else { 1.0 };
+ cg_context.set_rgb_fill_color(0.0, 0.0, 0.0, bg_a);
+
let context_rect = CGRect::new(
&CGPoint::new(0.0, 0.0),
&CGSize::new(f64::from(rasterized_width), f64::from(rasterized_height)),
@@ -550,7 +554,7 @@ impl Font {
let rasterized_pixels = cg_context.data().to_vec();
- let buf = if self.is_colored() {
+ let buf = if is_colored {
BitmapBuffer::RGBA(byte_order::extract_rgba(&rasterized_pixels))
} else {
BitmapBuffer::RGB(byte_order::extract_rgb(&rasterized_pixels))