You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "simon steiner (JIRA)" <ji...@apache.org> on 2018/08/31 10:38:00 UTC

[jira] [Commented] (FOP-2810) Incomplete implementation of the simulate-style flag

    [ https://issues.apache.org/jira/browse/FOP-2810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16598561#comment-16598561 ] 

simon steiner commented on FOP-2810:
------------------------------------

Can we see replication steps for issue

> Incomplete implementation of the simulate-style flag
> ----------------------------------------------------
>
>                 Key: FOP-2810
>                 URL: https://issues.apache.org/jira/browse/FOP-2810
>             Project: FOP
>          Issue Type: Bug
>          Components: font/unqualified
>    Affects Versions: 2.3
>            Reporter: Dan Caprioara
>            Priority: Major
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The CustomFont.getSimulateStyle() is used only in:
> {code:java}
> org.apache.fop.render.pdf.PDFPainter.drawTextWithDX(int, int, String, FontTriplet, int, int, int[])
> {code}
> But not in:
> {code:java}
> org.apache.fop.render.pdf.PDFPainter.drawTextWithDP(int, int, String, FontTriplet, int, int, int[][])
> {code}
> As a result some of the font styling is not applied.
> Modifying the above method with the following patch seem to fix the problem:
> {code:java}
> ...
>            boolean simulateStyle = tf instanceof CustomFont && ((CustomFont) tf).getSimulateStyle();
>             
>             // PATCH START 
>             // Taken from #drawTextWithDX method
>             double shear = 0;
>           
>             if (simulateStyle) {
>                 //Adding this breaks the PDF: generator.add("q\n")
>                 if (triplet.getWeight() == 700) {
>                     generator.add("2 Tr 0.31543 w\n");
>                 }
>                 if (triplet.getStyle().equals("italic")) {
>                     shear = 0.333;
>                 }
>             }
>             // PATCH END
>             tu.writeTextMatrix(new AffineTransform(1, 0, shear, -1, x / 1000f, y / 1000f));
>             tu.updateTf(fk, fsPoints, true);
>            generator.updateCharacterSpacing(letterSpacing / 1000f);
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)