I am novice user who has just started using DELPHI.
I am facing a few problems.
I am using TMetafilecanvas to render text on the canvas.The'Textout'
function takes integer values for specifying the X & Y
coordinates in pixels.The coordinate values which i would like to specify
when converted to pixels results in a floating
point value,thereby forcing me to round off the value .
This is not giving me the quality of output i am looking for.
My query to the members of this group is, Is there any other way, using
which i can specify the coordinate values in
floating point.
I will be highly obliged if the members give a consideration to this
problem.
Thanking you in anticipation.
RATISH.
You cannot specify coordinates in floating point, and neither makes it
sense to do so, since the coordinate system of the device context you are
working with has a fixed granularity, it is not continuous. So some
rounding of calculated positions is inevitable.
What you can do, however, is set the granularity to a finer value. When you
create a TMetafileCanvas you can pass a reference device to the
constructor. The metafile will then take on the logical resolution of that
reference device, as well as its page size. If you leave this parameter 0
you get a metafile canvas with the logical resolution of the screen, which
is typically 96 (small fonts) or 120 (large fonts) pixels per inch. This is
not much if you compare it with the typical resolution of todays printers.
One alternative (if the metafile is for printing) is to select a printer
via Printer.PrinterIndex and then use Printer.Handle for the reference
device. This gives you a metafile with the logical resolution of the
printer.
In both cases you get a metafile canvas that uses the MM_TEXT mapping mode.
But you are not limited to that, you can define your own mapping modes by
passing the metafilecanvas.handle to API functions like SetMapMode,
SetWindowExtEx, SetViewPortExtEx.
For WYSIWYG positioning a high-resolution mapping mode like MM_HIMETRIC or
MM_TWIPS is optimal, it gives you logical units that are much smaller than
most printers dots.
Working with fonts in non-MM_TEXT mapping modes is a bit more complex than
normal. You have to set the metafilecanvas.Font.PixelsPerInch value to the
correct value for your mapping mode to be able to specify a font size in
points via the Size property, or you have to specify the font size in the
mapping modes logical units using the fonts Height property.
--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be