Subject: Re: bug#12506: 24.2.50; Docview shrinks width to fit screen

From: Ivan Andrus <[email-masked]>
Date: Tue, 25 Sep 2012 15:14:41 +0200

On Sep 25, 2012, at 10:39 AM, Tassilo Horn wrote:

> Ivan Andrus <[email-masked]> writes:
> 
>> I occasionally use doc-view-mode to read pdfs.  I have noticed that if
>> the window is skinnier than the width of the pdf then the width is
>> shrunk so that it all fits.  However, the height is not affected.
>> This leads to "squished" text which is unreadable.
>> 
>> To see the effect:
>> 
>> 1. emacs -Q
>> 2. open a pdf in doc-view-mode
>> 3. type "W" for `doc-view-fit-width-to-window'
>> 4. C-x 3 to split the window
>> 5. You now have a squished picture.
>> 
>> I think it should not scale the width at all (and it did not use to).
>> It makes zooming in impossible.  Especially it should not scale the
>> width without scaling the height.
> 
> I can't reproduce that on a GNU/Linux box.  After step 3, the image fits
> exactly the width of the emacs window and the height is set correctly to
> keep the aspect ratio.  After step 4, I have two side-by-side windows,
> each showing about the left half of the image, but no squishing.

Perhaps it's a NextStep only problem.

> Have you compiled emacs with ImageMagick support?  I guess so, because
> else doc-view would fall back to reconversion with any zooming command.
> So let's assume you have ImageMagick support, could you please evaluate
> 
>  ;; That's basically what doc-view with ImageMagic does when
>  ;; fitting/zooming
>  (insert-image
>   (create-image "/some/image.png"
> 	         'imagemagick nil :width 100))
> 
> and play a bit with the width parameter?  In any case, the image should
> keep its original aspect ratio.

I'm pretty sure I don't have it with ImageMagick support.  The above gives me an error, and the configure logs confirm this.

> ,----[ (info "(elisp)ImageMagick Images") ]
> | `:width, :height'
> |      The `:width' and `:height' keywords are used for scaling the
> |      image.  If only one of them is specified, the other one will be
> |      calculated so as to preserve the aspect ratio.  If both are
> |      specified, aspect ratio may not be preserved.
> `----
> 
> If you don't have ImageMagick support, could you check if just finding
> some png image with image-mode and then splitting has the same squish
> effect?

I also see the same problem with a jpeg in image mode.  I should have checked that first, sorry.  Of course, I can't scale the image, but the squishing definitely occurs.

-Ivan