[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Inline Images Export Bug

From: Pip Cet
Subject: Re: [O] Inline Images Export Bug
Date: Wed, 26 Aug 2015 22:40:29 +0000

Okay, I just checked (sorry, had to regenerate the files and that took some time), and with the current version of Firefox the code I pasted is unnecessary.

The problem I had with previous Firefox versions is that those decided on a scale for displaying the SVG that differed from its preferred resolution, but only if an object tag was used for inclusion; img tags would use the preferred resolution and everything was fine.

The reason for the pt-to-px arithmetic is that graphviz outputs (or used to) SVGs with a preferred size specified in pt only, not in px. I'm not sure, but I think HTML pt and SVG pt don't necessarily agree.

Org mode is generating this tag:

<object type="image/svg+xml" data="" >
Sorry, your browser does not support SVG.</object>

Which looks okay to me. It's browser support that's the issue.

> The problems with the second bit of exported code is that it doesn't scale the image to fit the block with 50% width (only a small part of the image is visible)

Is it possible you're using an old browser? I'm on Iceweasel (Firefox) 38.1.0. (The bug was there a year or two ago, so by my standards it's a recent fix that we shouldn't rely on yet.)

> and you when you right click on the image, you can't view it, save it or anything.

Again, I can, using the "This Frame" popup menu.

But clearly that menu name is misleading and confusing in this case! And I think that is reason enough to stick with the img tag for now: Firefox users can't save the image unless they telepathically know that "frame" means "image". "This Object" might be okay, I guess.

My suggestion is to use img for images; that also appears to be the consensus on Stack Overflow. Let's find a good syntax for including interactive objects in Org mode, though.

On Wed, Aug 26, 2015 at 9:56 PM, Rasmus <address@hidden> wrote:

Pip Cet <address@hidden> writes:

>     let found = false;
>     for (let el of svgdoc.getElementsByTagName("svg")) {
>         let width = el.getAttribute("width");
>         let height = el.getAttribute("height");
>         let width_pt = width.match(/^([0-9]*)pt$/)[1];
>         let height_pt = height.match(/^([0-9]*)pt$/)[1];
>         let width_px = 5/4 * width_pt;
>         let height_px = 5/4 * height_pt;
>         object.setAttribute("width", width_px + "px");
>         object.setAttribute("height", height_px + "px");
>         found = true;

So are you saying that Org is changing the size from px to pt?  Can you
try to explain the problem you observe in words?


The second rule of Fight Club is: You do not talk about Fight Club

reply via email to

[Prev in Thread] Current Thread [Next in Thread]