tvplanit: Fix text with font height 0 being too small in printout.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4898 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-02 22:46:05 +00:00
parent 9fc76923f9
commit 1159900b4e
8 changed files with 49 additions and 2 deletions

View File

@ -364,7 +364,11 @@ begin
InitColors;
SavePenBrush;
InitPenBrush;
TVpCalendarOpener(FCalendar).calRebuildCalArray(RenderDate);
with TVpCalendarOpener(FCalendar) do begin
Font.Height := GetRealFontHeight(Font);
calRebuildCalArray(RenderDate);
end;
RenderCanvas.Lock;
try

View File

@ -1775,6 +1775,11 @@ begin
SavePenBrush;
InitPenBrush;
with FContactGrid do begin
ContactHeadAttributes.Font.Height := GetRealFontHeight(ContactHeadAttributes.Font);
Font.Height := GetRealFontHeight(Font);
end;
Rgn := CreateRectRgn(RenderIn.Left, RenderIn.Top, RenderIn.Right, RenderIn.Bottom);
try
SelectClipRgn(RenderCanvas.Handle, Rgn);

View File

@ -477,7 +477,8 @@ type
implementation
uses
SysUtils, Math, Forms, Dialogs, VpEvntEditDlg, VpDayViewPainter;
SysUtils, Math, Forms, Dialogs,
VpEvntEditDlg, VpDayViewPainter;
(*****************************************************************************)
{ TVpTGInPlaceEdit }
@ -1342,6 +1343,7 @@ begin
{ font, the standard client font, and a sample character string. }
SaveFont := Canvas.Font;
Canvas.Font.Assign(FRowHeadAttr.FMinuteFont);
Canvas.Font.Height := GetRealFontHeight(Canvas.Font);
Result := Canvas.TextHeight(RSTallShortChars);
Canvas.Font.Assign(SaveFont);
Temp := Canvas.TextHeight(RSTallShortChars);

View File

@ -1566,6 +1566,14 @@ begin
try
SelectClipRgn(RenderCanvas.Handle, Rgn);
with FDayView do begin
AllDayEventAttributes.Font.Height := GetRealFontHeight(AllDayEventAttributes.Font);
Font.Height := GetRealFontHeight(Font);
HeadAttributes.Font.Height := GetRealFontHeight(HeadAttributes.Font);
RowHeadAttributes.HourFont.Height := GetRealFontHeight(RowHeadAttributes.HourFont);
RowHeadAttributes.MinuteFont.Height := GetRealFontHeight(RowHeadAttributes.MinuteFont);
end;
{ Calculate Row Header }
RealRowHeight := TVpDayViewOpener(FDayView).dvCalcRowHeight(Scale, UseGran);
RealColHeadHeight := TVpDayViewOpener(FDayView).dvCalcColHeadHeight(Scale);

View File

@ -118,6 +118,7 @@ function LineToStartTime(Line: Integer; Granularity: TVpGranularity): TDateTime;
function GetLineDuration(Granularity: TVpGranularity): Double;
function GetLabelWidth(ALabel: TLabel): Integer;
function GetRealFontHeight(AFont: TFont): Integer;
function DecodeLineEndings(const AText: String): String;
function EncodeLineEndings(const AText: String): String;
@ -562,6 +563,13 @@ begin
canvas.Free;
end;
function GetRealFontHeight(AFont: TFont): Integer;
begin
if AFont.Size = 0 then
Result := GetFontData(AFont.Handle).Height else
Result := AFont.Height;
end;
function SameDate(dt1, dt2: TDateTime): Boolean;
begin
Result := trunc(dt1) = trunc(dt2);

View File

@ -818,6 +818,13 @@ begin
SavePenBrush;
InitPenBrush;
with FMonthView do begin
DayHeadAttributes.Font.Height := GetRealFontHeight(DayHeadAttributes.Font);
DayNumberFont.Height := GetRealFontHeight(DayNumberFont);
EventFont.Height := GetRealFontHeight(EventFont);
Font.Height := GetRealFontHeight(Font);
end;
Rgn := CreateRectRgn(RenderIn.Left, RenderIn.Top, RenderIn.Right, RenderIn.Bottom);
try
SelectClipRgn(RenderCanvas.Handle, Rgn);

View File

@ -514,6 +514,11 @@ begin
SavePenBrush;
InitPenBrush;
with FTaskList do begin
Font.Height := GetRealFontHeight(Font);
TaskHeadAttributes.Font.Height := GetRealFontHeight(TaskHeadAttributes.Font);
end;
Rgn := CreateRectRgn(RenderIn.Left, RenderIn.Top, RenderIn.Right, RenderIn.Bottom);
try
SelectClipRgn(RenderCanvas.Handle, Rgn);

View File

@ -630,6 +630,14 @@ begin
SavePenBrush;
InitPenBrush;
with FWeekView do begin
AllDayEventAttributes.Font.Height := GetRealFontHeight(AllDayEventAttributes.Font);
DayHeadAttributes.Font.Height := GetRealFontHeight(DayHeadAttributes.Font);
EventFont.Height := GetRealFontHeight(EventFont);
Font.Height := GetRealFontHeight(Font);
HeadAttributes.Font.Height := GetRealFontHeight(HeadAttributes.Font);
end;
Rgn := CreateRectRgn(RenderIn.Left, RenderIn.Top, RenderIn.Right, RenderIn.Bottom);
try
SelectClipRgn(RenderCanvas.Handle, Rgn);