RE: Metapost - text alignment



Lars Clausen wrote:
Young, Robert said:
I'm willing to spend a little time trying to fix this.

Lars - should I implement a draw_text and draw_text_line method for 
the Metapost export? Or what would you recommend?

I can't promise to make this "perfect", but I would like the centre, 
left, and right aligned text to be honoured once again.

It would be an excellent idea to implement draw_text_line.  
You should then be able to drop draw_text entirely and have 
draw_string call draw_text_line like in diagdkrenderer.

OK, I've taken more of a look. From my reading of DiaRenderer.c,
draw_text calls draw_text_line for each line. This is where the metapost
output becomes a problem - if I am rendering $A_{BC}$ in metapost,
centre aligned, then draw_text subtracts half the length
(text_line_get_alignment_adjustment) and tells render_metapost.c (via
either draw_text_line or draw_string) that it's left aligned at the
aligned_pos - then metapost renders the text in the wrong position
because the length correction was not really correct.

Am I reading the code correctly? Should I implement draw_text in
render_metapost.c so that I get to control the text positioning in the
metapost output? I'm in the "let the export renderer control the text
positioning" camp, if that makes more sense? I note that svg export also
effectively removes the alignment on export.

Thanks!

Rob.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]