|
From: Benjamin L. <bj...@gm...> - 2011-02-04 09:17:43
|
Hello list, I ran into another strange behviour with the windows terminal and enhanced text. With a 4.5.0 CVS snapshot build, when I execute set term windows enhanced set ylabel "something in mm^2" plot [0:2*pi] sin(x) with linespoints the ylabel is placed horizontally at the top left corner, however if I do instead set tem windows enhanced plot [0:2*pi] sin(x) with linespoints set ylabel "something in mm^2" replot it works as expected. I tracked it down to do_plot() in graphics.c at line 1632 deciding that the terminal can't do rotated text. do_plot() decides so, because WIN_text_angle (in win.trm) returnes FALSE, because graphwin.rotate is FALSE. Now graphwin.rotate is set in MakeFonts() in wgraph.c, which determines, whether the font in question supports being rotated. MakeFonts() in turn is called (among others) by GraphChangeFont() which itself is called from drawgraph() with the OP Code W_font. Ok, so on startup, when the terminal is initialized, graphwin.rotate is set to TRUE (which is correct), but it gets reset to FALSE during execution. This happens, because GraphChangeFont() is called with an empty font name (not a NULL pointer, but the empty string ""). MakeFonts(), when presented with a font name which is empty, resets graphwin.rotate to FALSE. And at this point I got unsure as to what is the correct way to fix this problem. Solution 1) GraphChangeFont() should test whether the font name is not empty, and only then really change the font (i.e. silently ignore empty font names) Solution 2) drawgraph() should only call GraphChangeFont() if the font name is not empty (i.e. silently ignore W_font commands with empty font names) Solution 3) GraphChangeFont() should not be called with an empty font name in the first place. Such a call is found in WIN_set_font (win.trm) when the fontname is NULL. Is this correct? And WIN_set_font(NULL) is called from within WIN_options() with the remark "font initialization". Is this correct, too? Solution 4) deal with it in MakeFonts() directly. benjamin |