From: Michael T. <mic...@gm...> - 2009-09-01 22:03:46
|
2009/9/1 Jae-Joon Lee <lee...@gm...>: > My understanding is that all the backends should use left-bottom > alignment. Text alignment in matplotlib is handled by mpl itself (not > by the backend), and for this to work, you have to define > get_text_width_height_descent method correctly. > > The real question is how we know the metric of the font that will be > used for rendering. I have little knowledge about the html canvas > specification, but I presume that the situation is very similar to the > svg case. Unless we embed the fonts (the svg backend has an option to > embed the fonts as paths), I don't think it is possible to get it > right. I see firefox 3.5 (html5) has a method to measure the width of the text, I'll look at using this in a javascript function to render the text. https://developer.mozilla.org/en/Drawing_text_using_a_canvas#measureText%28%29 > > ps. gnuplot seems to use embedded fonts for their html5 canvas backend > (I haven't checked carefully but their demo output uses canvastext.js, > originally from http://jim.studt.net/canvastext/) yep noticed that, but didn't realize the significance of not using the built in canvas text drawing. Thanks, Michael |