[tex4ht] [bug #254] tex4ht breaks

Michal Hoftich michal.h21 at gmail.com
Wed Jun 10 12:03:32 CEST 2015


>
> This example gives me two images with identical size. The same is true if I replace film.jpg with film.png
>
> Simon
>
>

This seems like something not easily fixable, look at the generated content:

 <draw:frame draw:name="film.jpg" text:anchor-type="as-char"
        draw:z-index="0" svg:width="41pt" svg:height="41pt">
          <draw:image xlink:href="Pictures/film.jpg"
          xlink:type="simple" xlink:show="embed"
          xlink:actuate="onLoad" svg:width="64.23999pt"
          svg:height="64.23999pt" />
          <!--draw:name="IMG"
svg:width="64.23999pt" svg:height="64.23999pt"
-->
        </draw:frame>

and scaled image:

  <draw:frame draw:name="film.jpg" text:anchor-type="as-char"
        draw:z-index="0" svg:width="41pt" svg:height="41pt">
          <draw:image xlink:href="Pictures/film.jpg"
          xlink:type="simple" xlink:show="embed"
          xlink:actuate="onLoad" svg:width="128.47998pt"
          svg:height="128.47998pt" />
          <!--draw:name="IMG"
svg:width="128.47998pt" svg:height="128.47998pt"
-->
        </draw:frame>

as you can see, correct values of svg:width and svg:height are set for
draw:image element, but parent draw:frame has them set to `41pt` in
both cases, and it is the size at which images are displayed. This
size was set using xtpipes, I've found Java snippet probably
responsible for this:

\<set dimensions of figures\><<<
String name = attr.getValue("draw:name");
if( (name != null)
    && (attr.getValue("svg:width") == null)
    && (attr.getValue("svg:height") == null)
){
  java.awt.Image image = new javax.swing.ImageIcon(name).getImage();
  int width = image.getWidth(null);
  int height = image.getHeight(null);
  if( (width>0) && (height>0) ){
     org.xml.sax.helpers.AttributesImpl attrs =
                   new  org.xml.sax.helpers.AttributesImpl( attr );
     attrs.addAttribute(null, "svg:width", "svg:width",
                                 "String", (width * 72 / 110) + "pt");
     attrs.addAttribute(null, "svg:width", "svg:height",
                                 "String", (height * 72 / 110) + "pt");
     attr = attrs;
} }
>>>

as I read it, it seems that it can't read values of `svg:width` and
`svg:height` from `draw:name` so it calculates them from real image
size. I don't understand the calculation `(width * 72 / 110)`, but it
clearly produces wrong result (41pt vs 64pt). This of course can't
know anything about scale attribute at the LaTeX side.

The problem is that only person which understand xtpipes was Eitan, it
is his own invention and it is not documented anywhere. It is mixture
of xslt and Java code and it is unlikely that we can fix it.

Michal


More information about the tex4ht mailing list