I am using gfxDrawText() function, which works properly as described.
When I had placed a gfxSetTextAlign() command before the gfxDrawText(), then the alignment was distorted.
The problem exists when the Argument for gfxSetTextAlign() was eith 6 or 2. When the argument was 0, no problem.
I realize the gfxSetTextAlign() is not necessary when using gfxDrawText(), however it seems that there should be no interaction.
gfxSetTextAlign() is supposed to be used in conjunction with GfxTextOut
There is no problem, but the reason you see alignment being distorted is because the calculation of the bounding-rectangle is changing.
In gfxDrawText() the co-ordinates are for the rectangle, not the Font, which is determined by the SetFont Function.
On the other hand, TextOut() will have the bounding rectangle very close to the text body like in PlotText().
I hope it clears your doubt, rather than taking more time and posting snaps.
I've not written the internal code, but this seems very logical. Therefore, you should use the right functions in their appropriate context.
Also if you actually read the docs I pointed out in previous reply
You would see this:
Remarks [...] The text alignment mode for the device context must include the TA_LEFT, TA_TOP, and TA_NOUPDATECP flags.
So it operates 100% as described. There is nothing to be alerted when something works as described.
Besides your use of DrawText function is incorrect. TA_ are constants for SetTextAlign but DrawText has DIFFERENT constants. DrawText uses DT_ constants that are listed in MS web site I pointed out. Numerical values of those constants are in the winuser.h header file. TA_RIGHT just happens to be the same value as DT_RIGHT but other flags may not and technically your code is incorrect.