View Issue Details

IDProjectCategoryView StatusLast Update
0027379LazarusDocumentationpublic2015-01-31 18:10
ReporterwpAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5 (SVN)Product Build 
Target Version1.4Fixed in Version1.5 (SVN) 
Summary0027379: Misleading documentation of X/Y parameter of TCanvas.TextRect
DescriptionThe current documentation of TCanvas.TextRect says:
"Writes Text string within a specified rectangle, according to predefined Style". And: "X, Y specify the starting point for writing the <var>Text</var> within the rectangle".

As I learned when working with another bug report (0027363) this is not true in general: the x/y coordinates are respected only for top/left-aligned text. For other alignments/layouts the text position is defined only by the rectangle, not by x/y any more.

The attached patch clarifies this in the Lazarus documentation of graphics.xml.
Additional InformationI wonder why the "Arguments" section shows up twice in the generated html and chm file.
TagsNo tags attached.
Fixed in Revision47566
LazTarget1.4
Widgetset
Attached Files
  • graphics.xml.patch (3,475 bytes)
    Index: graphics.xml
    ===================================================================
    --- graphics.xml	(revision 47547)
    +++ graphics.xml	(working copy)
    @@ -6084,28 +6084,42 @@
           <element name="TCanvas.TextRect">
             <short>Writes <var>Text</var> string within a specified rectangle, according to predefined <var>Style</var>
             </short>
    -        <descr>Writes <var>Text</var> string within a specified rectangle, according to predefined <var>Style</var><br/>
    -The boundaries of the rectangle are specified in <var>ARect</var><br/><var>X, Y</var> specify the starting point for writing the <var>Text</var> within the rectangle <br/><var>TextStyle</var> determines whether the text is justified, centered, word-wrapped etc. If the <var>Style</var> argument is omitted, defaults are assumed</descr>
    +        <descr>
    +	  Writes <var>Text</var> string within a specified rectangle, according to predefined <var>Style</var><br/>
    +          The boundaries of the rectangle are specified in <var>ARect</var><br/><var>X, Y</var> define the starting point for writing the <var>Text</var> within the rectangle.<br/>
    +	  <var>TextStyle</var> determines whether the text is justified, centered, word-wrapped, clipped at the rectangle boundaries, etc. If the <var>Style</var> argument is omitted, defaults are assumed.<br/>
    +	  <br/>
    +	  <b>Note:</b>
    +          The exact text position depends on the specified rectangle, the <var>TextStyle</var> of the canvas, and the <var>X, Y</var> coordinates:
    +          <ul>
    +            <li><var>TextStyle.Alignment = taLeftJustify</var>: Text begins at <var>X</var></li>
    +            <li><var>TextStyle.Alignment = taCenter</var>: Text center is in the center of the rectangle (horizontally)</li>
    +            <li><var>TextStyle.Alignment = taRightJustify</var>: Text ends at right edge of the rectangle</li>
    +            <li><var>TextStyle.Layout = tlTop</var>: Top of the text is at <var>Y</var></li>
    +            <li><var>TextStyle.Layout = tlCenter</var>: Text center is in the center of the rectangle (vertically)</li>
    +            <li><var>TextStyle.Layout = tlBottom</var>: Text sits above the the bottom edge of the rectangle</li>
    +          </ul>
    +        </descr>
           </element>
           <!-- argument Visibility: default -->
           <element name="TCanvas.TextRect.ARect">
    -        <short/>
    +        <short>Rectangle within which the specified text is drawn</short>
           </element>
           <!-- argument Visibility: default -->
           <element name="TCanvas.TextRect.X">
    -        <short/>
    +        <short>Horizontal text start (respected only if TextStyle.Alignment = taLeftJustify)</short>
           </element>
           <!-- argument Visibility: default -->
           <element name="TCanvas.TextRect.Y">
    -        <short/>
    +        <short>Vertical position of the top of the text (respected only if TextStyle.Layout = tlTop)</short>
           </element>
           <!-- argument Visibility: default -->
           <element name="TCanvas.TextRect.Text">
    -        <short/>
    +        <short>Text to be drawn</short>
           </element>
           <!-- argument Visibility: default -->
           <element name="TCanvas.TextRect.Style">
    -        <short/>
    +        <short>Optional parameter which determines whether the text is justified, word-wrapped, clipped, etc. If omitted, the current <var>TextStyle</var> of the canvas is used.</short>
           </element>
           <!-- function Visibility: public -->
           <element name="TCanvas.TextExtent">
    
    graphics.xml.patch (3,475 bytes)

Activities

wp

2015-01-29 23:59

developer  

graphics.xml.patch (3,475 bytes)
Index: graphics.xml
===================================================================
--- graphics.xml	(revision 47547)
+++ graphics.xml	(working copy)
@@ -6084,28 +6084,42 @@
       <element name="TCanvas.TextRect">
         <short>Writes <var>Text</var> string within a specified rectangle, according to predefined <var>Style</var>
         </short>
-        <descr>Writes <var>Text</var> string within a specified rectangle, according to predefined <var>Style</var><br/>
-The boundaries of the rectangle are specified in <var>ARect</var><br/><var>X, Y</var> specify the starting point for writing the <var>Text</var> within the rectangle <br/><var>TextStyle</var> determines whether the text is justified, centered, word-wrapped etc. If the <var>Style</var> argument is omitted, defaults are assumed</descr>
+        <descr>
+	  Writes <var>Text</var> string within a specified rectangle, according to predefined <var>Style</var><br/>
+          The boundaries of the rectangle are specified in <var>ARect</var><br/><var>X, Y</var> define the starting point for writing the <var>Text</var> within the rectangle.<br/>
+	  <var>TextStyle</var> determines whether the text is justified, centered, word-wrapped, clipped at the rectangle boundaries, etc. If the <var>Style</var> argument is omitted, defaults are assumed.<br/>
+	  <br/>
+	  <b>Note:</b>
+          The exact text position depends on the specified rectangle, the <var>TextStyle</var> of the canvas, and the <var>X, Y</var> coordinates:
+          <ul>
+            <li><var>TextStyle.Alignment = taLeftJustify</var>: Text begins at <var>X</var></li>
+            <li><var>TextStyle.Alignment = taCenter</var>: Text center is in the center of the rectangle (horizontally)</li>
+            <li><var>TextStyle.Alignment = taRightJustify</var>: Text ends at right edge of the rectangle</li>
+            <li><var>TextStyle.Layout = tlTop</var>: Top of the text is at <var>Y</var></li>
+            <li><var>TextStyle.Layout = tlCenter</var>: Text center is in the center of the rectangle (vertically)</li>
+            <li><var>TextStyle.Layout = tlBottom</var>: Text sits above the the bottom edge of the rectangle</li>
+          </ul>
+        </descr>
       </element>
       <!-- argument Visibility: default -->
       <element name="TCanvas.TextRect.ARect">
-        <short/>
+        <short>Rectangle within which the specified text is drawn</short>
       </element>
       <!-- argument Visibility: default -->
       <element name="TCanvas.TextRect.X">
-        <short/>
+        <short>Horizontal text start (respected only if TextStyle.Alignment = taLeftJustify)</short>
       </element>
       <!-- argument Visibility: default -->
       <element name="TCanvas.TextRect.Y">
-        <short/>
+        <short>Vertical position of the top of the text (respected only if TextStyle.Layout = tlTop)</short>
       </element>
       <!-- argument Visibility: default -->
       <element name="TCanvas.TextRect.Text">
-        <short/>
+        <short>Text to be drawn</short>
       </element>
       <!-- argument Visibility: default -->
       <element name="TCanvas.TextRect.Style">
-        <short/>
+        <short>Optional parameter which determines whether the text is justified, word-wrapped, clipped, etc. If omitted, the current <var>TextStyle</var> of the canvas is used.</short>
       </element>
       <!-- function Visibility: public -->
       <element name="TCanvas.TextExtent">
graphics.xml.patch (3,475 bytes)

Jesus Reyes

2015-01-30 22:49

developer   ~0080692

Thanks, applied

wp

2015-01-31 18:10

developer   ~0080702

Thanks

Issue History

Date Modified Username Field Change
2015-01-29 23:59 wp New Issue
2015-01-29 23:59 wp File Added: graphics.xml.patch
2015-01-30 22:47 Jesus Reyes Assigned To => Jesus Reyes
2015-01-30 22:47 Jesus Reyes Status new => assigned
2015-01-30 22:49 Jesus Reyes Fixed in Revision => 47566
2015-01-30 22:49 Jesus Reyes LazTarget - => 1.4
2015-01-30 22:49 Jesus Reyes Note Added: 0080692
2015-01-30 22:49 Jesus Reyes Status assigned => resolved
2015-01-30 22:49 Jesus Reyes Fixed in Version => 1.5 (SVN)
2015-01-30 22:49 Jesus Reyes Resolution open => fixed
2015-01-30 22:49 Jesus Reyes Target Version => 1.4
2015-01-31 18:10 wp Note Added: 0080702
2015-01-31 18:10 wp Status resolved => closed