From cb586c9d08f2dcbd60025caee98eec8bba4386c6 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 1 Jul 2016 17:53:23 +0000 Subject: [PATCH] tvplanit: trying to resolve the issue of growing day names in the calendar view in OSX (see forum http://forum.lazarus.freepascal.org/index.php/topic,33189.msg214639.html#msg214639). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4881 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/packages/laz_visualplanit.lpk | 1 + components/tvplanit/source/vpcalendarpainter.pas | 15 ++++++++------- components/tvplanit/source/vpcanvasutils.pas | 3 +-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/components/tvplanit/packages/laz_visualplanit.lpk b/components/tvplanit/packages/laz_visualplanit.lpk index c9275133e..67cccd2bc 100644 --- a/components/tvplanit/packages/laz_visualplanit.lpk +++ b/components/tvplanit/packages/laz_visualplanit.lpk @@ -5,6 +5,7 @@ + diff --git a/components/tvplanit/source/vpcalendarpainter.pas b/components/tvplanit/source/vpcalendarpainter.pas index 7bb4ddfa8..5141a856f 100644 --- a/components/tvplanit/source/vpcalendarpainter.pas +++ b/components/tvplanit/source/vpcalendarpainter.pas @@ -208,7 +208,11 @@ var I: Integer; S: string; DrawRect: TRect; + fontsize: Integer; begin + {Store the font size} + fontsize := RenderCanvas.Font.Size; + {draw the day name column labels} RenderCanvas.Font.Color := DayNameColor; I := 0; @@ -236,16 +240,13 @@ begin S := SysToUTF8(S); {$ENDIF} + {restore the font size - this is not needed normally, but may solve the + issue with growing fonts along this row in MacOSX } + RenderCanvas.Font.Size := fontsize; + {draw the day name above each column} DrawRect := TVpCalendarOpener(FCalendar).clRowCol[1, I]; OffsetRect(DrawRect, RealLeft, Realtop); - { - DrawRect := Rect( - clRowCol[1, I].Left + RealLeft, - clRowCol[1, I].Top + RealTop, - clRowCol[1, I].Right + RealLeft, - clRowCol[1, I].Bottom + RealTop); - } TPSCenteredTextOut(RenderCanvas, Angle, RenderIn, DrawRect, S); Inc(I); if DOW < High(DOW) then diff --git a/components/tvplanit/source/vpcanvasutils.pas b/components/tvplanit/source/vpcanvasutils.pas index 56987eaf2..6802c5413 100644 --- a/components/tvplanit/source/vpcanvasutils.pas +++ b/components/tvplanit/source/vpcanvasutils.pas @@ -752,8 +752,7 @@ begin case FCanvas.Font.Pitch of fpVariable : LF.lfPitchAndFamily := VARIABLE_PITCH or FF_DONTCARE; fpFixed : LF.lfPitchAndFamily := FIXED_PITCH or FF_DONTCARE; - else - LF.lfPitchAndFamily := DEFAULT_PITCH; + else LF.lfPitchAndFamily := DEFAULT_PITCH; end; // Create new font to use