mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 21:19:07 +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
|
uses
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
LCLProc, LCLType, LCLIntf, GraphType,
|
LCLProc, LCLType, LCLIntf, GraphType, SynEditMiscProcs,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -663,6 +663,12 @@ begin
|
|||||||
// Result(CharWidth)
|
// Result(CharWidth)
|
||||||
with ABC do
|
with ABC do
|
||||||
Result := abcA + Integer(abcB) + abcC + TM.tmOverhang;
|
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
|
// pCharHeight
|
||||||
if Assigned(pCharHeight) then
|
if Assigned(pCharHeight) then
|
||||||
pCharHeight^ := Abs(TM.tmHeight) {+ TM.tmInternalLeading};
|
pCharHeight^ := Abs(TM.tmHeight) {+ TM.tmInternalLeading};
|
||||||
|
Loading…
Reference in New Issue
Block a user