Subject: bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font

From: martin rudalics <[email-masked]>
Date: Wed, 22 Oct 2014 15:43:01 +0200

> Under MS-Windows, it appears that the width of the frame only can be a
 > multiple of the character width. Unfortunately, the width of the fringes
 > and scrollbars used by side-by-side windows does not always add up to full
 > characters -- if you use a font other than the default. The effect is that
 > when using side-by-side windows, you could get a partial column. (Partial
 > columns are not desirable, for example, they work differently when you
 > place the cursor on the end of a full line.)

In order to obtain pixelwise resizing you have to set
`frame-resize-pixelwise' to a non-nil-value.  Please do that.

 > Steps to repeat 1:
 >      emacs -q
 >
 >      Switch to *scratch*: C-x b RET
 >
 >      Evaluate:
 >      (set-default-font
 >        (create-fontset-from-ascii-font
 >         "-raster-Terminal-bold-r-normal-normal-8-60-96-96-c-*-ms-oemlatin"))
 >
 >      Split the window using: C-x 3
 >
 >      Insert a long line: C-u 37 x
 >
 >      Here, the cursor is at the end of the line in the left window, it is
 > rendered in the right fringe. (OK)
 >
 >      Go to the other window: C-x o
 >
 >      Place the cursor at the end: C-x >
 >
 >      Here, the cursor is visible in the partially visible column. (NOT OK)

Sorry.  Such problems can't be avoided, even without fringes and scroll
bars, when the window size is not a multiple of the size of the default
font.  However, you can always calculate your "ideal" frame size based
on the number of side-by-side windows and the widths of the font, the
scroll bars and the fringes.  Provided `frame-resize-pixelwise' is
non-nil, `set-frame-width' should then make the frame fit this size.

 > Steps to repeat 2:
 >
 >      emacs -q
 >
 >       Evaluate the following:
 >
 >      (set-frame-width (selected-frame) 607 nil t)
 >      (frame-pixel-width)
 >
 >      Here, 632 is returned.
 >
 >      (set-frame-width (selected-frame) 608 nil t)
 >      (frame-pixel-width)
 >
 >      Here, 640 is returned. Clearly, the width of the frame is always a
 > multiple of the character width.

Here on windows XP doing

(setq frame-resize-pixelwise t)
(set-frame-width (selected-frame) 607 nil t)
(frame-text-width)

yields 607 and

(setq frame-resize-pixelwise t)
(set-frame-width (selected-frame) 608 nil t)
(frame-text-width)

yields 608, as expected.

martin