文字列または文字の高さを測定するために、Groffにはどのような方法(コマンド、要求...)がありますか?

文字列または文字の高さを測定するために、Groffにはどのような方法(コマンド、要求...)がありますか?

私は文字列のサイズ(幅と高さ)を見つけることに関連する方程式の平方根をプロットするための前処理器を開発しています(EQN方程式の美学を改善しようとしています)。文字列または文字の幅を返す要求/コマンドとレジスタが見つかりました\w'H'が、高さを返す要求/コマンドが見つかりませんでした。鍵を知る方法はありますか?

とても感謝しています。

ベストアンサー1

\wエスケープシーケンスを使用するたびに、複数のレジスタはユーザーが提供した引数に関する情報で埋められます。

以下は、Gitリポジトリのgroff Texinfoマニュアルの内容を少し変更したものです。

-- Escape sequence: \w'anything'
-- Register: \n[st]
-- Register: \n[sb]
-- Register: \n[rst]
-- Register: \n[rsb]
-- Register: \n[ct]
-- Register: \n[ssc]
-- Register: \n[skw]
 Interpolate the width of ANYTHING in basic units.  This escape
 sequence allows several properties of formatted output to be
 measured without writing it out.

      The length of the string 'abc' is \w'abc'u.
          => The length of the string 'abc' is 72u.

 ANYTHING is processed in a dummy environment: this means that font
 and type size changes, for example, may occur within it without
 affecting subsequent output.

 After each use, '\w' sets several registers.

 'st'
 'sb'
      The maximum vertical displacements of the text baseline above
      and below, respectively.  The sign convention is opposite that
      of relative vertical motions; that is, depth below the
      (original) baseline is negative.  These registers are
      incorrectly documented in the AT&T 'troff' manual as "the
      highest and lowest extent of [the argument to '\w'] relative
      to the baseline".

 'rst'
 'rsb'
      Like 'st' and 'sb', but taking account of the heights and
      depths of glyphs.  In other words, these registers store the
      highest and lowest vertical positions attained by ANYTHING,
      doing what AT&T 'troff' documented 'st' and 'sb' as doing.

 'ct'
      Characterizes the geometry of glyphs occurring in ANYTHING.

      0   only short glyphs, no descenders or tall glyphs

      1   at least one descender

      2   at least one tall glyph

      3   at least one each of a descender and a tall glyph

 'ssc'
      The amount of horizontal space (possibly negative) that should
      be added to the last glyph before a subscript.

 'skw'
      How far to right of the center of the last glyph in the '\w'
      argument, the center of an accent from a roman font should be
      placed over that glyph.

ct「nroffモード」とも呼ばれる端末装置では、入力が何であっても、レジスタ値は通常ゼロであることを追加したいと思います。とにかくnroffデバイスは、細かい垂直移動が不可能であるためです。歴史的に、彼らはせいぜい半行しか移動できず、ビデオ端末とそのエミュレータはそうすることもできませんでした。

おすすめ記事