Jump to content
Software FX Community

C++: How to set the charset for the font programmatically?


User (Legacy)

Recommended Posts

Hi, 

I am using Cfx4032.dll (version 4.0.16.0) in the C++

(VC++ ver. 6.0) application (ATL, no MFC).

I am filling the series legend using the code similar to

the following:

std::string sLabel;

...

sLabel = "value obtained by the code in a loop";

...

spChartFX->GetSeries()->GetItem(nSerieIndex)

->PutLegend((LPSTR)sLabel.c_str());

Later, I do allow displaying the legend using a command:

spChartFX->PutSerLegBox(true);

The problem is that the strings are in the Czech language and the

implicit font uses "Western" charset. It is possible to change

it to "Central European" manually, using context menu -- Font...

-- Script. How can I do the same programmatically?

I tried to use PutFonts(), but it uses only combination of the

family, weight, and size (only the size is used in the following

example which should result in Arial, normal, 10 points):

{

using namespace ChartfxLib;

spChartFX->PutFonts(CHART_LEGENDFT,

static_cast<enum CfxFontAttr>(10));

}

The problem with the script remains. However, when I use

PutFonts(..., ... CF_COURIER | 10), (probably any other than Arial),

then also the script is set.

I do use Windows NT 4.0 English version with Czech regional setting.

My other question is related to the need of explicit cast when

I try to put the legend string stored in C++ std::string -- look

at the command

...->PutLegend((LPSTR)sLabel.c_str());

(used above). The problem is that the compiler complains that

it cannot convert (const char *) -- which is the result of c_str()

method -- into (char *) -- which is required by PutLegend().

Is there any reason to use char * instead of const char *?

If not, then it would be nice to change the interface as the

std::string is quite std for me ;-)

Thanks in advance,

Petr

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...