简体   繁体   English

如何从字体中获得下划线字体的几何形状? 的CreateFont

[英]How do you get underline font geometry from font? CreateFont

I have a library that extracts the text geometry from a truetype font file. 我有一个从truetype字体文件中提取文本几何图形的库。

I use a call to CreateFont to get hold of the glyph indices and then I read the bytestream to get the point data. 我使用对CreateFont的调用来获取字形索引,然后读取字节流以获取点数据。

http://msdn.microsoft.com/en-us/library/windows/desktop/dd183499(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/dd183499(v=vs.85).aspx

The issue is that if I pass true in the underline argument, The geometry does not contain the underline. 问题是,如果我在下划线参数中传递true,则几何不包含下划线。 Is there something specific that needs to be done?? 有什么需要做的具体事情吗?

The doc reads: fdwUnderline [in] Specifies an underlined font if set to TRUE. 文档读取: fdwUnderline [in]如果设置为TRUE,则指定带下划线的字体。

This will help a lot! 这会很有帮助!

Truetype fonts don't have separate underlined variants. Truetype字体没有带下划线的变体。 For example, when you select underlined Arial, Windows uses regular Arial and draws a line under it. 例如,当您选择带下划线的Arial时,Windows将使用常规Arial并在其下绘制一条线。 If you read the geometry from a ttf file you get the geometry without an underline, because that's what the file contains. 如果您从ttf文件中读取几何图形,则会得到没有下划线的几何图形,因为这就是该文件所包含的内容。

If you want the "as drawn" geometry, select an outline font and call BeginPath , TextOut , EndPath and GetPath . 如果要使用“绘制的”几何图形,请选择轮廓字体,然后调用BeginPathTextOutEndPathGetPath

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM