# HG changeset patch # User Pantxo Diribarne # Date 1481033977 -3600 # Node ID 509b2ef72225e819b2fb0d2b0344a43f160ccf63 # Parent b150be19734dc4a25878c0e2c459ba1de89cf82c Properly initialize axes labels font properties (bug #49775) * graphics.cc (axes::properties::init): initialize the fontsize and fontweight of label * graphics.cc (axes::properties::set_defaults): dito * title.m: make use of __axis_labels__ function * __axis_labels__.m: add if block to distinguish titles from other labels diff -r b150be19734d -r 509b2ef72225 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Sun Dec 18 07:10:20 2016 -0800 +++ b/libinterp/corefcn/graphics.cc Tue Dec 06 15:19:37 2016 +0100 @@ -4600,6 +4600,15 @@ xset (zlabel.handle_value (), "__autopos_tag__", "zlabel"); xset (title.handle_value (), "__autopos_tag__", "title"); + double fs = labelfontsizemultiplier.double_value () * + fontsize.double_value (); + xset (xlabel.handle_value (), "fontsize", octave_value (fs)); + xset (ylabel.handle_value (), "fontsize", octave_value (fs)); + xset (zlabel.handle_value (), "fontsize", octave_value (fs)); + fs = titlefontsizemultiplier.double_value () * fontsize.double_value (); + xset (title.handle_value (), "fontsize", octave_value (fs)); + xset (title.handle_value (), "fontweight", titlefontweight.get ()); + adopt (xlabel.handle_value ()); adopt (ylabel.handle_value ()); adopt (zlabel.handle_value ()); @@ -5084,6 +5093,15 @@ xset (zlabel.handle_value (), "__autopos_tag__", "zlabel"); xset (title.handle_value (), "__autopos_tag__", "title"); + double fs = labelfontsizemultiplier.double_value () * + fontsize.double_value (); + xset (xlabel.handle_value (), "fontsize", octave_value (fs)); + xset (ylabel.handle_value (), "fontsize", octave_value (fs)); + xset (zlabel.handle_value (), "fontsize", octave_value (fs)); + fs = titlefontsizemultiplier.double_value () * fontsize.double_value (); + xset (title.handle_value (), "fontsize", octave_value (fs)); + xset (title.handle_value (), "fontweight", titlefontweight.get ()); + update_transform (); sync_positions (); override_defaults (bgo); diff -r b150be19734d -r 509b2ef72225 scripts/plot/appearance/private/__axis_label__.m --- a/scripts/plot/appearance/private/__axis_label__.m Sun Dec 18 07:10:20 2016 -0800 +++ b/scripts/plot/appearance/private/__axis_label__.m Tue Dec 06 15:19:37 2016 +0100 @@ -27,20 +27,15 @@ h = get (hax, caller); - set (h, "fontangle", get (hax, "fontangle"), - "fontname", get (hax, "fontname"), - "fontunits", get (hax, "fontunits"), # must precede fontsize - "fontsize", get (hax, "LabelFontSizeMultiplier") * - get (hax, "fontsize"), - "fontweight", get (hax, "fontweight"), - "string", txt, - varargin{:}); + set (h, "string", txt, varargin{:}); ## FIXME: It would be better to delete only the listener that [xyz]label ## installed. But this didn't work, so instead it deletes all ## listener's on the [xyz]color property. - dellistener (hax, [caller(1) "color"]); - addlistener (hax, [caller(1) "color"], {@cb_color, h, caller(1)}); + if (! strcmp (caller, "title")) + dellistener (hax, [caller(1) "color"]); + addlistener (hax, [caller(1) "color"], {@cb_color, h, caller(1)}); + endif if (nargout > 0) retval = h; diff -r b150be19734d -r 509b2ef72225 scripts/plot/appearance/title.m --- a/scripts/plot/appearance/title.m Sun Dec 18 07:10:20 2016 -0800 +++ b/scripts/plot/appearance/title.m Tue Dec 06 15:19:37 2016 +0100 @@ -48,16 +48,7 @@ print_usage (); endif - htmp = get (hax, "title"); - - set (htmp, "fontangle", get (hax, "fontangle"), - "fontname", get (hax, "fontname"), - "fontunits", get (hax, "fontunits"), # must precede fontsize - "fontsize", get (hax, "TitleFontSizeMultiplier") * - get (hax, "fontsize"), - "fontweight", get (hax, "titlefontweight"), - "string", varargin{1}, - varargin{2:end}); + htmp = __axis_label__ (hax, "title", varargin{:}); if (nargout > 0) h = htmp;