PdfSharpCore 字体大小单位没有意义而且看起来不正确

问题描述 投票:0回答:2

我对 PdfSharpCore 中的字体大小感到困惑。

XFont
的文档说字体大小指定为“emSize”。

根据w3.org,em大小代表字体大小。根据 W3 SchoolsEM 的大小或百分比取决于其父级。 而根据维基百科,它最初的意思是字母“M”的宽度。

当没有现有字体时,如何使用字体大小、取决于其“父级”或基于现有字体的任何其他属性的值来指定字体大小?

在实践中,我指定的值似乎被解释为非常接近点。但如果它真的是指定点,为什么它会被记录为“emSize?”

谁能阐明我如何使用 em 大小来设置字体大小?我将使用什么 em 大小来指定 14 磅?

.net pdf .net-core pdfsharp pdfsharpcore
2个回答
1
投票

从技术上讲,根据 PDF 规范,“Tf”运算符中的字体大小只是一个比例因子。
最终的字体大小由这个公式给出:

|Tfs×Th   0    0|
|  0    Tfs    0| × Tm × CTM
|  0    Trise  1|

Tfs   - text font size for Tf operator (usually the font size in the API)
Th    - text horizontal scaling
Trise - text rise
Tm    - text matrix
CTM   - current transformation matrix

假设默认用户单位为PDF点,Tm和CTM为单位矩阵(无缩放),Trise=0,Th=100(无缩放),则最终字体大小为PDF点中的Tfs


0
投票

要了解 emSize 的起源,我们需要及时回到打印机手册,当时 Modern MECHANICK 印刷开始,最好的来源是 1683 年的 PDF,其中所有字母都被描述为基于 42 单位 x 42 单位,如页面所述98-99 以

开头
..the divided Line on the
Left Hand of A is divided into forty and two equal
Parts ; and that Length is the Body, thus : J being
an Aʃcending and Deʃcending Letter, viz. a long
Letter, ʃtands upon forty two Parts, and therefore
fills the whole Body.
....
And as there is three Heighths or Sizes to be con-
ʃidered in Letters Cut to the ʃame Body, ʃo is there
three Sizes to be conʃidered, with reʃpect to the
Thickneʃʃes of all theʃe Letters, when the Punches
are to be Forged : For ʃome are m thick ; by m
thick is meant m Quadrat thick, which is juʃt ʃo thick
as the Body is high : Some are n thick ; that is to
say, n Quadrat thick, viz. half ʃo thick as the Body
is high : And ʃome are Space thick ; that is, one
quarter ʃo thick as the Body is high ; though Spaces
are ʃeldom Caʃt ʃo thick, as ʃhall be shewed when
we come to Caʃting : and therefore, for diʃtinction
ʃake, we hall call theʃe Spaces, Thick Spaces.

当时也有例外

... moʃt of the
Swaʃh Letters ; which being too thick to ʃtand on
an m, muʃt be Forged thicker, according to the
Work-man’s Reaʃon.

我们将其称为现代术语“绘图员执照”

请注意,他们可以将其称为 1 bodySize 或 jaySize,但用所有上升字母中最四边形的字母来描述宽度变量更容易。任何字体的成品尺寸都是基于 M 的库存宽度。因此,整体“字体主体”尺寸被认为是它的“m 尺寸”,一个基于正方形宽度 = 高度的抽象值。

© www.soinside.com 2019 - 2024. All rights reserved.