ConTeXt:在網格上放置高度一致的影像

ConTeXt:在網格上放置高度一致的影像

在為宣傳冊創建佈局時,我開始考慮將圖像以一致的高度放置在頁面上。我已經準備好了一堆 15x10cm 的 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

在此輸入影像描述

相關內容