jvcllaz: Fix too-small default font size when printing TvTimeFramework controls.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7106 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-08-09 15:24:58 +00:00
parent 22a3496170
commit 96b36e176f

View File

@ -4874,6 +4874,24 @@ var
I, J, lRightCol, lBottomRow: Integer;
w, h: Integer;
begin
// For printing, fix Lazarus default fonts having size 0
if not (csDesigning in ComponentState) then begin
FixFont(ApptAttr.Font);
FixFont(FancyRowHdrAttr.MajorFont);
FixFont(FancyRowHdrAttr.MinorFont);
FixFont(Font);
FixFont(GroupHdrAttr.Font);
FixFont(HdrAttr.Font);
FixFont(SelApptAttr.Font);
FixFont(SelFancyRowHdrAttr.MajorFont);
FixFont(SelFancyRowHdrAttr.MinorFont);
FixFont(SelGroupHdrAttr.Font);
FixFont(SelHdrAttr.Font);
FixFont(TimeBlockProps.BlockHdrAttr.Font);
FixFont(TimeBlockProps.SelBlockHdrAttr.Font);
end;
{ optimization incorrectly kicks in if control is only partially
visible on the screen
if not PaintBuffer.Empty and
@ -5613,7 +5631,6 @@ begin
try
GetApptDrawInfo(DrawInfo, Appt, Attr);
Font.Assign(DrawInfo.Font);
FixFont(Font);
Brush.Color := DrawInfo.Color;
Pen.Color := DrawInfo.FrameColor;
Pen.Width := DrawInfo.FrameWidth;
@ -6168,7 +6185,6 @@ begin
ACanvas.Brush.Color := UseAttr.Color;
ACanvas.Font.Assign(UseAttr.Font);
FixFont(ACanvas.Font);
DrawTxt(ACanvas, Rect, Txt, taCenter, vaCenter);
@ -6322,7 +6338,6 @@ begin
ACanvas.Brush.Color := HdrAttr.Color;
ACanvas.Font.Assign(HdrAttr.Font);
end;
FixFont(ACanvas.Font);
// All parameters now specified. Now calc text height.
Flags := DT_NOPREFIX or DT_WORDBREAK or DT_CENTER or DT_CALCRECT;
@ -6621,7 +6636,6 @@ begin
ACanvas.Font.Assign(SelFancyRowHdrAttr.MajorFont)
else
ACanvas.Font.Assign(FancyRowHdrAttr.MajorFont);
FixFont(ACanvas.Font);
ACanvas.Brush.Style := bsClear;
@ -6682,7 +6696,6 @@ begin
// now draw the LabelStr right aligned
ACanvas.Brush.Style := bsClear;
ACanvas.Font.Assign(Attr.MinorFont);
FixFont(ACanvas.Font);
// draw the focus rect if needed
if (RowNum = FocusedRow) and Focused and ShowFocus then
@ -6777,10 +6790,8 @@ begin
try
TempFont.Assign(Canvas.Font);
Canvas.Font.Assign(FancyRowHdrAttr.MinorFont);
FixFont(Canvas.Font);
Result := Canvas.TextWidth('22:22a') - 10;
Canvas.Font.Assign(TempFont);
FixFont(Canvas.Font);
finally
TempFont.Free;
end;
@ -9351,7 +9362,6 @@ begin
GetApptDrawInfo(DrawInfo, Appt, SelApptAttr);
FrameOffset := DrawInfo.FrameWidth div 2 * 2;
Canvas.Font := DrawInfo.Font;
FixFont(Canvas.Font);
FEditor.Font := DrawInfo.Font;
FEditor.Color := DrawInfo.Color;
finally
@ -10770,7 +10780,6 @@ begin
ACanvas.Brush.Color := UseAttr.Color;
ACanvas.Font.Assign(UseAttr.Font);
FixFont(ACanvas.Font);
Flags := DT_NOPREFIX or DT_CENTER;
case ColTitleStyle of
@ -13038,7 +13047,6 @@ begin
end;
ACanvas.Font.Assign(FancyRowHdrAttr.MajorFont);
FixFont(ACanvas.Font);
ACanvas.Brush.Style := bsClear;
DrawText(ACanvas.Handle, PChar(Lbl), -1, ARect,
@ -13149,7 +13157,6 @@ begin
// now draw the LabelStr right aligned
ACanvas.Font.Assign(FancyRowHdrAttr.MinorFont);
FixFont(ACanvas.Font);
ACanvas.Brush.Style := bsClear;
DrawText(ACanvas.Handle, PChar(LabelStr), -1, TxtRect,
@ -13179,7 +13186,6 @@ begin
ACanvas.Brush.Color := HdrAttr.Color;
ACanvas.Font.Assign(HdrAttr.Font);
FixFont(ACanvas.Font);
DrawTxt(ACanvas, ARect, Txt, taCenter, vaCenter);
@ -13420,10 +13426,8 @@ begin
try
TempFont.Assign(ACanvas.Font);
ACanvas.Font.Assign(FancyRowHdrAttr.MinorFont);
FixFont(ACanvas.Font);
Result := ACanvas.TextWidth('22:22a');
ACanvas.Font.Assign(TempFont);
FixFont(ACanvas.Font);
finally
TempFont.Free;
end;
@ -13924,7 +13928,6 @@ begin
ACanvas.Brush.Color := UseAttr.Color;
ACanvas.Font.Assign(UseAttr.Font);
FixFont(ACanvas.Font);
Flags := DT_NOPREFIX or DT_CENTER;
case ColTitleStyle of