forked from pool/emacs
64 lines
2.3 KiB
Diff
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 2023-08-01 07:10:18.292217247 +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 2023-08-01 06:57:06.034741701 +0000
|
|
@@ -58,6 +58,7 @@ typedef unsigned int CARD32;
|
|
#include <fontconfig/fontconfig.h>
|
|
#include "ftfont.h"
|
|
#elif defined HAVE_XFT
|
|
+#include <math.h>
|
|
#include <X11/Xft/Xft.h>
|
|
#endif
|
|
|
|
@@ -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)
|
|
{
|