Noticed the bug below - see last line of posted code marked with my initials ...
procedure TJPFpdf.Writer(const vHeight: Double; vText: String);
var
vfamily: TPDFFontFamily;
vstyle: TPDFFontStyle;
vw: Extended;
vwmax: Extended;
vs: String;
vnb: Integer;
vnl: Integer;
vl: Integer;
vj: Integer;
vi: Integer;
vsep: Integer;
vc: Char;
fUTF8: Boolean;
begin
fUTF8 := False;
if (pUTF8) then
begin
vText := UTF8ToUTF16(vText);
SetUTF8(False);
fUTF8 := True;
end;
//Output text in flowing mode
vfamily := Self.cFontFamily;
vstyle := Self.cFontStyle;
if (vfamily in [ffCourier, ffSymbol, ffZapfdingbats]) then
vstyle := fsNormal;
//
vw := Self.dw - Self.rMargin - Self.cpX;
vwmax := (vw - 2 * Self.cMargin) * 1000 / Self.cFontSize;
vs := StringReplace(vText, #13, '', [rfReplaceAll]);
vnb := Length(vs);
vsep := -1;
vi := 1;// KPKPKP was 0 - which lead to range error (when range checking was on)