Maori Language Characters?

Linux terminals have used unicode (utf8) for a while. The above might work after chcp 65001 so the string input is also utf8:

C:\Documents and Settings\mkononets\Desktop>chcp 437
Active code page: 437

C:\Documents and Settings\mkononets\Desktop>echo "Īī Ii" > test.txt

C:\Documents and Settings\mkononets\Desktop>type test.txt
"Ii Ii"

C:\Documents and Settings\mkononets\Desktop>chcp 65001
Active code page: 65001

C:\Documents and Settings\mkononets\Desktop>echo "Īī Ii" > test.txt

C:\Documents and Settings\mkononets\Desktop>type test.txt
"Īī Ii"

C:\Documents and Settings\mkononets\Desktop>chcp 437
Active code page: 437

C:\Documents and Settings\mkononets\Desktop>type test.txt
"─¬─½ Ii"

the above is on Windows XP cmd.exe. codepage 65001 is supposed to be utf8.

I can reproduce that exactly with the Windows terminal (which is not the old Windows cmd). But even with chcp 65001 your example doesn’t work for me. It print just the ASCII characters.

I suspect progress could be made on this by setting the encoding to ISO8859-13, and using a custom font as described in manual and example 31(???). I tried this last night, but didn’t get the font stuff working properly.

This is definitively an area where I know little. But if people are able to make GMT plots with Chinese characters I would say that all the other should be possible as well.

Cracked it.

Firstly get the font that you want to install. How this is done depends on the operating system. For MacOS with homebrew, the following sufficed to install the Biolinum font:

brew install font-linux-biolinum

Then find the directory where the font was installed, and note this. In my case the fonts were installed in ~/Library/Fonts - your directory will differ. Also note what the installed font was actually called:

$ ls -1 ~/Library/Fonts/*Biolinum*
/Users/tim/Library/Fonts/LinBiolinum_Kah.ttf
/Users/tim/Library/Fonts/LinBiolinum_Rah.ttf
/Users/tim/Library/Fonts/LinBiolinum_RBah.ttf
/Users/tim/Library/Fonts/LinBiolinum_RIah.ttf

The font I’m interested in is LinBiolinum_Rah which is the regular font. The others are a “key” font (looks like typewriter keys), bold and italics.

The following script shows an example of using the newly installed font with an alternative character encoding. Make sure you change the PS_CONVERT line to include the directory where your font was installed, and specify the correct name for the font you want to use.

#!/usr/bin/env bash

function gmtstr(){
	echo "${1}" | sed -e 's/ʻ/\\140/g' \
		-e 's/:/\\072/g' \
		-e 's/ā/\\342/g' \
		-e 's/Ā/\\302/g' \
		-e 's/ō/\\364/g' \
		-e 's/Ō/\\324/g' \
		-e 's/ē/\\347/g' \
		-e 's/Ē/\\307/g' \
		-e 's/ū/\\373/g' \
		-e 's/Ū/\\333/g' \
		-e 's/ī/\\356/g' \
		-e 's/Ī/\\316/g'
}

gmt begin fontexample png
	# Set FONTPATH used in image conversion
	# $(dirname 0) is the path to the current bash script
	gmt set PS_CONVERT="C-sFONTPATH=/Users/tim/Library/Fonts"

	# create file PSL_custom_fonts.txt in current working directory
	# and add PostScript font names of Linux Biolinum
	awk '{print $1, 0.700, 0}' <<- EOF > PSL_custom_fonts.txt
	LinBiolinum_Rah
	EOF

	# common settings
	gmt set MAP_DEGREE_SYMBOL degree PS_CHAR_ENCODING ISO-8859-13 \
		FONT LinBiolinum_Rah FONT_TITLE 24p,LinBiolinum_Rah
	gmt coast -Df -JT-177/0/15c -R-175:23:0.5/-21:29:0.5/-174:51:0.5/-21:0:0.5+r \
		-Wthinnest,black -BWSen+t$(gmtstr "ʻĀŌĒŪĪāōēūī") \
		-Bpxf3ma15mg15m -Bpyf3ma15mg15m -Scyan -Ggreen
gmt end show

And here is the proof it works: