Subject: bug#1867: Resizing window causes text flickering when using antialiased font on X

From: Bo Lin <[email-masked]>
Date: Mon, 12 Jan 2009 18:10:07 +0800

1. Choose a font FONTNAME which supports antialiasing. Confirm
antialiasing is turned on for FONTNAME in fontconfig:

$ fc-match -v FONTNAME |grep antialias
	antialias: FcTrue(w)

2. emacs -q
3. M-: (set-face-attribute 'default nil :font "FONTNAME")
4. C-x 3 C-x 2

Now there are three windows. We'll name the upper-left window 1,
lower-left window 2, and the right window 3.

5. C-x b *scratch* RET C-x o C-x b *Messages* RET C-x o C-h i
6. Using mouse, quickly drag mode-line of window 1 up and down.

Observe how text in window 1 and 3 flicker as windows 1 and 2 are
resized. The main point is that window 3, though totally unaffected by
the resizing of windows 1 and 2 and showing a different buffer, is still
been constantly redrawn. This quite annoying, as even when the
mini-buffer window resizes, which happens quite frequently, will cause
the whole frame to flicker.

This flickering does *not* occur if using old X core fonts. To confirm,
start with `emacs -q -fn fixed' and repeat steps 4-6.

This flickering does *not* occur if using same XFT font but antialiasing
turned off. To confirm, turn antialiasing off for FONTNAME in
fontconfig, for example by putting the following in ~/.fonts.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="antialias" mode="assign"><bool>false</bool></edit>
  </match>
</fontconfig>

and again confirm by 

$ fc-match -v FONTNAME |grep antialias
	antialias: FcFalse(w)

then repeat steps 2-6.

This flickering does not occur in other XFT applications, such as gedit,
using same font with antialias enabled. Flickering also does not occur
in Emacs on Windows when using antialiased (cleartype) fonts.

In GNU Emacs 23.0.60.7 (i686-pc-linux-gnu, GTK+ Version 2.14.4)
 of 2009-01-12 on unicorn
Windowing system distributor `The X.Org Foundation', version 11.0.10502000
configured using `configure  '--prefix=/home/sadboy/apps/emacs/test' 'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=SCIM
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x 3 C-x 2 <help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-movement> <help-echo> <mouse-movement> <mouse-movement> 
<mouse-movement> <help-echo> <mouse-movement> <help-echo> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<help-echo> <mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <help-echo> <help-echo> 
<mouse-movement> <help-echo> <mouse-movement> <mouse-movement> 
<help-echo> <mouse-movement> <help-echo> <mouse-movement> 
<mouse-movement> <mouse-movement> <help-echo> <mouse-movement> 
<help-echo> <mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> C-u C-x = C-v C-l C-p C-n C-e 
C-a C-e C-a C-x 0 C-x b * M e s s <tab> <return> C-x 
o C-x 2 <help-echo> <down-mouse-1> <mouse-movement> 
<help-echo> <mouse-movement> <mouse-movement> <mouse-movement> 
<help-echo> <help-echo> <mouse-movement> <mouse-movement> 
<mouse-movement> <help-echo> <mouse-movement> <mouse-movement> 
<help-echo> <mouse-movement> <mouse-movement> <help-echo> 
<mouse-movement> <mouse-movement> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <mouse-movement> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <mouse-movement> 
<mouse-movement> <help-echo> <mouse-movement> <mouse-movement> 
<help-echo> <help-echo> <help-echo> <mouse-movement> 
<help-echo> <mouse-movement> <help-echo> <help-echo> 
<help-echo> <help-echo> <mouse-movement> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<help-echo> <help-echo> <help-echo> <mouse-movement> 
<help-echo> <help-echo> <mouse-movement> <mouse-movement> 
<help-echo> <mouse-movement> <help-echo> <help-echo> 
<mouse-movement> <mouse-movement> <help-echo> <mouse-movement> 
<help-echo> <help-echo> <help-echo> <mouse-movement> 
<mouse-movement> <mouse-movement> <help-echo> <help-echo> 
<mouse-movement> <help-echo> <mouse-movement> <mouse-movement> 
<help-echo> <mouse-movement> <help-echo> <mouse-movement> 
<mouse-movement> <mouse-movement> <help-echo> <help-echo> 
<mouse-movement> <mouse-movement> <help-echo> <help-echo> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <help-echo> <help-echo> M-x r e p o 
r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Type "q" to restore this window, C-v to scroll help.
Char: E (69, #o105, #x45) point=77 of 798 (10%) column=0