@@ -9906,6 +9906,7 @@ void gmt_set_undefined_axes (struct GMT_CTRL *GMT, bool conf_update) {
9906
9906
void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool conf_update) {
9907
9907
/* We must adjust all frame items with unspecified size according to plot dimension */
9908
9908
bool geo_frame = false;
9909
+ bool auto_scale = false;
9909
9910
double fontsize, scale;
9910
9911
double const pt = 1.0/72.0; /* points to inch */
9911
9912
@@ -9938,67 +9939,79 @@ void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool con
9938
9939
scale = fontsize / 10.0; /* scaling for offsets, pen widths and lengths normalized to the modern 10p size */
9939
9940
}
9940
9941
9941
- GMT_Report (GMT->parent, GMT_MSG_DEBUG, "Computed primary annotation font size: %g p Dimension scaling: %g\n", fontsize, scale);
9942
-
9943
9942
/* Only apply the automatic scaling to items NOT specifically set via a --PAR=value option */
9944
9943
9945
9944
if (gmt_M_is_dnan (GMT->current.setting.font_annot[GMT_PRIMARY].size)) {
9946
9945
GMT->current.setting.font_annot[GMT_PRIMARY].size = fontsize;
9946
+ auto_scale = true;
9947
9947
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_ANNOT_PRIMARY] = true;
9948
9948
}
9949
9949
if (gmt_M_is_dnan (GMT->current.setting.font_annot[GMT_SECONDARY].size)) {
9950
9950
GMT->current.setting.font_annot[GMT_SECONDARY].size = scale * 12.0; /* Modern 12p vs 10p */
9951
+ auto_scale = true;
9951
9952
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_ANNOT_SECONDARY] = true;
9952
9953
}
9953
9954
if (gmt_M_is_dnan (GMT->current.setting.font_label.size)) {
9954
9955
GMT->current.setting.font_label.size = scale * 14.0; /* Modern 14p vs 10p */
9956
+ auto_scale = true;
9955
9957
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_LABEL] = true;
9956
9958
}
9957
9959
if (gmt_M_is_dnan (GMT->current.setting.font_heading.size)) {
9958
9960
GMT->current.setting.font_heading.size = scale * 28.0; /* Modern 28p vs 10p */
9961
+ auto_scale = true;
9959
9962
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_HEADING] = true;
9960
9963
}
9961
9964
if (gmt_M_is_dnan (GMT->current.setting.font_tag.size)) {
9962
9965
GMT->current.setting.font_tag.size = scale * 16.0; /* Modern 16p vs 10p */
9966
+ auto_scale = true;
9963
9967
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_TAG] = true;
9964
9968
}
9965
9969
if (gmt_M_is_dnan (GMT->current.setting.font_title.size)) {
9966
9970
GMT->current.setting.font_title.size = scale * 22.0; /* Modern 22p vs 10p */
9971
+ auto_scale = true;
9967
9972
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_TITLE] = true;
9968
9973
}
9969
9974
if (gmt_M_is_dnan (GMT->current.setting.font_subtitle.size)) {
9970
9975
GMT->current.setting.font_subtitle.size = scale * 18.0; /* Modern 18p vs 10p */
9976
+ auto_scale = true;
9971
9977
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_SUBTITLE] = true;
9972
9978
}
9973
9979
if (gmt_M_is_dnan (GMT->current.setting.font_logo.size)) {
9974
9980
GMT->current.setting.font_logo.size = scale * 8.0; /* Classic 8p vs 10p */
9981
+ auto_scale = true;
9975
9982
if (conf_update) GMT_keyword_updated[GMTCASE_FONT_LOGO] = true;
9976
9983
}
9977
9984
9978
9985
/* Offsets */
9979
9986
9980
9987
if (gmt_M_is_dnan (GMT->current.setting.map_annot_offset[GMT_PRIMARY])) {
9981
9988
GMT->current.setting.map_annot_offset[GMT_PRIMARY] = 3 * pt * scale; /* 3p */
9989
+ auto_scale = true;
9982
9990
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_ANNOT_OFFSET_PRIMARY] = true;
9983
9991
}
9984
9992
if (gmt_M_is_dnan (GMT->current.setting.map_annot_offset[GMT_SECONDARY])) {
9985
9993
GMT->current.setting.map_annot_offset[GMT_SECONDARY] = 3 * pt * scale; /* 3p */
9994
+ auto_scale = true;
9986
9995
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_ANNOT_OFFSET_SECONDARY] = true;
9987
9996
}
9988
9997
if (gmt_M_is_dnan (GMT->current.setting.map_label_offset)) {
9989
9998
GMT->current.setting.map_label_offset = 6 * pt * scale; /* 6p */
9999
+ auto_scale = true;
9990
10000
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_LABEL_OFFSET] = true;
9991
10001
}
9992
10002
if (gmt_M_is_dnan (GMT->current.setting.map_title_offset)) {
9993
10003
GMT->current.setting.map_title_offset = 12 * pt * scale; /* 12p */
10004
+ auto_scale = true;
9994
10005
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_TITLE_OFFSET] = true;
9995
10006
}
9996
10007
if (gmt_M_is_dnan (GMT->current.setting.map_heading_offset)) {
9997
10008
GMT->current.setting.map_heading_offset = 16 * pt * scale; /* 16p */
10009
+ auto_scale = true;
9998
10010
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_HEADING_OFFSET] = true;
9999
10011
}
10000
10012
if (gmt_M_is_dnan (GMT->current.setting.map_annot_min_spacing)) {
10001
10013
GMT->current.setting.map_annot_min_spacing = 28 * pt * scale; /* 28p */
10014
+ auto_scale = true;
10002
10015
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_ANNOT_MIN_SPACING] = true;
10003
10016
snprintf (GMT->current.setting.map_annot_min_spacing_txt, GMT_LEN16, "%.6gp", GMT->current.setting.map_annot_min_spacing / pt);
10004
10017
}
@@ -10007,6 +10020,7 @@ void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool con
10007
10020
10008
10021
if (gmt_M_is_dnan (GMT->current.setting.map_frame_width)) {
10009
10022
GMT->current.setting.map_frame_width = 3 * pt * scale; /* 3p */
10023
+ auto_scale = true;
10010
10024
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_FRAME_WIDTH] = true;
10011
10025
}
10012
10026
@@ -10022,6 +10036,7 @@ void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool con
10022
10036
GMT->current.setting.map_tick_length[GMT_ANNOT_UPPER] = 4 * pt * scale; /* 4p */
10023
10037
GMT->current.setting.map_tick_length[GMT_TICK_UPPER] = 2 * pt * scale; /* 2p */
10024
10038
}
10039
+ auto_scale = true;
10025
10040
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_TICK_LENGTH_PRIMARY] = true;
10026
10041
}
10027
10042
if (gmt_M_is_dnan (GMT->current.setting.map_tick_length[GMT_ANNOT_LOWER])) {
@@ -10034,6 +10049,7 @@ void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool con
10034
10049
GMT->current.setting.map_tick_length[GMT_ANNOT_LOWER] = 12 * pt * scale; /* 12p */
10035
10050
GMT->current.setting.map_tick_length[GMT_TICK_LOWER] = 3 * pt * scale; /* 3p */
10036
10051
}
10052
+ auto_scale = true;
10037
10053
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_TICK_LENGTH_SECONDARY] = true;
10038
10054
}
10039
10055
@@ -10045,36 +10061,45 @@ void gmt_set_undefined_defaults (struct GMT_CTRL *GMT, double plot_dim, bool con
10045
10061
if (reach < 1.0) reach *= 60.0, f *= 60.0;
10046
10062
reach = rint (reach) / f; /* Integer degrees, minutes or seconds */
10047
10063
GMT->current.setting.map_polar_cap[0] = 90.0 - reach; /* Max 5 degrees from pole */
10064
+ auto_scale = true;
10048
10065
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_POLAR_CAP] = true;
10049
10066
}
10050
10067
10051
10068
/* Frame, tick and gridline pens */
10052
10069
10053
10070
if (gmt_M_is_dnan (GMT->current.setting.map_frame_pen.width)) {
10054
10071
GMT->current.setting.map_frame_pen.width = 1.5 * scale; /* 1.5p (thicker) */
10072
+ auto_scale = true;
10055
10073
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_FRAME_PEN] = true;
10056
10074
}
10057
10075
if (gmt_M_is_dnan (GMT->current.setting.map_tick_pen[GMT_PRIMARY].width)) {
10058
10076
GMT->current.setting.map_tick_pen[GMT_PRIMARY].width = 0.5 * scale; /* 0.5p (thinner) */
10077
+ auto_scale = true;
10059
10078
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_TICK_PEN_PRIMARY] = true;
10060
10079
}
10061
10080
if (gmt_M_is_dnan (GMT->current.setting.map_tick_pen[GMT_SECONDARY].width)) {
10062
10081
GMT->current.setting.map_tick_pen[GMT_SECONDARY].width = 0.5 * scale; /* 0.5p (thinner) */
10082
+ auto_scale = true;
10063
10083
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_TICK_PEN_SECONDARY] = true;
10064
10084
}
10065
10085
if (gmt_M_is_dnan (GMT->current.setting.map_grid_pen[GMT_PRIMARY].width)) {
10066
10086
GMT->current.setting.map_grid_pen[GMT_PRIMARY].width = 0.25 * scale; /* 0.25p (default) */
10087
+ auto_scale = true;
10067
10088
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_GRID_PEN_PRIMARY] = true;
10068
10089
}
10069
10090
if (gmt_M_is_dnan (GMT->current.setting.map_grid_pen[GMT_SECONDARY].width)) {
10070
10091
GMT->current.setting.map_grid_pen[GMT_SECONDARY].width = 0.5 * scale; /* 0.5p (thinner) */
10092
+ auto_scale = true;
10071
10093
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_GRID_PEN_SECONDARY] = true;
10072
10094
}
10073
10095
10074
10096
if (gmt_M_is_dnan (GMT->current.setting.map_vector_shape)) {
10075
10097
GMT->current.setting.map_vector_shape = 0.5;
10098
+ auto_scale = true;
10076
10099
if (conf_update) GMT_keyword_updated[GMTCASE_MAP_VECTOR_SHAPE] = true;
10077
10100
}
10101
+
10102
+ if (auto_scale) GMT_Report (GMT->parent, GMT_MSG_DEBUG, "Computed automatic parameters using dimension scaling: %g\n", scale);
10078
10103
}
10079
10104
10080
10105
GMT_LOCAL unsigned int gmtinit_parse_map_annot_oblique (struct GMT_CTRL *GMT, char *text) {
0 commit comments