[jira] [Updated] (FOP-3135) [PATCH] SVG tspan content is displayed out of place
[ https://issues.apache.org/jira/browse/FOP-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] João André Gonçalves updated FOP-3135: -- Attachment: batik.patch fop.patch commons.patch > [PATCH] SVG tspan content is displayed out of place > --- > > Key: FOP-3135 > URL: https://issues.apache.org/jira/browse/FOP-3135 > Project: FOP > Issue Type: Bug > Components: image/svg >Reporter: Julien Lacour >Assignee: Simon Steiner >Priority: Minor > Attachments: MI-Calibri-test.pdf, MI-out-patch.pdf, MI-out.pdf, > MI-test.fo, MI-tspan.svg, MI.patch, WIP-out.pdf, WIP.patch, batik.patch, > commons.patch, fop.patch, tspan.svg > > > We have found an issue in FOP when transforming PDFs with SVGs containing > with multiple @x and/or @y attributes values. > The problem is located in > org.apache.fop.svg.PDFTextPainter.writeGlyphs(FOPGVTGlyphVector, > GeneralPath), the positions given by x and y are never used when set. > A possible fix for this issue is the following: > {code:java} > for (int i = 0, n = gv.getNumGlyphs(); i < n; i++) { > int gc = gv.getGlyphCode(i); > int[] pa = ((i > dp.length) || (dp[i] == null)) ? > paZero : dp[i]; > if (gv.getGlyphPosition(i) != null) { > Point2D gp = gv.getGlyphPosition(i); > double x= gp.getX() - initialPos.getX(); > double y= -(gp.getY() - initialPos.getY()); > double xd = x - xoLast; > double yd = y - yoLast; > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc = x + pa[2]; > yc = y + pa[3]; > xoLast = x; > yoLast = y; > } else { > double xo = xc + pa[0]; > double yo = yc + pa[1]; > double xa = f.getWidth(gc); > double ya = 0; > double xd = (xo - xoLast) / 1000f; > double yd = (yo - yoLast) / 1000f; > > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc += xa + pa[2]; > yc += ya + pa[3]; > xoLast = xo; > yoLast = yo; > } > } > {code} > I also attached an example for testing, it can be opened in Batik for > comparison. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FOP-3135) [PATCH] SVG tspan content is displayed out of place
[ https://issues.apache.org/jira/browse/FOP-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] João André Gonçalves updated FOP-3135: -- Attachment: (was: svgBatik.patch) > [PATCH] SVG tspan content is displayed out of place > --- > > Key: FOP-3135 > URL: https://issues.apache.org/jira/browse/FOP-3135 > Project: FOP > Issue Type: Bug > Components: image/svg >Reporter: Julien Lacour >Assignee: Simon Steiner >Priority: Minor > Attachments: MI-Calibri-test.pdf, MI-out-patch.pdf, MI-out.pdf, > MI-test.fo, MI-tspan.svg, MI.patch, WIP-out.pdf, WIP.patch, batik.patch, > commons.patch, fop.patch, tspan.svg > > > We have found an issue in FOP when transforming PDFs with SVGs containing > with multiple @x and/or @y attributes values. > The problem is located in > org.apache.fop.svg.PDFTextPainter.writeGlyphs(FOPGVTGlyphVector, > GeneralPath), the positions given by x and y are never used when set. > A possible fix for this issue is the following: > {code:java} > for (int i = 0, n = gv.getNumGlyphs(); i < n; i++) { > int gc = gv.getGlyphCode(i); > int[] pa = ((i > dp.length) || (dp[i] == null)) ? > paZero : dp[i]; > if (gv.getGlyphPosition(i) != null) { > Point2D gp = gv.getGlyphPosition(i); > double x= gp.getX() - initialPos.getX(); > double y= -(gp.getY() - initialPos.getY()); > double xd = x - xoLast; > double yd = y - yoLast; > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc = x + pa[2]; > yc = y + pa[3]; > xoLast = x; > yoLast = y; > } else { > double xo = xc + pa[0]; > double yo = yc + pa[1]; > double xa = f.getWidth(gc); > double ya = 0; > double xd = (xo - xoLast) / 1000f; > double yd = (yo - yoLast) / 1000f; > > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc += xa + pa[2]; > yc += ya + pa[3]; > xoLast = xo; > yoLast = yo; > } > } > {code} > I also attached an example for testing, it can be opened in Batik for > comparison. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FOP-3135) [PATCH] SVG tspan content is displayed out of place
[ https://issues.apache.org/jira/browse/FOP-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] João André Gonçalves updated FOP-3135: -- Attachment: (was: fop.patch) > [PATCH] SVG tspan content is displayed out of place > --- > > Key: FOP-3135 > URL: https://issues.apache.org/jira/browse/FOP-3135 > Project: FOP > Issue Type: Bug > Components: image/svg >Reporter: Julien Lacour >Assignee: Simon Steiner >Priority: Minor > Attachments: MI-Calibri-test.pdf, MI-out-patch.pdf, MI-out.pdf, > MI-test.fo, MI-tspan.svg, MI.patch, WIP-out.pdf, WIP.patch, batik.patch, > commons.patch, fop.patch, tspan.svg > > > We have found an issue in FOP when transforming PDFs with SVGs containing > with multiple @x and/or @y attributes values. > The problem is located in > org.apache.fop.svg.PDFTextPainter.writeGlyphs(FOPGVTGlyphVector, > GeneralPath), the positions given by x and y are never used when set. > A possible fix for this issue is the following: > {code:java} > for (int i = 0, n = gv.getNumGlyphs(); i < n; i++) { > int gc = gv.getGlyphCode(i); > int[] pa = ((i > dp.length) || (dp[i] == null)) ? > paZero : dp[i]; > if (gv.getGlyphPosition(i) != null) { > Point2D gp = gv.getGlyphPosition(i); > double x= gp.getX() - initialPos.getX(); > double y= -(gp.getY() - initialPos.getY()); > double xd = x - xoLast; > double yd = y - yoLast; > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc = x + pa[2]; > yc = y + pa[3]; > xoLast = x; > yoLast = y; > } else { > double xo = xc + pa[0]; > double yo = yc + pa[1]; > double xa = f.getWidth(gc); > double ya = 0; > double xd = (xo - xoLast) / 1000f; > double yd = (yo - yoLast) / 1000f; > > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc += xa + pa[2]; > yc += ya + pa[3]; > xoLast = xo; > yoLast = yo; > } > } > {code} > I also attached an example for testing, it can be opened in Batik for > comparison. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FOP-3135) [PATCH] SVG tspan content is displayed out of place
[ https://issues.apache.org/jira/browse/FOP-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] João André Gonçalves updated FOP-3135: -- Attachment: (was: svgCommon.patch) > [PATCH] SVG tspan content is displayed out of place > --- > > Key: FOP-3135 > URL: https://issues.apache.org/jira/browse/FOP-3135 > Project: FOP > Issue Type: Bug > Components: image/svg >Reporter: Julien Lacour >Assignee: Simon Steiner >Priority: Minor > Attachments: MI-Calibri-test.pdf, MI-out-patch.pdf, MI-out.pdf, > MI-test.fo, MI-tspan.svg, MI.patch, WIP-out.pdf, WIP.patch, fop.patch, > svgBatik.patch, tspan.svg > > > We have found an issue in FOP when transforming PDFs with SVGs containing > with multiple @x and/or @y attributes values. > The problem is located in > org.apache.fop.svg.PDFTextPainter.writeGlyphs(FOPGVTGlyphVector, > GeneralPath), the positions given by x and y are never used when set. > A possible fix for this issue is the following: > {code:java} > for (int i = 0, n = gv.getNumGlyphs(); i < n; i++) { > int gc = gv.getGlyphCode(i); > int[] pa = ((i > dp.length) || (dp[i] == null)) ? > paZero : dp[i]; > if (gv.getGlyphPosition(i) != null) { > Point2D gp = gv.getGlyphPosition(i); > double x= gp.getX() - initialPos.getX(); > double y= -(gp.getY() - initialPos.getY()); > double xd = x - xoLast; > double yd = y - yoLast; > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc = x + pa[2]; > yc = y + pa[3]; > xoLast = x; > yoLast = y; > } else { > double xo = xc + pa[0]; > double yo = yc + pa[1]; > double xa = f.getWidth(gc); > double ya = 0; > double xd = (xo - xoLast) / 1000f; > double yd = (yo - yoLast) / 1000f; > > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc += xa + pa[2]; > yc += ya + pa[3]; > xoLast = xo; > yoLast = yo; > } > } > {code} > I also attached an example for testing, it can be opened in Batik for > comparison. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Updated] (FOP-3135) [PATCH] SVG tspan content is displayed out of place
[ https://issues.apache.org/jira/browse/FOP-3135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Simon Steiner updated FOP-3135: --- Summary: [PATCH] SVG tspan content is displayed out of place (was: [PATCH] SVG content is displayed out of place) > [PATCH] SVG tspan content is displayed out of place > --- > > Key: FOP-3135 > URL: https://issues.apache.org/jira/browse/FOP-3135 > Project: FOP > Issue Type: Bug > Components: image/svg >Reporter: Julien Lacour >Assignee: Simon Steiner >Priority: Minor > Attachments: MI-Calibri-test.pdf, MI-out-patch.pdf, MI-out.pdf, > MI-test.fo, MI-tspan.svg, MI.patch, WIP-out.pdf, WIP.patch, fop.patch, > svgBatik.patch, svgCommon.patch, tspan.svg > > > We have found an issue in FOP when transforming PDFs with SVGs containing > with multiple @x and/or @y attributes values. > The problem is located in > org.apache.fop.svg.PDFTextPainter.writeGlyphs(FOPGVTGlyphVector, > GeneralPath), the positions given by x and y are never used when set. > A possible fix for this issue is the following: > {code:java} > for (int i = 0, n = gv.getNumGlyphs(); i < n; i++) { > int gc = gv.getGlyphCode(i); > int[] pa = ((i > dp.length) || (dp[i] == null)) ? > paZero : dp[i]; > if (gv.getGlyphPosition(i) != null) { > Point2D gp = gv.getGlyphPosition(i); > double x= gp.getX() - initialPos.getX(); > double y= -(gp.getY() - initialPos.getY()); > double xd = x - xoLast; > double yd = y - yoLast; > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc = x + pa[2]; > yc = y + pa[3]; > xoLast = x; > yoLast = y; > } else { > double xo = xc + pa[0]; > double yo = yc + pa[1]; > double xa = f.getWidth(gc); > double ya = 0; > double xd = (xo - xoLast) / 1000f; > double yd = (yo - yoLast) / 1000f; > > textUtil.writeTd(xd, yd); > textUtil.writeTj((char) gc, true, false); > xc += xa + pa[2]; > yc += ya + pa[3]; > xoLast = xo; > yoLast = yo; > } > } > {code} > I also attached an example for testing, it can be opened in Batik for > comparison. -- This message was sent by Atlassian Jira (v8.20.10#820010)