TFontDialog bug? lazarus / 31-LCL ---------------------------------------------------------------------- mtanner · 2016-07-03 18:16 With a TFontDialog, if I set, for example  MinFontSize=8 and MaxFontSize=24, the dialog displays no font sizes and always, on clicking ok, says the font size is invalid. This happens whether the min/max font sizes are specified in the propery editor or by program code. Leaving the font sizes limits alone means the TFontDialog seems to work correctly. ---------------------------------------------------------------------- mtanner · 2016-07-03 18:18 FYI I am using Lazarus V1.6 under Windows (XP still!). FPC version 51630. SVN revision 51630. ---------------------------------------------------------------------- rvk · 2016-07-04 10:09 Confirmed (also in trunk). Steps to reproduce: 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 TForm1.Button1Click(Sender: TObject);var  Fd: TFontDialog;begin  Fd := TFontDialog.Create(nil);  try    Fd.Font.Name := 'Arial';    Fd.Font.Size := 9;    Fd.MinFontSize := 8;    Fd.MaxFontSize := 24;  Fd.Options := Fd.Options + [fdLimitSize];    if Fd.Execute then;  finally    Fd.Free;  end;end; The problem is that the fdLimitSize is passed to the dialog but the MaxFontSize and MinFontSize are not. (in lazarus/lcl/interfaces/win32/win32wsdialogs.pp) Resulting in a "Size must be between 0 and 0 points." error. Bugreport is submitted: http://bugs.freepascal.org/view.php?id=30340 ---------------------------------------------------------------------- rvk · 2016-07-04 10:24 @mtanner, you can add the highlighted lines to the following file: lazarus/lcl/interfaces/win32/win32wsdialogs.pp 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 class function TWin32WSFontDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;//....    with CFW do    begin      LStructSize := sizeof(TChooseFont);      HWndOwner := GetOwnerHandle(ACommonDialog);      LPLogFont := commdlg.PLOGFONTW(@LFW);      Flags := GetFlagsFromOptions(Options);    Flags := Flags or CF_INITTOLOGFONTSTRUCT or CF_BOTH;      RGBColors := DWORD(Font.Color);      if fdLimitSize in Options then      begin      nSizeMin:=MinFontSize;        nSizeMax:=MaxFontSize;      end;  end;    UserResult := ChooseFontW(@CFW);    // we need to update LF now    LF.lfFaceName := UTF16ToUTF8(LFW.lfFaceName);  end; After that you can choose Tools > Build Lazarus with profile: Normal IDE after which it should work fine. ---------------------------------------------------------------------- Bart · 2016-07-04 11:09 @rvk: can you create a patch file and attach it to the bugreport? Bart ---------------------------------------------------------------------- rvk · 2016-07-04 11:28 Done.