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

Summary: TextWidth in GDIPlus skips the spaces at the end
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: CanvasAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: enhancement CC: nabil.ghodbane
Priority: ---    
Version: 150120   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://www.teechart.net/support/viewtopic.php?f=3&t=15531&p=68846#p68846
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

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