Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354121 - Positionning of text contained in svg files is not correct
Summary: Positionning of text contained in svg files is not correct
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Maggie Shen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-08 06:12 EDT by joel CLA
Modified: 2013-11-05 05:56 EST (History)
2 users (show)

See Also:


Attachments
svg file to import as an image (3.40 KB, text/plain)
2011-08-08 06:14 EDT, joel CLA
no flags Details
powitionning with birt (4.42 KB, application/pdf)
2011-08-08 06:15 EDT, joel CLA
no flags Details
correct positionning with Mozilla (564.90 KB, image/pjpeg)
2011-08-08 06:15 EDT, joel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description joel CLA 2011-08-08 06:12:52 EDT
Build Identifier: Build id: 20110615-0604

The psoittionning of texts contained in svg files is not correct.
In fact, it seems that birt doesn't take in account the flag
style="dominant-baseline: text-before-edge" which indicate  the positionning of the txt relatively to the position

I will join the foolowing parts:
1/ p1.svg ( the svg to test)
2/ new_report_birt.pdf ( the result in birt)
3/ mozilla.jpg : the visu when mozilla opens the svg ( correct positionning)


Reproducible: Always

Steps to Reproduce:
1.Create a simple birt project
2.add an image
3.select p1.svg file ( set the dimensions in mm to see better)
4.generate the pdf file
Comment 1 joel CLA 2011-08-08 06:14:14 EDT
Created attachment 201066 [details]
svg file to import as an image
Comment 2 joel CLA 2011-08-08 06:15:05 EDT
Created attachment 201067 [details]
powitionning with birt
Comment 3 joel CLA 2011-08-08 06:15:57 EDT
Created attachment 201068 [details]
correct positionning with Mozilla
Comment 4 vlad dev CLA 2013-11-05 03:40:08 EST
The issue is caused by the fact that the SVG feature set supported by Batik is limited. The following page shows what SVG features are supported: http://xmlgraphics.apache.org/batik/status.html

As you can read the "dominant-baseline" attribute is not supported for "svg:text" elements and texts are displayed with "dominant-baseline=alphabetic".

To overcome this issue, you would have to transform SVG files to replace "dominant-baseline=text-before-edge" by "dominant-baseline=alphabetic". Of course, you will have to recalculate coordinates of the text box to make the text appear at the same place. For that you will have to know the height of the font:
yShift = font ascent
Comment 5 vlad dev CLA 2013-11-05 05:56:31 EST
The following page describes how the "text-before-edge -> alphabetic" transformation could be performed:
http://stackoverflow.com/questions/14461735/dominant-baselinetext-before-edge-equivalent-dy-transformation