[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ed7c6d6873: Enable subpixel antialiasing on the Cairo font driver
From: |
Po Lu |
Subject: |
master ed7c6d6873: Enable subpixel antialiasing on the Cairo font driver on Haiku |
Date: |
Wed, 5 Jan 2022 07:07:17 -0500 (EST) |
branch: master
commit ed7c6d687306a69cb31154e9251c6b1d8af62de5
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Enable subpixel antialiasing on the Cairo font driver on Haiku
* src/ftcrfont.c (ftcrfont_open): Manually enable subpixel
antialiasing on Haiku.
* src/haiku_support.cc
(get_subpixel_antialiasing): New function declaration.
(be_use_subpixel_antialising):
* src/haiku_support.h (be_use_subpixel_antialising): New
functions.
---
src/ftcrfont.c | 4 ++++
src/haiku_support.cc | 15 +++++++++++++++
src/haiku_support.h | 3 +++
3 files changed, 22 insertions(+)
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index 337e804b89..558e44d5b9 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -169,6 +169,10 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int
pixel_size)
cairo_matrix_init_scale (&font_matrix, pixel_size, pixel_size);
cairo_matrix_init_identity (&ctm);
cairo_font_options_t *options = cairo_font_options_create ();
+#ifdef USE_BE_CAIRO
+ if (be_use_subpixel_antialiasing ())
+ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL);
+#endif
cairo_scaled_font_t *scaled_font
= cairo_scaled_font_create (font_face, &font_matrix, &ctm, options);
cairo_font_face_destroy (font_face);
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 40f37d577e..2e9eff4067 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -112,6 +112,10 @@ static BLocker child_frame_lock;
static BLocker movement_locker;
+/* This could be a private API, but it's used by (at least) the Qt
+ port, so it's probably here to stay. */
+extern status_t get_subpixel_antialiasing (bool *);
+
extern "C"
{
extern _Noreturn void emacs_abort (void);
@@ -3043,3 +3047,14 @@ BWindow_is_active (void *window)
BWindow *w = (BWindow *) window;
return w->IsActive ();
}
+
+bool
+be_use_subpixel_antialiasing (void)
+{
+ bool current_subpixel_antialiasing;
+
+ if (get_subpixel_antialiasing (¤t_subpixel_antialiasing) != B_OK)
+ return false;
+
+ return current_subpixel_antialiasing;
+}
diff --git a/src/haiku_support.h b/src/haiku_support.h
index 550ebd0050..6a99eb245d 100644
--- a/src/haiku_support.h
+++ b/src/haiku_support.h
@@ -853,6 +853,9 @@ extern "C"
extern bool
BWindow_is_active (void *window);
+ extern bool
+ be_use_subpixel_antialiasing (void);
+
#ifdef __cplusplus
extern void *
find_appropriate_view_for_draw (void *vw);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master ed7c6d6873: Enable subpixel antialiasing on the Cairo font driver on Haiku,
Po Lu <=