On Thursday, 3 February 2022 14:18:57 PST Tatsuro MATSUOKA wrote:
> A post was made for plot of unicode chracter.
> https://sourceforge.net/p/gnuplot/mailman/gnuplot-info/thread/66152bfa-127c-bb35-7068-91b0f215e705%40kaniuk.co.uk/#msg37602226
>
> For interactive terminal it seems to be a problem of font selection.
> However, in the postscript terminal,unicode character is not represented.
The PostScipt language does not support multi-byte encodings.
Therefore it does not support UTF-8 or any other "reasonable"
way to reference Unicode code points in general.
It is technically possible to extract a subset of Unicode entities
from a suitable font (probably *.ttf) and match them to PostScript
glyph assignments. There are instructions and examples in the
file .../term/PostScript/unicode_maps.README
However it is not worth it. Really it is not worth it.
The procedure is difficult, fragile, and does not extend well
to handle large numbers of Unicode gplyphs.
If you really require a *.ps file for some reason, it is better
to create a *.pdf file from gnuplot and then convert it from
pdf to PostScript in a separate step. This has the added benefit
that PDF support transparency, which PostScript doesn't, and
the conversion will take care of that also.
But for most purposes it would be better to use the *.pdf file
and forget about PostScript.
set terminal pdf
set output 'myplot.pdf'
set encoding utf8
plot [1:10] \
0.9*x w lp t "POINT" pt "◎", \
0.5*x w lp t "UNICODE" pt "\U+25CE", \
0.2*x w lp t "HASH" pt "#"
unset output
system("pdf2ps myplot.pdf myplot.ps")
Ethan
>
> The test script is :
>
> #!/usr/bin/gnuplot -persist
> reset session
> set encoding utf8
> set terminal wxt 1 nopersist enhanced font 'Dejavu Sans'
>
> unset key; set key on inside left
>
> set samples 20
>
> plot [1:10] \
> 0.9*x w lp t "POINT" pt "◎", \
> 0.5*x w lp t "UNICODE" pt "\U+25CE", \
> 0.2*x w lp t "HASH" pt "#"
>
> set terminal push
> set terminal postscript eps enhanced color size 20 cm, 10 cm
> set output "test-pt.eps"
> replot
> set output
> set terminal pop
> #EOF
>
> I thouht that the postscript terminal cannot handle unicode.
> However Norwid provided the detailed analysis of eps file (test-pt.eps) created by the above script
> https://sourceforge.net/p/gnuplot/mailman/message/37602883/
>
> With Inkscape (version 1.1.1) by internal import, one can see the unicode characters on the plot.
> (On Evince and Inksapce with poppler/cairo import (default), we cannot see unicode character.
> In addtion, I also cannot see unicode chracters on gv , eps viewer and adobe reader (after coverted to pdf file))
>
> Anyway, in the current state, the postscipt terminal cannot treat the unicode character properly.
> Am I right?
>
> Tatsuro
|