|
From: Jun T <tak...@kb...> - 2018-07-05 13:54:12
|
[Problem]
aqua terminal has a problem in setting font for each label (or title etc.)
if enhanced mode is in use. For example, if I run
gnuplot> set term aqua font "Times,16"
gnuplot> label 1 "A_{ij}" at 0,0 font "Arial,30"
gnuplot> plot sin(x)
then A_{ij} is drawn in the default font "Times", although the size is
correct (i.e., 30). If "A_{ij}" is replaced by "A" (no enhanced mode)
then it is drawn in the specified font "Arial".
The problem is, in enhanced mode, ENHAQUA_put_text() calls
enhanced_recursion() with fontname=AQUA_fontNameCur (because
ENHAQUA_put_text() does not know the correct font for the current label),
but AQUA_fontNameCur has not been set by AQUA_set_font() (which is
called just before ENHAQUA_put_text()).
[A Possible Patch]
In the attached patch, AQUA_set_font() is rewritten so that it takes
care of AQUA_fontNameCur properly. The variable AQUA_fontNameDef was there
but not used anywhere, so I used it to save the default font name.
AQUA_set_font("name") will set AQUA_fontNameCur to "name", and
AQUA_set_font("") will reset AQUA_fontNameCur to AQUA_fontNameDef.
AQUA_fontNameDef (and AQUA_fontNameCur also) is set in AQUA_options()
(i.e., 'set term aqua font "name"' or 'set termoption font "name"').
I introduced two helper functions to simplify the code.
[Is this OK?]
In the helper function set_font_size(), h_tic and v_tic are also reset.
Before the patch, they were reset only in AQUA_init(), but I *guess*
they need be reset every time font size changes. Is there any test case
in which not resetting h_tic/v_tic causes a problem?
Jun
|