什么是IDWriteTextLayout使用的默认印刷设置? [英] What are the default typography settings used by IDWriteTextLayout?
问题描述
我想禁用连字符,默认情况下这个连字符是启用的,至少在我使用的字体(即Calibri)中是这样的。看来,这样做的方式是使用 IDWriteTextLayout :: SetTypography
来设置一个 IDWriteTypography
对象的布局包含值为零的各种连字相关字体特征以禁用它们。这可以禁用连字,但是也会影响(禁用)其他不需要的字体设置,例如字距。
经过一些实验,事实证明,我可以通过设置一个空的 IDWriteTypography
对象(一个由 IDWriteFactory
然后应用于布局而不改变)。一个空白的排版似乎有所有可能的字体功能设置为零/禁用的效果。所以我真正想要做的是检索默认的版式设置,重写与连字有关的,然后将其设置为布局。
不幸的是我找不到随时随地取回默认设置。如果没有设置,使用 IDWriteTextLayout :: GetTypography
只会返回null,但是很明显,它有各种排版设置,例如在这种情况下启用连字符。我也无法在 IDWriteFactory
(或其任何新版本)或任何与字体相关的界面上找到任何其他方法来创建 IDWriteTypography
实例。在没有设置 IDWriteTypography
时, IDWriteTextLayout
如何决定使用哪种排版设置?是字体特定的默认设置?我可以以某种方式检索这些设置,以便我可以调整其中的一些设置,并继承其余的默认值吗?
没有办法从IDWriteTextLayout或IDWriteTextAnalyzer中获得默认的功能,而不是,它不是字体特定的,它是特定于脚本的。
如果你对于一般的工作方式感兴趣,你可以使用像HarfBuzz这样的开源实现,你可以找到在整形过程中应用的特定于脚本的特性数组。
这是在OpenType文档中记录的,阿拉伯语示例 - https:// www。 microsoft.com/typography/OpenTypeDev/arabic/intro.htm 。
I would like to disable ligatures, which appear to be enabled by default, at least in the fonts that I'm using (i.e. Calibri). It appears that the way to do this is to use IDWriteTextLayout::SetTypography
to set an IDWriteTypography
object to the layout which contains the various ligature-related font features with a value of zero to disable them. That works to disable the ligatures, but it also affects (disables) other typography settings that I don't want to mess with, such as kerning.
After some experimentation, it turns out that I could disable ligatures just by setting an empty IDWriteTypography
object (one that was simply created by the IDWriteFactory
and then applied to the layout without alteration). An empty typography seems to have the effect of setting all possible font features to zero/disable. So what I actually want to do is retrieve the default typography settings, override the ones related to ligatures, and then set that to the layout.
Unfortunately I can't find anywhere to retrieve the default settings. Using IDWriteTextLayout::GetTypography
just returns null if none has been set, yet it clearly has various typography settings like ligatures enabled in that case. I also can't find any other methods on IDWriteFactory
(or any of its newer versions) or any of the font-related interfaces for creating an IDWriteTypography
instance. How does the IDWriteTextLayout
decide which typography settings to use when no IDWriteTypography
has been set? Are the default settings font-specific? Can I retrieve those settings somehow so that I can tweak a few of them and inherit the default values for the rest?
There's no way to get default set of features out of IDWriteTextLayout, or IDWriteTextAnalyzer to be more precise, and no, it's not font-specific, it's script-specific.
If you're interested in how it works in general, you can use opensource implementations like HarfBuzz, you can find arrays of script-specific features that are applied during shaping.
Microsoft approach to that is documented in OpenType documentation, an example for Arabic - https://www.microsoft.com/typography/OpenTypeDev/arabic/intro.htm.
这篇关于什么是IDWriteTextLayout使用的默认印刷设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!