unfortunately, when compiled in release mode (with asserts disabled), the code in assert parameter is removed and there is an exception on the next line (Font not found or something like that)
When dropping a TSynEdit on a sample project, it doesn't cause error (unless assert is unchecked in options), but in the big project I'm working on, it cause Exception in release mode (I prefer not leaving assert enabled ;-) )
I've corrected like that :
function IsFontMonospacedAndValid(Font: TFont): Boolean;
var
LogFont: TLogFont;
DWFont: IDWriteFont;
IsFontFound : integer;
begin
try
IsFontFound := GetObject(Font.Handle, SizeOf(TLogFont), @LogFont);
Assert(IsFontFound <> 0);
CheckOSError(TSynDWrite.GDIInterop.CreateFontFromLOGFONT(LogFont, DWFont));
Result := (DWFont as IDWriteFont1).IsMonospacedFont;
if (FontFamilyName(DWFont) <> Font.Name) and (fsBold in Font.Style) then
Font.Style := Font.Style - [fsBold];
except
Exit(False);
end;
end;
Hello all,
In SynDWrite.pas unit, the IsFontMonospacedAndValid() method contain an Assert :
unfortunately, when compiled in release mode (with asserts disabled), the code in assert parameter is removed and there is an exception on the next line (Font not found or something like that)
When dropping a TSynEdit on a sample project, it doesn't cause error (unless assert is unchecked in options), but in the big project I'm working on, it cause Exception in release mode (I prefer not leaving assert enabled ;-) )
I've corrected like that :
Best regards