Skip to content

lineHeightFactor is ignored if specified as a text option  #3234

Closed
@novsstation

Description

@novsstation

Currently lineHeightFactor is ignored, if it is specified as text option.
It correctly checked for calculating lineHeight variable.
But this variable is not used for calculating descent value (still used global lineHeightFactor from document).
As result, those two options produces the different PDF files

https://github.com/MrRio/jsPDF/blob/cef97fb34eda41a8704c9f3983e680919a328ce4/src/jspdf.js#L3612

Steps to reproduce:

  1. Open the sample https://codepen.io/SNovikov/pen/VwbJOzG?editors=0010
  2. Export PDF with specified document option
   doc.setLineHeightFactor(1.5);
   doc.text('Some text', 10, 10, { baseline: 'middle' });
  1. Export PDF with specified text option
   doc.text('Some text', 10, 10, { lineHeightFactor: 1.5, baseline: 'middle' });

As you can see, PDF files are different
image

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