ConTeXt中同一行不同大小字體的垂直對齊

ConTeXt中同一行不同大小字體的垂直對齊

給定一個這樣的文檔

\starttext
\setupbodyfont[palatino,8pt] small
\setupbodyfont[palatino,12pt] normal
\setupbodyfont[palatino,16pt] big
\stoptext

我如何將這些單字垂直居中?

答案1

這在一定程度上取決於您想要實現的目標。一種方法是使用\framed[location=lohi].例如

\defineframed
  [vcentered]
  [
    location=lohi,
    frame=off,
  ]

\starttext
\dontleavehmode
\vcentered[foregroundstyle={\switchtobodyfont[palatino,8pt]}]{small}
\vcentered[foregroundstyle={\switchtobodyfont[palatino,12pt]}]{normal}
\vcentered[foregroundstyle={\switchtobodyfont[palatino,16pt]}]{big}
\stoptext

在此輸入影像描述

相關內容