Jump to content
Software FX Community

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


User (Legacy)
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...