Jump to content
Software FX Community

Re: CFX98: Font does not scale when Paint() is called?

Software FX

Recommended Posts

When CPAINT_PRINT is specified the size of the fonts is recalculated based

on the resolution of the current device context vs. the screen resolution.

If the device context you are passing is a Memory DC (e.g Metafile) this can

not be obtained therefore the conversion will not be made.

Check out article Q1381013 for more details




"Petr Prikryl"

<Answer.via.news.please.prikrylp@nospam.skil.nospam.cz.nospam> wrote in

message news:88sN9RPDAHA.1416@sfxserver.softwarefx.com...

> Hi, (CFX98, VC++ 6, ATL, WTL, Windows 9x+)


> I do have problem when calling the Paint(). The font

> which is used for labeling axes (I did not try other

> fonts) does not scale for different device context

> while the chart does.


> To be more exact, I did create the instance of the

> ChartFX 98, filled it with some data, and painted it

> using given device context (as follows):


> spChartFX->OpenDataEx(ChartfxLib::COD_VALUES, 2, 3);


> spChartFX->GetSeries()->GetItem(0)->PutYvalue(0, 500);

> spChartFX->GetSeries()->GetItem(0)->PutYvalue(1, 600);

> spChartFX->GetSeries()->GetItem(0)->PutYvalue(2, 700);


> spChartFX->GetSeries()->GetItem(1)->PutYvalue(0, 800);

> spChartFX->GetSeries()->GetItem(1)->PutYvalue(1, 900);

> spChartFX->GetSeries()->GetItem(1)->PutYvalue(2, 1000);


> spChartFX->CloseData(ChartfxLib::COD_VALUES);


> spChartFX->Paint(reinterpret_cast<long>(dc),

> rc.left, rc.top,

> rc.right, rc.bottom,

> ChartfxLib::CPAINT_PRINT, 0);


> The device context uses MM_ANISOTROPIC mapping mode.

> The logical coordinates are in 1/100 of mm. The

> ViewportExt and WindowExt are set differently for a

> display and for various printers to obtain 1:1

> visual appearance. The auxiliary ruler marks and

> some text (painted using the device context) show

> that the mapping works as desired both on the

> display and on the tested printers.


> The chart displayed by Paint() fills correctly the

> given rectangular area leaving only some (expected)

> small margins. However, the font on 300 DPI printer

> is very small. The chart fills the given rectangle

> correctly again. In other words, the ratio between

> the font size and the chart-box size changes.

> I tried to choose a different font name and size,

> but the problem remains.


> I have noticed that when an extremely big size of

> font was used, the chart component created less

> marks on Y axis (expected and nice behaviour). Let

> us say, only 3 labels were visible on the display.

> However, using the device context for the 600 DPI

> printer, the same font appears much smaller, thus

> the number of labels on Y axis was increased (let's

> say from 3 to 10 -- I did not count them).

> It seems that the Paint() method calculates

> font sizes in device dependent units instead of

> logical units.


> I assume that the desired behaviour of the Paint()

> should be to display the same result (regarding

> proportions) with different device context.


> Could you comment this? Is it a bug?


> Thanks,


> Petr


> --

> Petr Prikryl, SKIL s.r.o., e-mail: prikrylp at skil dot cz

> Please, don't reply via e-mail.




Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...