Steema Issues Database

Note: 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.



Bug 1194 - TextWidth in GDIPlus skips the spaces at the end
Summary: TextWidth in GDIPlus skips the spaces at the end
Status: CONFIRMED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 150120
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://www.teechart.net/support/viewt...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-16 06:14 EDT by yeray alonso
Modified: 2015-04-28 08:41 EDT (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2015-04-16 06:14:24 EDT
GDI and GDIPlus give different results. The following example demonstrates it:

uses TeCanvas, TeeConst;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
var myText1, myText2: string;
    gdiw1, gdiw2, gdipw1, gdipw2, numLines: Integer;
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  myText1:='TeeChart';
  myText2:='TeeChart'+#32+#32+#32+#32;

  Chart1.Canvas:=TTeeCanvas3D.Create;
  gdiw1:= Chart1.MultiLineTextWidth(myText1,numLines);
  gdiw2:= Chart1.MultiLineTextWidth(myText2,numLines);

  Chart1.Canvas:=TGDIPlusCanvas.Create;
  gdipw1:= Chart1.MultiLineTextWidth(myText1,numLines);
  gdipw2:= Chart1.MultiLineTextWidth(myText2,numLines);

  Chart1.Title.Text.Text:='Length of "' + myText1 + '" in GDI: ' +  IntToStr(gdiw1) + NewLine
                        + 'Length of "' + myText2 + '" in GDI: ' +  IntToStr(gdiw2) + NewLine
                        + 'Length of "' + myText1 + '" in GDIPlus: ' +  IntToStr(gdipw1) + NewLine
                        + 'Length of "' + myText2 + '" in GDIPlus: ' +  IntToStr(gdipw2);
end;

With the code above in GDI you get 44 and 46 for "TeeChart" and "TeeChart " strings.
However, in GDIPlus you get the same length for both "TeeChart" and "TeeChart " strings. So the spaces at the end seem to haven't been taken in consideration.

Could be related to this:
http://bugs.teechart.net/show_bug.cgi?id=1055
http://www.teechart.net/support/viewtopic.php?f=3&t=15336