Skip to content

right align does not work properly if there is a "W" or a parenthesis in the text #2011

@bwl21

Description

@bwl21

Thank you for submitting an issue to jsPDF. Please read carefully.

Are you using the latest version of jsPDF?

using https://rawgit.com/MrRio/jsPDF/master/

Have you tried using jspdf.debug.js?

Steps to reproduce

Try with:

var doc = new jsPDF();

doc.text(10,10, "jspdf version " + jsPDF.version)

doc.setFont("helvetica");
doc.setFontType("bold");
doc.setFontSize(35)
doc.setFontStyle('bold')
doc.text(160,120, "aaaaa bbbbb cccc Wnnnnn\naaaa bbbb cccc nnnn", {align:'right'});
doc.text(160,150, "aaaaa bbbbb cccc wnnnnn\naaaa bbbb cccc nnnn", {align:'right'});
doc.text(160,180, "aaaaa bbbbb cccc wnnnnn\naaaa bbbb Wccc nnnn", {align:'right'});

doc.text(160, 40, ["...","III", "MMM", "M(M)M","M{i}M"],
{align:'right'})


doc.line(160, 0, 160, 190);

Ideally a link too. Try fork this http://jsbin.com/rilace/edit?html,js,output

What I saw

screenshot_1267

What I expected

In all cases the text lines should be right aligned properly.
But it is only the case if there is no "W".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions