|
Thank you.
I tried to use "WORD" to repeat this. I found out:
If I type some chars using other font and then change to "SimSun" Font. All preceding chars were shifted a little down after a char using "SimSun" Font was input.
How can I find out how much I need to shift and what kind of font I need to shift?
Thank you very much,
|
|
|
|
|
That is the way that font is designed.
It is not a shift as you say.
So I guess you will have to do some trials to see how much you want to shift it.
|
|
|
|
|
The problem is how to find out which font need to be "shift".
I find out that there are a lot of font using WORD doing like this. The WORD can handle this. I think there is a way to find out what kind of font that need special handling.
The Font design like this is really weird. Why Microsoft doing this?????
|
|
|
|
|
You can definitely get the height of a font using GetTextMetics .
Now it depends on the font characteristics and the designer of the font and as to whether he uses the entire height or only half of it for the actual bitmap.
transoft wrote: Why Microsoft doing this?????
You should really be asked them.
|
|
|
|
|
Use the GetTextMetrics()[^] function after selecting the font. The information returned in the TEXTMETRIC structure includes fields defining the distance above and below the baseline.
|
|
|
|
|
Hi Richard,
The thing is not that simple. If you use MS WORD to have a test you will find it out. Using WORD to type some chars with normal characters and change font to "SimSun" and type a char. You will see that those "normal" characters were shifted a little bit downward.
The problem is how to find out what kind of font need to be shifted.
Thank you for your reply.
|
|
|
|
|
transoft wrote: If you use MS WORD to have a test
Yes, I see what you mean, but unfortunately I don't have an answer to why they do this. I guess you would need to ask Microsoft. You could take a look at the Fonts and Text[^] information on MSDN to see if that explains it.
|
|
|
|
|
MS did not document this (I might not find it out).
It is very hard to dig thing out from MSDN.
|
|
|
|
|
transoft wrote: MS did not document this (I might not find it out).
Very true.
transoft wrote: It is very hard to dig thing out from MSDN.
Sometimes yes, sometimes no; the best I can offer is the link in my previous message. You could also try Google as I know there are a number of independent websites around that deal with fonts in general.
|
|
|
|
|
Hi Experts
I want to write some information which are saved in CString to a DaoDatabase in UTF8 Format?
So that another program will use them.
All my own efforts were in vain!
I use below code to convert the CString to ,char* Buffer in UTF8 but I don't know how to write them to DaoDatabase
CString myData;
long BufferSize = ::WideCharToMultiByte(CP_UTF8, 0, myData, -1, NULL, 0, NULL, NULL);
LPSTR Buffer = new CHAR[BufferSize];
BufferSize = ::WideCharToMultiByte(CP_UTF8, 0, myData, -1, Buffer, BufferSize, NULL, NULL);
.....
delete[] Buffer;
|
|
|
|
|
|
I have a C++ project where I am reading data line by line from a text file in order to create a file header and store the records from the text file in a binary file.
The records will have a certain number of fields but you do not know how many fields until you've opened and read from the text file.
For example:
Record Fields:
Title (string)
Price (double)
In Stock/Out of Stock (char)
Is there a way to create an empty struct and fill it later when you know the number of fields or is there some other structure besides a vector or array that will store records with different fields of different data types??
|
|
|
|
|
|
To me it sounds like you want to use a vector of structs (or another dynamically sizeable storage unit, like CArray or something). so you'd declare it as, for example, vector<RecordFields> theRecords;
This can be done if you declared your struct as this:
struct RecordFields
{
CString title;
double price;
bool isInStock;
}
I hope this helps a bit. Basically, you read in the file, and as you get new records, you push a new struct into the vector using push_back() .
|
|
|
|
|
I tried to use the boost::any but i have to use linux to do the program and it sent me back a million error messages when i tried to compile it.
as for the struct i wish it was that easy. my problem is not knowing how many members there would be in the struct. the sample file i'm working with has those title, price, and in stock fields but for other files there could be more or less fields. if a struct was like a vector then i could declare it and then later just add the members when i know the fields.
i think i might just have to treat all the fields as strings and then create a vector to store them in...
thanks for your help though!
|
|
|
|
|
Maybe you need to have those fields available in the struct, but default them to something like -1 when not in use. If it's something that may have multiple definitions, like the price, use vectors for that as well. Example:
struct ItemDefinition
{
CString title;
int itemNumber;
double prices;
int isInStock;
vector<double> taxRates;
vector<CString> descriptions;
};
Maybe this would help?
modified on Saturday, October 24, 2009 3:17 PM
|
|
|
|
|
rhenry84 wrote: I tried to use the boost::any but i have to use linux to do the program and it sent me back a million error messages when i tried to compile it.
Linux is no hindrance to using boost::any - most of Boost is developed on Linux, I suspect.
As for your real problem - what I would probably do is use a std::map<string, string> for each record, mapping field name to field value (as a string).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
As I can see from the screen-shot, your project is in Release mode.
Why you are debugging your application in Release mode?
Did you try to use the Watch window in Debug mode?
Nuri Ismail
|
|
|
|
|
AHHH, how can ??? Thank you very much. You saved me. I think i should go to bed soon. Cannot work with this mood now 
|
|
|
|
|
Then I wish you Bug-Free dreams!
Nuri Ismail
|
|
|
|
|
What is abstract class?I feel difficult to understand that concept.Can any one explain with example? and also give me the difference between ordinary class and abstract class...
|
|
|
|
|
|
Vinoli wrote: What is abstract class?I feel difficult to understand that concept.Can any one explain with example?
Here[^] you will find an explanation of this concept with examples. Also the article shows the differences between ordinary classes and abstract classes.
If you have some questions after reading the article, feel free to ask.
I hope this helps.
Nuri Ismail
|
|
|
|
|
An abstract class is one that you cannot instantiate.
The class A is abstract because One() has not been defined.
class A
{
public:
void One() = 0;
};
The class B is not abstract since Two() has been defined and so can be instantiated.
class B
{
public:
void Two() {}
};
The class C also becomes abstract since it inherits One() from class A , but it is still not defined.
class C : public A
{
public:
void Three() {}
};
The class D is not abstract and can be instantiated since it inherits One() from class A and then defines it.
class D : public A
{
public:
void Four() {}
void One() {}
};
|
|
|
|