![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | TFont in Tee.Format.pas does not handle negative Size | ||
|---|---|---|---|
| Product: | TeeGrid for Delphi | Reporter: | dean.mustakinov |
| Component: | Grid | Assignee: | david berneda <david> |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | marc |
| Priority: | --- | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
Thank you Dean. Code included. |
VCL TFont uses negative Size to specify that internal leading on top of each line of text is included in Size. TeeGrid assigns Self.Font.Size to Tee.Format.TFont.DefaultSize when ParentFont = true. If parent uses negative Size then Tee.Format.TFont does not work correctly. I have made a simple workaround for this in Tee.Format.pas: -added public function to convert between negative and positive Size class function TFont.GetTeeFontSize(const AWinFontSize: Single): Single; // DM CHANGE begin if AWinFontSize >= 0 then result := AWinFontSize else result := Abs(AWinFontSize) * 0.9; // approximately font size - internal leading end; -changed following methods to use the GetTeeFontSize when setting internal font size: Constructor TFont.Create(const AChanged: TNotifyEvent); begin inherited; FName:=DefaultName; DefaultStyle:=[]; FBrush:=TBrush.Create(AChanged); FBrush.InitColor(TColors.Black); FSize:=GetTeeFontSize(DefaultSize); // DM CHANGE end; procedure TFont.Assign(Source: TPersistent); begin if Source is TFont then begin Brush:=TFont(Source).FBrush; FName:=TFont(Source).Name; FSize:=GetTeeFontSize(TFont(Source).FSize); // DM CHANGE FStyle:=TFont(Source).FStyle; end else inherited; end; function TFont.IsSizeStored: Boolean; begin result:=GetTeeFontSize(FSize)<>GetTeeFontSize(DefaultSize); // DM CHANGE end; procedure TFont.SetSize(const Value: Single); begin if FSize<>GetTeeFontSize(Value) then // DM CHANGE begin FSize:=GetTeeFontSize(Value); // DM CHANGE Changed; end; end;