unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font
@ 2014-10-22  9:03 Anders Lindgren
  2014-10-22 13:43 ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Anders Lindgren @ 2014-10-22  9:03 UTC (permalink / raw)
  To: 18789

[-- Attachment #1: Type: text/plain, Size: 4221 bytes --]

Hi!

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.)

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)

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.

See also my package https://github.com/Lindydancer/multicolumn -- I use it
to set up six side-by-side windows. (Note: As this writing, it is not
updated to work-around the above problems.)

Sincerely,
    Anders Lindgren (Long time Emacs contributor)




In GNU Emacs 24.4.1 (x86_64-w64-mingw32)
 of 2014-10-21 on KAEL
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/z/emacs --host=x86_64-w64-mingw32
 --target=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --with-wide-int
 --with-jpeg --with-xpm --with-png --with-tiff --with-rsvg --with-xml2
 --with-gnutls --with-xft --with-sound=yes --with-file-notification=yes
 --without-dbus --without-imagemagick 'CFLAGS=-Ofast
 -fomit-frame-pointer -funroll-loops -g0 -pipe' 'CPPFLAGS=-DNDEBUG
 -DDBUS_STATIC_BUILD' 'LDFLAGS=-static-libgcc -static-libstdc++ -static
 -s -Wl,-s''

Important settings:
  value of $LANG: SVE
  locale-coding-system: cp1252

Major mode: Fundamental

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

Recent input:
<escape> x r e p o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils help-mode easymenu time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)

Memory information:
((conses 16 75502 7207)
 (symbols 56 17532 0)
 (miscs 48 78 127)
 (strings 32 11014 5137)
 (string-bytes 1 283940)
 (vectors 16 9121)
 (vector-slots 8 376122 15963)
 (floats 8 55 70)
 (intervals 56 298 0)
 (buffers 960 14))

[-- Attachment #2: Type: text/html, Size: 5892 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font
  2014-10-22  9:03 bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font Anders Lindgren
@ 2014-10-22 13:43 ` martin rudalics
  2014-10-22 14:59   ` Eli Zaretskii
       [not found]   ` <CABr8ebbsGU4y6Se_uKbWJt-oWhrZ0vtXQQvjHdyOTzCE4Ct8nA@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: martin rudalics @ 2014-10-22 13:43 UTC (permalink / raw)
  To: Anders Lindgren, 18789

 > 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font
  2014-10-22 13:43 ` martin rudalics
@ 2014-10-22 14:59   ` Eli Zaretskii
       [not found]   ` <CABr8ebbsGU4y6Se_uKbWJt-oWhrZ0vtXQQvjHdyOTzCE4Ct8nA@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2014-10-22 14:59 UTC (permalink / raw)
  To: martin rudalics; +Cc: 18789, andlind

> Date: Wed, 22 Oct 2014 15:43:01 +0200
> From: martin rudalics <rudalics@gmx.at>
> 
>  >      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.

Moreover, the frame size after evaluating the
create-fontset-from-ascii-font form is odd, so "C-x 3" cannot possibly
create 2 windows of the same width.  And that is what you see: one
window has one pixel more in its width, so we show the corresponding
part of the cursor.  I don't see anything wrong with that.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font
       [not found]   ` <CABr8ebbsGU4y6Se_uKbWJt-oWhrZ0vtXQQvjHdyOTzCE4Ct8nA@mail.gmail.com>
@ 2015-01-04 18:10     ` martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2015-01-04 18:10 UTC (permalink / raw)
  To: Anders Lindgren; +Cc: 18789-done

 > In order to obtain pixelwise resizing you have to set
 >> `frame-resize-pixelwise' to a non-nil-value.  Please do that.
 >>
 >
 > Thanks! That solved my problem!

I've updated the docs for set-frame-size/-height-/width appropriately.
Closing this bug.

Thanks, martin





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-04 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22  9:03 bug#18789: 24.4; Can't resize frame pixelwise on w32, causing partial columns when using non-standard font Anders Lindgren
2014-10-22 13:43 ` martin rudalics
2014-10-22 14:59   ` Eli Zaretskii
     [not found]   ` <CABr8ebbsGU4y6Se_uKbWJt-oWhrZ0vtXQQvjHdyOTzCE4Ct8nA@mail.gmail.com>
2015-01-04 18:10     ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).