Bug 42785 - [PATCH] Support baseline-shift for images
Summary: [PATCH] Support baseline-shift for images
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: all
Hardware: All Mac OS X 10.4
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-30 08:05 UTC by Max Berger
Modified: 2012-04-01 06:51 UTC (History)
0 users



Attachments
baselineshift patch (5.98 KB, text/plain)
2007-06-30 08:06 UTC, Max Berger
Details
Updated patch which uses alignment-adjust (6.93 KB, text/plain)
2007-07-07 07:02 UTC, Max Berger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max Berger 2007-06-30 08:05:21 UTC
This patch adds support for image plugins to define their baseline-shift. Please note:
This may break existing image plugins, but recompilaton should be sufficient.
Comment 1 Max Berger 2007-06-30 08:06:18 UTC
Created attachment 20424 [details]
baselineshift patch

The actual patch file
Comment 2 Max Berger 2007-06-30 08:13:17 UTC
Some other comments while I am at it:

External graphic dimensions are specified in millipoints (int), where as inline-graphics are specified in pts (float). I have followed the same pattern for this patch, but find it quite inconsitent.
Comment 3 Vincent Hennebert 2007-07-05 01:41:43 UTC
(In reply to comment #2)

Hi Max,

Thanks for your patch. However, I'm slightly reluctant to apply it as 
is. I have a few questions:
- I can understand the need for an intrinsic baseline-shift for images, 
  especially if the image represents, say, a mathematical formula... 
  That said, in plain FO I think I would use the alignment-adjust 
  property (XSL-FO 1.1, 7.14.1). Now I easily understand that it would 
  be difficult to store this information separately from the image but, 
  still, shouldn't the image have an intrinsic alignment-adjust instead? 
  The description of alignment-adjust says that this property especially 
  applies to images which lack of a baseline-table. Whereas 
  baseline-shift recreates a whole baseline-table for the area. Granted, 
  this doesn't change many things but I think it would be more 
  consistent.
- IIC, the intrinsic baseline-shift may only be a length? Isn't that 
  limiting? If the image is scaled for whatever reason, then the length 
  no longer makes sense. A percentage would probably be more robust. 
  Especially if it's expressed in terms of the image's height. And guess 
  what, that's exactly the case with alignment-adjust.
  BTW, percentages are the reason why the other FOs return a Length 
  object for their baseline-shift.

> Some other comments while I am at it:
> 
> External graphic dimensions are specified in millipoints (int), where 
> as inline-graphics are specified in pts (float). I have followed the 
> same pattern for this patch, but find it quite inconsitent.

I'm not sure of what you are referring to? For both ExternalGraphic and 
InstreamForeignObject the intrinsic dimensions are specified in 
millipoints.

WDYT?
Thanks,
Vincent
Comment 4 Max Berger 2007-07-06 05:58:43 UTC
Vincent,

1) you are right, alignment-adjust seems a better attribute to use. I did some
tests with the foprep application (JEuclids MathML in FO preprocessor), and
using percentage values here seems to work fine.

2) I also have the feeling that I need to set "alignment-baseline" to
"alphabetic" as well (in the case of Math, but have it settable by the plugin),
but i am not sure about this, as I have no experience with non-latin languages,
and even less with non-latin languages and Math.

3) If i read the spec correctly, the values of baseline-shift and
alignment-adjust are in the opposite direction: So far I had to use a negative
baseline-shift, and i should use a positive alignment-adjust (my understanding
of the spec). However, during my tests I had to use a negative alignment-adjust,
suggesting that fop has a bug here. This needs further investigation.

4) The pt. vs. millipoint: What I was referring to is:
org/apache/fop/fo/flow/InstreamForeignObject.java and
org/apache/fop/fo/XMLObj,
which store dimensions using float in pt., where as
org/apache/fop/fo/flow/ExternalGraphic.java 
stores dimensions in "int" in millipoints. 
Both are fine with me, however, I think this is inconsistent and should be
unified rather sooner than later. However, changing this will definitely break
plugins, so it should be done as soon as possible!
Comment 5 Max Berger 2007-07-06 06:34:13 UTC
and yet another question:

5) when overwriting alignment adjust, there are two possibilities:
a) Retrieve set (from .fo file) alignment adjust, and add image-intrinsic
alignment-adjust
b) retrieve set alignment adjust. If it is auto (default if not set), then use
image-intrinsic alignment-adjust, otherwise use the one given from the user

I think b makes more sense, as the user will be able to explicitly overwrite the
automatic calculated alignment adjust. However, this behavior may be a little
irritating, as specifying a value at all (e.g. 0pt instead of auto) will already
make a difference.
Comment 6 Max Berger 2007-07-07 07:02:30 UTC
Created attachment 20475 [details]
Updated patch which uses alignment-adjust
Comment 7 Max Berger 2007-07-07 07:05:44 UTC
If updated the patch to use alignment-adjust instead of baseline-shift, as this is indeed a better solution.

in reply to my own comments:
1) done
2) this  defaults to baseline, which is good enough for my use.
3) I misread the spec. It was just unclearly written.
4) The issue still stands, for the patch I've used length exclusively, which does not have this problem
5) Strategy b) is used.
Comment 8 Andreas L. Delmelle 2007-07-08 12:49:57 UTC
Looked OK to me, so patch applied.

see: http://svn.apache.org/viewvc?view=rev&rev=554423

Thanks for the contribution!
Comment 9 Glenn Adams 2012-04-01 06:51:57 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed