File tree 2 files changed +10
-14
lines changed
2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -506,17 +506,16 @@ def build_arg_list( # noqa: PLR0912
506
506
else :
507
507
gmt_args .append (f"-{ key } { value } " )
508
508
509
- # Convert non-ASCII characters (if any) in the arguments to octal codes
510
- encoding = _check_encoding ("" .join (gmt_args ))
511
- if encoding != "ascii" :
512
- gmt_args = [non_ascii_to_octal (arg , encoding = encoding ) for arg in gmt_args ]
513
509
gmt_args = sorted (gmt_args )
514
510
515
- # Set --PS_CHAR_ENCODING=encoding if necessary
516
- if encoding not in {"ascii" , "ISOLatin1+" } and not (
517
- confdict and "PS_CHAR_ENCODING" in confdict
518
- ):
519
- gmt_args .append (f"--PS_CHAR_ENCODING={ encoding } " )
511
+ # Convert non-ASCII characters (if any) in the arguments to octal codes and set
512
+ # --PS_CHAR_ENCODING=encoding if necessary
513
+ if (encoding := _check_encoding ("" .join (gmt_args ))) != "ascii" :
514
+ gmt_args = [non_ascii_to_octal (arg , encoding = encoding ) for arg in gmt_args ]
515
+
516
+ # Set --PS_CHAR_ENCODING=encoding if necessary
517
+ if not (confdict and "PS_CHAR_ENCODING" in confdict ):
518
+ gmt_args .append (f"--PS_CHAR_ENCODING={ encoding } " )
520
519
521
520
if confdict :
522
521
gmt_args .extend (f"--{ key } ={ value } " for key , value in confdict .items ())
Original file line number Diff line number Diff line change @@ -238,15 +238,12 @@ def text_( # noqa: PLR0912
238
238
239
239
# Append text to the last column. Text must be passed in as str type.
240
240
text = np .asarray (text , dtype = np .str_ )
241
- encoding = _check_encoding ("" .join (text .flatten ()))
242
- if encoding != "ascii" :
241
+ if (encoding := _check_encoding ("" .join (text .flatten ()))) != "ascii" :
243
242
text = np .vectorize (non_ascii_to_octal , excluded = "encoding" )(
244
243
text , encoding = encoding
245
244
)
245
+ confdict ["PS_CHAR_ENCODING" ] = encoding
246
246
extra_arrays .append (text )
247
-
248
- if encoding not in {"ascii" , "ISOLatin1+" }:
249
- confdict = {"PS_CHAR_ENCODING" : encoding }
250
247
else :
251
248
if isinstance (position , str ):
252
249
kwargs ["F" ] += f"+c{ position } +t{ text } "
You can’t perform that action at this time.
0 commit comments