|
From: Tatsuro M. <tma...@ya...> - 2011-02-07 23:49:34
|
Hello
--- Benjamin Lindner wrote:
> >
> > OK. So I will have to leave it to you guys to figure out what the problem
> > is, since it doesn't show up on my linux+wine setup.
>
> Here we go:
> The offending command happens in WIN_set_text(NULL), which places a
> W_font command in the queue with an empty font name. Removing this one
> solves the problem
>
> diff --git a/src/term/win.trm b/src/term/win.trm
> --- a/src/term/win.trm
> +++ b/src/term/win.trm
> @@ -730,7 +730,6 @@
> int fontsize;
>
> if (font == NULL) {
> - GraphOp(&graphwin, W_font, 0, 0, "");
> strcpy(WIN_font, graphwin.deffontname);
> WIN_fontsize = graphwin.deffontsize;
> return TRUE;
>
> I am not sure this command should be there anyway, I don't really see
> its purpose.
> Tatsuro can you check if this also fixes the problem for you?
The patch cannot be applied to the source that I have so that I manually attached it.
--- wgraph.orig.c 2011-01-25 06:52:59 +0900
+++ wgraph.c 2011-02-08 08:35:31 +0900
@@ -2632,9 +2632,10 @@
{
int newfontsize;
bool remakefonts = FALSE;
+ bool font_is_not_empty = (font != NULL) && (font[0] != '\0');
newfontsize = (fontsize != 0) ? fontsize : lpgw->deffontsize;
- if (font != NULL) {
+ if (font_is_not_empty) {
remakefonts = (strcmp(lpgw->fontname, font) != 0) || (newfontsize != lpgw->fontsize);
} else {
remakefonts = (strcmp(lpgw->fontname, lpgw->deffontname) != 0) || (newfontsize != lpgw->fontsize);
@@ -2642,7 +2643,7 @@
if (remakefonts) {
lpgw->fontsize = newfontsize;
- strcpy(lpgw->fontname, (font) ? font : lpgw->deffontname);
+ strcpy(lpgw->fontname, font_is_not_empty ? font : lpgw->deffontname);
DestroyFonts(lpgw);
MakeFonts(lpgw, &rect, hdc);
With the patch above,
set term windows enhanced
plot [0:2*pi] sin(x) with linespoints
set ylabel "something in mm^2"
replot
The relative position superscript '2' still changed when windows size changed.
> Second proposal:
> Make GraphChangeFonts() more robust like:
>
> diff --git a/src/src/win/wgraph.c b/src/src/win/wgraph.c
> --- a/src/src/win/wgraph.c
> +++ b/src/src/win/wgraph.c
> @@ -2613,9 +2613,10 @@
> {
> int newfontsize;
> bool remakefonts = FALSE;
> + bool font_is_not_empty = (font != NULL) && (font[0] != '\0');
>
> newfontsize = (fontsize != 0) ? fontsize : lpgw->deffontsize;
> - if (font != NULL) {
> + if (font_is_not_empty) {
> remakefonts = (strcmp(lpgw->fontname, font) != 0) ||
> (newfontsize != lpgw->fontsize);
> } else {
> remakefonts = (strcmp(lpgw->fontname, lpgw->deffontname) != 0)
> || (newfontsize != lpgw->fontsize);
> @@ -2623,7 +2624,7 @@
>
> if (remakefonts) {
> lpgw->fontsize = newfontsize;
> - strcpy(lpgw->fontname, (font) ? font : lpgw->deffontname);
> + strcpy(lpgw->fontname, font_is_not_empty ? font : lpgw->deffontname);
>
> DestroyFonts(lpgw);
> MakeFonts(lpgw, &rect, hdc);
>
>
> This would ensure the behaviour of "" meaning "the default font" on
> the low level terminal code.
> Could you check this also Tatsuro?
With the patch above,
set term windows enhanced
plot [0:2*pi] sin(x) with linespoints
set ylabel "something in mm^2"
replot
The relative position superscript '2' also still changed when windows size changed.
Regards
Tatsuro
--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
|