Description
Happy new year :)
Anyways uh just wanted to point something out.
Starting on line: 3627
Code behaves as expected with "alphabetic" or "ideographic".
Issue:
Code behaves as expected with "top", "bottom", "hanging" and "middle" only if you keep the default lineHeightFactor.
Changing the global lineHeightFactor or the lineHeightFactor from the doc.text(...) function will produce an unexpected output.
const doc = new jsPDF({ unit: 'pt' });
doc.setFont('times');
doc.setFontSize(18);
doc.text('Test 1', 72, 72, { baseline: 'hanging' });
doc.setLineHeightFactor(2); // this
// or this
doc.text('Test 1', 72, 72, { baseline: 'hanging', lineHeightFactor: 2 });
Expected output:
Text should hang by the 72pt line.
Unexpected output:
Text does not do what the baseline claims to do. If we continue with the "hanging" baseline for example, it breaks if the scale factor is anything but 1.15.
For now, the work around is to calculate the baseline manually. The issue is that in the source code the descent is dependent on the lineHeightFactor when in reality it should probably be a fixed percentage.
Thank you.