Link to home
Start Free TrialLog in
Avatar of garibaldi
garibaldi

asked on

MapModes and TextOut functions

I want print correct scaled truetype text onto a Canvas or DC while mapmode "MM_ISOTROPIC" is active (need
this for scaling documents for screens and printers).
Setting MapMode and textout is not enought, Windows
seems to scale the text not correct (logical widths of one
string differ irregular up to 10 %). Knows somebody a method to adjust this ?
Avatar of javiertb
javiertb

Here you have what Borland Development Support Team says about it:

While it is possible to scale drawing coordinates accuratly,
the Windows font mapper seems not to. A good example is when
scaling the playout of a Metafile. Often, character strings
do not align, and in some cases, the font mapper will substitute
an entirly different font at some scaling factors. An example
pragram proved this, where at 100% the Truetype was accuratly
displayed, but at some scaling factors, Wingdings appeared.
Leading to more confusion, the Windows FontMapper changed between
Windows 3.0, 3.1, 95 and NT. The only way to achieve the results you desire is to get the actual outlines of the characters in Vector format,then scale and image them yourelf.


ASKER CERTIFIED SOLUTION
Avatar of StevenB
StevenB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garibaldi

ASKER

At the moment I store logical character widths for each string,
but this is very hard to manage for dozens up to hundreds of
strings on an editable document page. There should be another
solution for this problem (big applications like ms word
do this perfect and fast).
 If you have an array, for each font that is used, of character widths at a given size and zoom (I use 50pt. font at 100% zoom) then you can extrapolate out what the widths would be at other font sizes and zooms. This can all be incorporated into a function that can be used to return absolute font widths for any situation. There should be no need to store too many values.
  I don't know what MS Word does in this respect, but I know that if you look around you'll find a lot of app's that don't scale their fonts well (Including Microsoft Excell). The reason that I had to solve the problem is that my app has a dynamic zoom scroll bar and the screen display did not represent what the printout would actually look like. With applications which don't support correct font scaling, you'll often find that the zoom facilities are pretty limited. (Ecxell is rubbish at certain zooms).
  Your right, I also feel there should be another solution to the problem, but after several months of experimentation, I've found this to be the best solution.

  Steven.
 

LATEST UPDATE!!!!!!!

Metafiles scale their fonts correctly when stretchdrawn to a canvas!!!!!

If your still receiving notice on this question then this is a phenomenon well worth investigating. Draw text to the TMetafileCanvas of a TMetafile as you might ordinarilly draw it to a TCanvas. The metafile can then be stretchdrawn to another canvas and the fonts scale correctly. Not ideal for all situations, but handy in some.

Steven.