问题描述
问题是当我在渲染图元文件时,文本太大了。 Irfanview和FastReports渲染如下:
windows 7绘画渲染正常:(这是文本应该是什么样子)
任何想法是什么导致的?
谢谢!
p> emf
文件只是一个GDI命令列表。实际上,使用标准的Windows GDI命令(在Delphi中,一个 TMetaFile
只是围绕这些API的一个包装),可以很容易地播放系统。 / p>
当IrfanView 或 FastReport 呈现图元文件内容时,他们只是使用Windows GDI相应的命令。当Windows 7 Paint 显示元文件内容时,它将使用GDI +渲染器。我甚至认为它会将 emf
文件内部转换为 emf +
格式,然后使用GDI +进行反加工。 / p>
所以如果 emf
文件在IrfanView 或 FastReport em>,我怀疑这是因为你的图元文件形式不完整:你使用的第三方图形引擎是生产非标准的emf。一个可能的问题是目标系统中使用的字体缺失,而GDI不会替换与GDI +相同的字体。
另一个可能的是, code> emf 文件可能是一种双重格式:它包含 emf
格式(这不正确使用GDI)和 emf +
格式(按照预期使用GDI +呈现)创建的结果不正确。通常这个双重 emf / emf +
格式不应该存在:即使是官方的GDI +库也不允许将其元文件内容保存在emf + / em>。这是由您的第三方图书馆创建的某种怪物格式。
我建议如下:
- 下载并检查您的
emf
文件与; - 尝试使用GDI +来呈现图元文件;
- 尝试使用
emf
到emf +
转换器API。
要使用GDI +,请查看开源:它将添加GDI +反加工到您生成的位图。它可以将 emf
转换为 emf +
。它将使用原生Vista / Seven API(就像Windows 7绘图),或Windows XP下的普通Delphi代码。
I'm having a problem with metafile rendering in my Delphi XE application.
the problem is that when I'm rendering the metafile, the texts are too large. Irfanview and FastReports render it like this:
windows 7 Paint renders it fine: (here's what the text should look like)
Any ideas what is causing this?
Thank you!
emf
files are just a list of GDI commands. In fact, they can be "played back" very easily by the system, using standard Windows GDI command (in Delphi, a TMetaFile
is just a wrapper around those APIs).
When IrfanView or FastReport renders the metafile content, they just use Windows GDI corresponding commands. When Windows 7 Paint renders the metafile content, it uses the GDI+ renderer. I even think it internally convert the emf
file into emf+
format, then renders it with anti-aliaising using GDI+.
So if the emf
file renders incorrectly in IrfanView or FastReport, I suspect this is because your metafile is not well formed: the third party graphic engine you are using is producing non standard emf. A possible issue is that the font used is missing in the target system, and GDI does not substitute the font with the same as GDI+ does.
Another possibility is that the emf
file is maybe a dual format: it contains both emf
format (which was not properly created so is not rendered correctly using GDI) and emf+
format (which is rendered as expected using GDI+). Normally this dual emf/emf+
format should not exist: even the official GDI+ library does not allow to save its metafile content in emf+. This is some kind of "monster" format, created by your third-party library.
I suggest the following:
- Download and check your
emf
file with EmfExplorer; - Try to use GDI+ to render the metafile;
- Try to use the
emf
toemf+
converter API.
For using GDI+, take a look at an Open Source SynGdiPlus unit: it will add GDI+ anti-aliaising to your produced bitmap. It is able to convert emf
to emf+
. It will use native Vista/Seven API (just like Windows 7 paint), or plain Delphi code under Windows XP.
这篇关于当渲染元文件时,文本太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!