@@ -34,7 +34,7 @@ def _create_logo( # noqa: PLR0915
3434 size = 4
3535 proj = "x1c"
3636 region = {
37- "horizontal" : [- size , size * 8 .0 , - size , size ],
37+ "horizontal" : [- size , size * 7 .0 , - size , size ],
3838 "vertical" : [- size , size , - size * 1.75 , size ],
3939 "none" : [- size , size , - size , size ],
4040 }[wordmark ]
@@ -79,12 +79,27 @@ def _create_logo( # noqa: PLR0915
7979 hex_factor = 1.1
8080
8181 # Define wordmark
82+ # See https://github.com/GenericMappingTools/pygmt/pull/4627#issuecomment-4437317011
83+ # for the rationale behind the magic values.
8284 font = "AvantGarde-Book"
85+ pheight = 0.739 # Height of letter "P"
86+ plsb = 0.076 # Left side bearing of letter "P"
87+ pstroke = 0.0735 # Stroke thickness of letter "P"
88+
8389 match wordmark :
8490 case "vertical" :
85- args_text_wm = {"x" : 0 , "y" : - 4.5 , "justify" : "CT" , "font" : f"2.4c,{ font } " }
91+ args_wordmark = {"x" : 0 , "y" : - 4.5 , "justify" : "CT" , "font" : f"2.4c,{ font } " }
8692 case "horizontal" :
87- args_text_wm = {"x" : 4.5 , "y" : 0.8 , "justify" : "LM" , "font" : f"8c,{ font } " }
93+ # The stroke width matches the outline thickness.
94+ # The left edge of "P" is aligned at y=size * 1.25.
95+ # Letters "PGMT" are placed vertically centered at y=0.
96+ fontsize = thick_shape / pstroke
97+ args_wordmark = {
98+ "x" : size * 1.25 - plsb * fontsize ,
99+ "y" : - pheight / 2.0 * fontsize ,
100+ "justify" : "BL" ,
101+ "font" : f"{ fontsize } c,{ font } " ,
102+ }
88103
89104 def _letter_g_coords ():
90105 """Coordinates for letter G."""
@@ -218,7 +233,7 @@ def _compass_lines():
218233
219234 # Add wordmark "PyGMT"
220235 if wordmark != "none" :
221- fig .text (text = f"@;{ color_py } ;Py@;;@;{ color_gmt } ;GMT@;;" , ** args_text_wm )
236+ fig .text (text = f"@;{ color_py } ;Py@;;@;{ color_gmt } ;GMT@;;" , ** args_wordmark )
222237
223238 # Helpful for implementing the logo; not included in the logo
224239 if debug :
@@ -237,6 +252,11 @@ def _compass_lines():
237252 fig .hlines (y = [r4 , r5 ], xmin = - size_s , xmax = size_s , pen = pen , perspective = True )
238253 m_mid = (thick_gap + r4 ) / 2
239254 fig .vlines (x = [r4 , m_mid ], ymin = - size_s , ymax = size_s , pen = pen , perspective = True )
255+ # Lines for wordmark
256+ if wordmark == "horizontal" :
257+ halfheight = pheight / 2.0 * fontsize
258+ fig .hlines (y = [- halfheight , halfheight ], xmin = size , pen = pen )
259+ fig .vlines (x = [size * 1.25 , size * 1.25 + pstroke * fontsize ], pen = pen )
240260
241261 if figname :
242262 fig .savefig (fname = figname )
0 commit comments