[SOLVED] Improvement of TFreeTypeRenderableFont.DefaultWordBreakHandler lazarus / 7-LCL ---------------------------------------------------------------------- lagprogramming · 2024-01-18 14:32 components/freetype/easylazfreetype.pas has Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFreeTypeRenderableFont.DefaultWordBreakHandler(var ABefore,  AAfter: string);var p: integer;begin  if (AAfter <> '') and (ABefore <> '') and (AAfter[1]<> ' ') and (ABefore[length(ABefore)] <> ' ') then  begin    p := length(ABefore);    while (p > 1) and (ABefore[p-1] <> ' ') do dec(p);    if p > 1 then //can put the word after    begin      AAfter := copy(ABefore,p,length(ABefore)-p+1)+AAfter;      ABefore := copy(ABefore,1,p-1);    end else    begin //cannot put the word after, so before     end;  end;  while (ABefore <> '') and (ABefore[length(ABefore)] =' ') do delete(ABefore,length(ABefore),1);  while (AAfter <> '') and (AAfter[1] =' ') do delete(AAfter,1,1);end; The following patch replaces ABefore := copy(ABefore,1,p-1); with SetLength(ABefore, p-1); delete(ABefore,length(ABefore),1); with SetLength(ABefore, length(ABefore)-1); ---------------------------------------------------------------------- AlexTP · 2024-01-18 15:44 Posted to https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40703