generated from sigonasr2/CPlusPlusProjectTemplate
Fix wrapping text text cut-off
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
8a2db05c36
commit
d706dbe3f2
Binary file not shown.
11
main.cpp
11
main.cpp
@ -2627,8 +2627,11 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
std::string Wrap(std::string str,vd2d size,bool proportional) {
|
||||
int marker=0;
|
||||
std::string newStr="";
|
||||
bool firstChar=false;
|
||||
while (marker<str.length()) {
|
||||
if (firstChar||!firstChar&&str[marker]!=' ') {
|
||||
newStr+=str[marker];
|
||||
}
|
||||
vd2d siz;
|
||||
if (proportional) {
|
||||
siz=GetTextSizeProp(newStr);
|
||||
@ -2639,14 +2642,18 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
do {
|
||||
if (newStr[newStr.length()-1]!=' ') {
|
||||
marker--;
|
||||
//printf("%s\n",newStr.c_str());
|
||||
}
|
||||
newStr.erase(newStr.end()-1);
|
||||
} while (newStr[newStr.length()-1]!=' ');
|
||||
newStr.erase(newStr.end()-1);
|
||||
//newStr.erase(newStr.end()-1);
|
||||
newStr+='\n';
|
||||
}
|
||||
firstChar=false;
|
||||
} else {
|
||||
firstChar=true;
|
||||
marker++;
|
||||
}
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user