enscriptは同じファイルで複数のフォントをサポートしていますか?

enscriptは同じファイルで複数のフォントをサポートしていますか?

私の要件は、入力の特定の部分を1つのフォント(サイズ、太字、背景などが異なる場合があります)として印刷し、別のフォントを保持することです。可能ですか?

ベストアンサー1

はい、エスケープシーケンスはテキストに使用でき、コマンドラインオプションで使用または有効にする-e必要があります--escapes

マニュアルページ( )man enscriptの「SPECIAL ESCAPES」セクションを確認してください。

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単位でサイズを追加します。

おすすめ記事