Board index » delphi » Creating wmf/emf of TextOut call

Creating wmf/emf of TextOut call

I'm generating bitmaps by using textout on a bitmap canvas, and assiging
the bitmap to a TImage. I then save the image as bmp files.
I would like to save images as wmf/emf files. Using the same code but
saving files as wmf, produces zero sized files. In this case, I am
creating a TMetaFile and again using textout, I'm drawing text onto the
Canvas and assiging the result to a TImage.
Has anyone hereabouts done any textout to wmf/emf creation? And are there
any special methods required here. The help is fairly sketchy on this
subject.

Neil Beshoori
NRB Systems UK

 

Re:Creating wmf/emf of TextOut call


Did you create a TMetaFileCanvas and draw on this canvas? When
TMetaFileCanvas will be free, metafile will "see" every changes.

Also check if you didn't forget to define Width/Height of your metafile
It work well for me - I used it in own SMReport Designer...

--
With best regards, Mike Shkolnik
E-Mail: mshkol...@scalabium.com
        mshkol...@yahoo.com
WEB: http://www.scalabium.com

<b...@cix.compulink.co.uk> D???
???Y??:a6qodr$2q...@thorium.cix.co.uk...

Quote
> I'm generating bitmaps by using textout on a bitmap canvas, and assiging
> the bitmap to a TImage. I then save the image as bmp files.
> I would like to save images as wmf/emf files. Using the same code but
> saving files as wmf, produces zero sized files. In this case, I am
> creating a TMetaFile and again using textout, I'm drawing text onto the
> Canvas and assiging the result to a TImage.
> Has anyone hereabouts done any textout to wmf/emf creation? And are there
> any special methods required here. The help is fairly sketchy on this
> subject.

> Neil Beshoori
> NRB Systems UK

Re:Creating wmf/emf of TextOut call


In article <a6sbha$9u...@news.lucky.net>, mshkol...@yahoo.com (Mike

Quote
Shkolnik) wrote:
> Did you create a TMetaFileCanvas and draw on this canvas? When
> TMetaFileCanvas will be free, metafile will "see" every changes.

> Also check if you didn't forget to define Width/Height of your metafile
> It work well for me - I used it in own SMReport Designer...

Thanks Mike

Your reply clarified the help file.
I couldn't get my head round the fact that the MetaFile Canvas had to be
created, drawn on and then destroyed before the contents got transferred
to the Metafile.

I've got one problem [though I should be able to work it out], I need to
set the Metafile width/height to be exactly the dimensions of a single
character that I'll be drawing. I'm using DrawText at present, but I think
TextOut will give me more control. Or maybe I can use some textmetrics
function to establish the Metafile size.

Neil Beshoori
NRB Systems UK

Re:Creating wmf/emf of TextOut call


In article <a6su61$6t...@thorium.cix.co.uk>, b...@cix.compulink.co.uk ()
wrote:

Quote
> Thanks Mike

> Your reply clarified the help file.
> I couldn't get my head round the fact that the MetaFile Canvas had to
> be created, drawn on and then destroyed before the contents got
> transferred to the Metafile.

I have got the code working and generating correct files...*but*

If I view the emf on a machine that has the font installed, everythings
works. If the original font used with TextOut is not installed, the emf
will susbstitute the font, hence creating the wrong image!!

Is there anyway round this problem?
Much hair lost already

Neil Beshoori
NRB Systems UK

Other Threads