mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 08:59:32 +02:00
SynEdit: Avoid crash with corrupt font-data. (Bug #12563). This is a fix for the crash, rendering of a none-renderable font is a welcome side-effect.
git-svn-id: trunk@17513 -
This commit is contained in:
parent
7dfb9415a6
commit
ff7e434cf4
@ -71,7 +71,7 @@ interface
|
||||
|
||||
uses
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
LCLProc, LCLType, LCLIntf, GraphType,
|
||||
LCLProc, LCLType, LCLIntf, GraphType, SynEditMiscProcs,
|
||||
{$ELSE}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
@ -663,6 +663,12 @@ begin
|
||||
// Result(CharWidth)
|
||||
with ABC do
|
||||
Result := abcA + Integer(abcB) + abcC + TM.tmOverhang;
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
// SynEdit would crash if a (defect) font returns 0.
|
||||
if Result <= 0 then result := TM.tmAveCharWidth + Max(TM.tmOverhang,0);
|
||||
if Result <= 0 then result := 1 + CharHeight * 8 div 10;
|
||||
{$ENDIF}
|
||||
|
||||
// pCharHeight
|
||||
if Assigned(pCharHeight) then
|
||||
pCharHeight^ := Abs(TM.tmHeight) {+ TM.tmInternalLeading};
|
||||
|
Loading…
Reference in New Issue
Block a user