From 08f44d0d8071488ef19ef47ff15f28d7a4cdef64 Mon Sep 17 00:00:00 2001 From: tombo Date: Mon, 4 Feb 2008 11:38:15 +0000 Subject: [PATCH] LCL carbon: fixed text layout cache recalculations, when context changed git-svn-id: trunk@13972 - --- lcl/interfaces/carbon/carbongdiobjects.pp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lcl/interfaces/carbon/carbongdiobjects.pp b/lcl/interfaces/carbon/carbongdiobjects.pp index 75d3deb3c7..8c187ac40e 100644 --- a/lcl/interfaces/carbon/carbongdiobjects.pp +++ b/lcl/interfaces/carbon/carbongdiobjects.pp @@ -923,15 +923,24 @@ procedure TCarbonTextLayoutArray.Apply(ADC: TCarbonContext); var I: Integer; begin - FAscent := FFont.FCachedLayouts[Ord(FText[1])].FAscent; - FDescent := FFont.FCachedLayouts[Ord(FText[1])].FDescent; - FTextBefore := FFont.FCachedLayouts[Ord(FText[1])].FTextBefore; - FTextAfter := FTextBefore; - + FAscent := 0; + FDescent := 0; + FTextBefore := 0; + FTextAfter := 0; + for I := 1 to Length(FText) do begin FFont.FCachedLayouts[Ord(FText[I])].Apply(ADC); - FTextAfter := FTextAfter + Long2Fix(FFont.FCachedLayouts[Ord(FText[I])].GetWidth); + + if I > 1 then + FTextAfter := FTextAfter + Long2Fix(FFont.FCachedLayouts[Ord(FText[I])].GetWidth) + else + begin + FAscent := FFont.FCachedLayouts[Ord(FText[1])].FAscent; + FDescent := FFont.FCachedLayouts[Ord(FText[1])].FDescent; + FTextBefore := FFont.FCachedLayouts[Ord(FText[1])].FTextBefore; + FTextAfter := FTextBefore; + end; end; end; @@ -1115,6 +1124,7 @@ function TCarbonFont.CreateTextLayout(const Text: String; C: Byte; begin Result := False; + Exit; for I := 1 to Length(Text) do begin C := Ord(Text[I]);