[Lazarus] PDF generator: please test

Ondrej Pokorny lazarus at kluug.net
Sun Apr 10 07:41:04 CEST 2016


On 08.04.2016 23:35, Graeme Geldenhuys wrote:
>> As note: If I compile with -Cr, I got a Runerror 201 in unit fpparsettf
>> >on line 810.
> I made a note of that, thanks.

The attached patch fixes the range error.

Ondrej
-------------- next part --------------
Index: fpparsettf.pp
===================================================================
--- fpparsettf.pp	(revision 33453)
+++ fpparsettf.pp	(working copy)
@@ -807,7 +807,8 @@
   FMissingWidth := Widths[Chars[CharCodes^[32]]].AdvanceWidth;  // Char(32) - Space character
   for I:=0 to 255 do
     begin
-    if (Widths[Chars[CharCodes^[i]]].AdvanceWidth> 0) and (CharNames^[i]<> '.notdef') then
+    if (CharCodes^[i]>=0) and (CharCodes^[i]<=High(Chars))
+    and (Widths[Chars[CharCodes^[i]]].AdvanceWidth> 0) and (CharNames^[i]<> '.notdef') then
       CharWidth[I]:= ToNatural(Widths[Chars[CharCodes^[I]]].AdvanceWidth)
     else
       CharWidth[I]:= FMissingWidth;


More information about the Lazarus mailing list