alignment of text in DrawText

Robin Dunn wrote:
> Peter Damoc wrote:
>> I believe that there is real value in adding a flag to the DrawText
>> method in order to specify the alignment to the x,y point.

> Although this would probably be useful I think a more common need would
> be to align to the font's baseline, and we don't have any alignment
> flags for that.

They would all be useful! If alignment to the baseline is done, that
would be a good time to add other alignments also.

Peter, you might want to take a look at wx.lib.floatcanvas -- the Text
object in there has alignment to top|center|bottom, and
left>center>right -- it was a bit of a pain to write.

···

-----

If you take a look at my graphic lib http://spinecho.ze.cx/ > jmgraph
there is (also!) a function doing this job.

# Trace un texte au point p. La position relative du texte est donnée
# par le string pos.
#
# wi
# lt----------mt---------rt
# | |
# lm mm rm he Texte horizontal de gauche à droite
# | |
# lb----------mb---------rb
#
def PlotText(dc, txt, px, py, pos):

Translation:
Draw a text at the point p. The relative position of the text is
given by the string pos. The hotizontal text is drawn from left to
right.

dc, txt: dc, txt to draw
px, py: p point
pos: a 2-chars string indicating the relative position (vert. and horiz.
offsets)
lt: left-top
mt: middle-top
and so on.

If I recall correctly I took that idea from an HP plotter. I do
not remember the used syntax, but the plotter model was HP7475A,
it was ... 20 years ago.

Jean-Michel Fauth, Switzerland