SHA256
1
0
forked from pool/emacs
emacs/emacs-25.1-custom-fonts.patch

64 lines
2.3 KiB
Diff

Work around openSUSE bug #1016172
---
lisp/dynamic-setting.el | 12 ++++++++----
src/xsettings.c | 7 ++++++-
2 files changed, 14 insertions(+), 5 deletions(-)
--- lisp/dynamic-setting.el
+++ lisp/dynamic-setting.el 2024-04-11 06:03:25.603986456 +0000
@@ -33,6 +33,7 @@
;;; Customizable variables
(declare-function font-get-system-font "xsettings.c" ())
+(declare-function font-face-attributes "font.c" (font &optional frame))
(defvar font-use-system-font)
@@ -42,15 +43,18 @@ If DISPLAY-OR-FRAME is a frame, the disp
If SET-FONT is non-nil, change the font for frames. Otherwise re-apply
the current form for the frame (i.e. hinting or somesuch changed)."
- (let ((new-font (and (fboundp 'font-get-system-font)
+ (let ((system-font (and (fboundp 'font-get-system-font)
(font-get-system-font)))
- (frame-list (frames-on-display-list display-or-frame)))
- (when (and new-font (display-graphic-p display-or-frame))
+ (frame-list (frames-on-display-list display-or-frame))
+ (user-font (face-attribute 'default :font)))
+ (when (and system-font (display-graphic-p display-or-frame))
(clear-font-cache)
(if set-font
;; Set the font on all current and future frames, as though
;; the `default' face had been "set for this session":
- (set-frame-font new-font nil frame-list)
+ (if (not user-font)
+ (set-frame-font system-font nil frame-list)
+ (set-frame-font user-font nil frame-list))
;; Just reconsider the existing fonts on all frames on each
;; display, by clearing the font and face caches. This will
;; cause all fonts to be recreated.
--- src/xsettings.c
+++ src/xsettings.c 2024-04-11 06:04:36.790667318 +0000
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http
#include <float.h>
#include <limits.h>
+#include <math.h>
#include <fcntl.h>
#include <byteswap.h>
@@ -839,7 +840,11 @@ apply_xft_settings (Display_Info *dpyinf
#endif
FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &oldsettings.lcdfilter);
FcPatternGetInteger (pat, FC_RGBA, 0, &oldsettings.rgba);
- FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi);
+
+ if (FcPatternGetDouble (pat, FC_DPI, 0, &oldsettings.dpi) == FcResultMatch)
+ {
+ oldsettings.dpi = round(oldsettings.dpi);
+ }
if ((settings->seen & SEEN_AA) != 0 && oldsettings.aa != settings->aa)
{