ConTeXt: グリッド上に一定の高さで画像を配置する

ConTeXt: グリッド上に一定の高さで画像を配置する

パンフレットのレイアウトを作成しているときに、一定の高さでページに画像を配置することを考え始めました。15 x 10 cm の画像が PDF ファイルとしてたくさん用意されています。

DTP アプリケーションでは、定義された寸法の画像ボックスを配置します。そして、そこにクリップされた画像を配置します。

ConTeXtで同様のことを試してみました。\clip例えば、10 x 行の高さの画像を取得するために関数を使用しました。また、https://wiki.contextgarden.net/Example_photo_page_layout

\define[2]\ClippedFigure{
    \startplacefigure[location=force,title={#1}]
    \clip[height=\dimexpr10\lineheight+\exheight\relax]{
        \externalfigure[{#2}][width=\textwidth]
    }
    \stopplacefigure
}

これは、ベースライン グリッド上で一貫した寸法の画像を取得するための推奨されるアプローチですか?

当然ながら、最初にすべての画像ファイルをスケーリング/トリミングすることは、どのような場合でも可能です。

答え1

ウィキによれば、\startlinecorrectionそして\stoplinecorrectionただし、結果が期待どおりであるかどうかはわかりません。以下の例をご覧ください。

\setuplayout
  [grid=on]
% This loads cow.pdf for purposes of testing
% \setupexternalfigures[location={local,global,default}]
% And this show the grid...
% \showgrid
\starttexdefinition ClippedFigure #1 #2
  \startplacefigure[location={force},title={#1}]
  \startlinecorrection
  % \exheight adds one more line
  \clip[height=\dimexpr10\lineheight\relax]{
    \externalfigure[#2][width=\textwidth]
  }
  \stoplinecorrection
  \stopplacefigure
\stoptexdefinition
\starttext
\ClippedFigure{Cow}{cow.pdf}
\stoptext

ここに画像の説明を入力してください

関連情報