Enscript
enscript 是否支持同一文件上的多種字型
我的要求是以一種字型列印輸入的某些部分(也可以是不同的大小、粗體、bg 等)並保留另一種字型。是否可以?
是的,可以在文本中使用轉義序列,必須使用命令行選項
-e
或--escapes
.查看手冊頁 (
man enscript
) 中的“特殊轉義”部分。SPECIAL ESCAPES Enscript supports special escape sequences which can be used to add some page formatting commands to ASCII documents. As a default, special escapes interpretation is off, so all ASCII files print out as everyone expects. Special escapes interpretation is activated by giving option -e, --escapes to enscript. All special escapes start with the escape character. The default escape character is ^@ (octal 000); escape character can be changed with option -e, --escapes. Escape character is followed by escape's name and optional options and arguments. Currently enscript supports following escapes: bgcolor change the text background color. The syntax of the escape is: ^@bgcolor{red green blue} where the color components red, green, and blue are given as decimal numbers between values 0 and 1. bggray change the text background color. The syntax of the escape is: ^@bggray{gray} where gray is the new text background gray value. The default value is 1.0 (white). color change the text color. The syntax of the escape is: ^@color{red green blue} where color components red, green and blue are given as decimal numbers between values 0 and 1.
再往下說:
font select current font. The syntax of the escape is: ^@font{fontname[:encoding]} where fontname is a standard font specification. Special font specification default can be used to select the default body font (enscript's default or the one specified by the command line option -f, --font). The optional argument encoding specifies the encoding that should be used for the new font. Currently the encoding can only be the enscript's global input encoding or ps.
編輯:
一個例子:
me@debian:~$ echo "normal text @color{1 0 0}red text @font{Courier-Bold10}Courier-Bold 10pt @font{Helvetica-BoldOblique12}Helvetica-BoldOblique 12pt @font{default}default font again" > text.txt me@debian:~$ enscript -v -e@ text.txt -o text.ps AFM: scanning path... AFM: reading font map "/usr/share/enscript/afm/font.map" processing file "text.txt"... [ 1 page * 1 copy ] left in text.ps
查看定義您的 font.map 文件的字型名稱。取一個字型名稱並為其添加大小(以 pt 為單位)。