diff --git a/components/synedit/lazsyntextarea.pp b/components/synedit/lazsyntextarea.pp index 8ea7ff14e3..e44631ac1c 100644 --- a/components/synedit/lazsyntextarea.pp +++ b/components/synedit/lazsyntextarea.pp @@ -48,6 +48,7 @@ type procedure SetLeftChar(AValue: Integer); procedure SetPadding(Side: TLazSynBorderSide; AValue: integer); procedure SetTopLine(AValue: TLinePos); + procedure DoDrawerFontChanged(Sender: TObject); protected procedure PaintTextLines(AClip: TRect; FirstLine, LastLine, FirstCol, LastCol: integer); virtual; @@ -158,6 +159,11 @@ begin FTopLine := AValue; end; +procedure TLazSynTextArea.DoDrawerFontChanged(Sender: TObject); +begin + FontChanged; +end; + function TLazSynTextArea.ScreenColumnToXValue(Col: integer): integer; begin Result := FTextBounds.Left + (Col - LeftChar) * fCharWidth; @@ -194,6 +200,7 @@ var i: TLazSynBorderSide; begin FTextDrawer := ATextDrawer; + FTextDrawer.RegisterOnFontChangeHandler(@DoDrawerFontChanged); FPaintLineColor := TSynSelectedColor.Create; FPaintLineColor2 := TSynSelectedColor.Create; for i := low(TLazSynBorderSide) to high(TLazSynBorderSide) do @@ -205,6 +212,7 @@ end; destructor TLazSynTextArea.Destroy; begin + FTextDrawer.UnRegisterOnFontChangeHandler(@DoDrawerFontChanged); FreeAndNil(FPaintLineColor); FreeAndNil(FPaintLineColor2); inherited Destroy; diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 7d95b53fbb..aa8193a2fb 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -2223,7 +2223,7 @@ begin end; procedure TCustomSynEdit.FontChanged(Sender: TObject); -begin +begin // TODO: inherited ? FLastSetFontSize := Font.Height; RecalcCharExtent; end; @@ -7200,7 +7200,7 @@ begin FScreenCaret.Lock; try FScreenCaret.CharWidth := CharWidth; - FScreenCaret.CharHeight := LineHeight; + FScreenCaret.CharHeight := LineHeight - Max(0, ExtraLineSpacing); SizeOrFontChanged(TRUE); finally FScreenCaret.UnLock;