Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
merge develop into master

See merge request Scientific-IT-Systems/gr!924
  • Loading branch information
jheinen committed Sep 27, 2022
2 parents 6e00675 + b28980d commit 5d7f4fd
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 19 deletions.
18 changes: 14 additions & 4 deletions lib/gks/gks.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ void gks_open_gks(int errfil)
/* parse GKS environment variables */
gks_parse_env();

/* open font database */
s->fontfile = gks_open_font();
/* postpone opening of the font database */
s->fontfile = 0;

/* miscellaneous flags */
s->wiss = 0;
Expand Down Expand Up @@ -593,8 +593,12 @@ void gks_close_gks(void)
/* call the device driver link routine */
gks_ddlk(CLOSE_GKS, 0, 0, 0, i_arr, 0, f_arr_1, 0, f_arr_2, 0, c_arr, NULL);

/* close font database */
gks_close_font(s->fontfile);
if (s->fontfile > 0)
{
/* close font database */
gks_close_font(s->fontfile);
s->fontfile = 0;
}

gks_list_free(av_ws_types);
gks_free((void *)s);
Expand Down Expand Up @@ -1543,6 +1547,12 @@ void gks_set_text_fontprec(int font, int prec)
{
if (font != s->txfont || prec != s->txprec)
{
if ((prec == GKS_K_TEXT_PRECISION_STROKE || prec == GKS_K_TEXT_PRECISION_CHAR) && s->fontfile == 0)
{
/* open font database */
s->fontfile = gks_open_font();
}

s->txfont = i_arr[0] = font;
s->txprec = i_arr[1] = prec;

Expand Down
45 changes: 34 additions & 11 deletions lib/gks/plugin/qtplugin_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,13 @@ static void text(double px, double py, int nchars, char *chars)
text_routine(x, y, nchars, chars);
}
else
gks_emul_text(px, py, nchars, chars, line_routine, fill_routine);
{
if ((tx_prec == GKS_K_TEXT_PRECISION_STROKE || tx_prec == GKS_K_TEXT_PRECISION_CHAR) && gkss->fontfile == 0)
{
gkss->fontfile = gks_open_font();
}
gks_emul_text(px, py, nchars, chars, line_routine, fill_routine);
}

p->pixmap->restore();
}
Expand Down Expand Up @@ -1336,15 +1342,28 @@ static void memory_plugin_dl_render(int fctid, int dx, int dy, int dimx, int *ia
(void **)(&p->memory_plugin_ws_state_list));
}
return;

case 3:
if (gkss->fontfile != 0)
{
gks_close_font(gkss->fontfile);
}
break;
case 14:
{
int tx_prec = gkss->asf[6] ? gkss->txprec : predef_prec[gkss->tindex - 1];
if ((tx_prec == GKS_K_TEXT_PRECISION_STROKE || tx_prec == GKS_K_TEXT_PRECISION_CHAR) && gkss->fontfile == 0)
{
gkss->fontfile = gks_open_font();
}
}
break;
case 54:
if (!p->prevent_resize_by_dl || !p->interp_was_called)
{
p->window[0] = r1[0];
p->window[1] = r1[1];
p->window[2] = r2[0];
p->window[3] = r2[1];
p->memory_plugin(fctid, dx, dy, dimx, ia, lr1, r1, lr2, r2, lc, chars, (&p->memory_plugin_ws_state_list));
}
break;
case 55:
Expand All @@ -1354,17 +1373,13 @@ static void memory_plugin_dl_render(int fctid, int dx, int dy, int dimx, int *ia
p->viewport[1] = r1[1];
p->viewport[2] = r2[0];
p->viewport[3] = r2[1];
p->memory_plugin(fctid, dx, dy, dimx, ia, lr1, r1, lr2, r2, lc, chars, (&p->memory_plugin_ws_state_list));
}
break;

default:
if (p->memory_plugin_initialised)
{
p->memory_plugin(fctid, dx, dy, dimx, ia, lr1, r1, lr2, r2, lc, chars, (&p->memory_plugin_ws_state_list));
}
break;
}
if (p->memory_plugin_initialised)
{
p->memory_plugin(fctid, dx, dy, dimx, ia, lr1, r1, lr2, r2, lc, chars, (&p->memory_plugin_ws_state_list));
}
}

static void gks_memory_plugin_write_page()
Expand Down Expand Up @@ -1421,6 +1436,14 @@ static void qt_dl_render(int fctid, int dx, int dy, int dimx, int *ia, int lr1,
gks_init_core(gkss);
break;

case 3:
if (gkss->fontfile > 0)
{
gks_close_font(gkss->fontfile);
gkss->fontfile = 0;
}
break;

case 12:
polyline(ia[0], r1, r2);
break;
Expand Down
1 change: 0 additions & 1 deletion lib/gks/qt/gkswidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ GKSWidget::GKSWidget(QWidget *parent)
{
widget_state_list = new ws_state_list;
p = widget_state_list;
gkss->fontfile = gks_open_font();

#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
p->device_pixel_ratio = this->devicePixelRatioF();
Expand Down
9 changes: 6 additions & 3 deletions lib/gks/quartz/GKSView.m
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ - (void)interp:(char *)str
have_colors = 1;
}

gkss->fontfile = fontfile;
gks_init_core(gkss);

[self set_clip_rect:gkss->cntnr];
Expand Down Expand Up @@ -473,6 +472,11 @@ - (void)interp:(char *)str
break;

case 27:
if ((i_arr[1] == GKS_K_TEXT_PRECISION_STROKE || i_arr[1] == GKS_K_TEXT_PRECISION_CHAR) && fontfile == 0)
{
fontfile = gks_open_font();
gkss->fontfile = fontfile;
}
gkss->txfont = i_arr[0];
gkss->txprec = i_arr[1];
break;
Expand Down Expand Up @@ -652,7 +656,6 @@ - (id)initWithFrame:(NSRect)frame
size = 0;
angle = 0;
has_been_resized = 0;
fontfile = gks_open_font();
}
return self;
}
Expand Down Expand Up @@ -788,7 +791,7 @@ - (void)close
CGColorSpaceRelease(colorSpace);
colorSpace = NULL;
}
if (fontfile)
if (fontfile > 0)
{
gks_close_font(fontfile);
fontfile = 0;
Expand Down

0 comments on commit 5d7f4fd

Please sign in to comment.