[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] misaligned image in a table
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Thu, 26 Aug 2010 10:41:38 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11324
- References: <871v9nszn5.fsf@xxxxxxxxxxxxxxxxxxx>
In [emacs-w3m : No.11323] Ćukasz Stelmach wrote:
> EHLO.
> I've found a very small (at least for me, at least now) problem with
> tables and images. Try to save and view the following HTML. The image is
> misaligned with its left edge being centered in the table instead of its
> center. Centering works fine for texts (the lowest row). Is it a bug or
> just a feature?
Here's a workaround, that's very poor though:
--8<---------------cut here---------------start------------->8---
(defun my-w3m-delete-indentation ()
"Delete every indentation in the `w3m-mode' buffer."
(interactive)
(let ((inhibit-read-only t))
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^[\t ]+" nil t)
(delete-region (match-beginning 0) (match-end 0))))))
--8<---------------cut here---------------end--------------->8---
(Do `M-x my-w3m-delete-indentation RET'. To restore the original
rendering, do `R'.)
The reason too much indentation happens is that we have no clue
as to the width of the image unless the img tag contains the width
attribute like this:
<img alt="Click on the title below to read the comic"
src="http://www.phdcomics.com/comics/archive/phd081310s.gif"
border="0" align="top" width="600" height="260"></img>
^^^^^^^^^^^
But as it is not passed to w3m, w3m processes the image as width=
"unknown" (actually width="0"). This is why the image begins at
the center of the Emacs frame. w3m, if it runs standalone, knows
the width of the image of course, but emacs-w3m doesn't have an
access to the image size that w3m examines. (w3m takes charge of
the page layout, and emacs-w3m takes charge of retrieving and
displaying images. Retrieving images is done after the page layout
is settled.)