Skip to content

FONT_ANNOT black ignored with -B+t+s #5156

Closed

Description

@KristofKoch

Description of the problem

When using a plot subtitle via -B+t+s the annotation color FONT_ANNOT black gets ignored and the annotation is colored in MAP_FRAME_PEN. This seems only true for FONT_ANNOT black. All other colors get honored.

When using -B+t, FONT_ANNOT black and MAP_FRAME_PEN green everything works as expected:

black_no_subtitle

The same as above but now with an additional subtitle -B+t+s:

black_subtitle

Observe how the map annotations became the color of MAP_FRAME_PEN instead of black. When doing the same with another color than black, e.g. FONT_ANNOT red, everything works as expected:

red_subtitle

Full script that generated the error

#!/usr/bin/env bash

### FAILS - black, subtitle ###
gmt begin black_subtitle png
  gmt basemap -R-24.46/-23.99/16.45/16.72 -Jm1:800000 -Bga \
    -B+t"FONT_ANNOT black"+s"I'm a Subtitle" \
    --FONT_ANNOT=black \
    --MAP_FRAME_PEN=green
gmt end show

### WORKS - black, no subtitle ###
gmt begin black_no_subtitle png
  gmt basemap -R-24.46/-23.99/16.45/16.72 -Jm1:800000 -Bga \
    -B+t"FONT_ANNOT black" \
    --FONT_ANNOT=black \
    --MAP_FRAME_PEN=green
gmt end show

### WORKS - red, subtitle ###
gmt begin red_subtitle png
  gmt basemap -R-24.46/-23.99/16.45/16.72 -Jm1:800000 -Bga \
    -B+t"FONT_ANNOT red"+s"I'm a Subtitle" \
    --FONT_ANNOT=red \
    --MAP_FRAME_PEN=green
gmt end show

### WORKS - red, no subtitle ###
gmt begin red_no_subtitle png
  gmt basemap -R-24.46/-23.99/16.45/16.72 -Jm1:800000 -Bga \
    -B+t"FONT_ANNOT red" \
    --FONT_ANNOT=red \
    --MAP_FRAME_PEN=green
gmt end show

Actual outcome

Map annotations become the color of the map frame if the color for map annotations is set to black and a subtitle is added. Map annotation colors other than black are honored.

Expected outcome

I expect the map annotations in the defined color regardless of subtitle.

System information

  • Operating system: Linux
  • GMT version (gmt --version): 6.2.0rc1

Activity

  1. added
    bug
    on Apr 19, 2021
  2. maxrjones commented on Apr 20, 2021

    @maxrjones
    Member

    Thanks for posting @KristofKoch, I will look into this now.

  3. self-assigned this
    on Apr 20, 2021
  4. maxrjones commented on Apr 22, 2021

    @maxrjones
    Member

    @PaulWessel, the gsave/grestore block on L6197 - L6255 in src/gmt_plot.c does not seem to work well for isolating changes associated with subtitles. I have not been able to figure out a solution other than not adding the V and U to the postscript file, which I suspect would cause other issues.

  5. PaulWessel commented on Apr 23, 2021

    @PaulWessel
    Contributor

    Sorry preoccupied. Will start on this later this pm.

  6. added a commit that references this issue on Apr 25, 2021
    74f0d1c
  7. added a commit that references this issue on Apr 25, 2021
    b360c4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions