G
gongzai1219
Guest
```
void ofApp::setup(){ ofTrueTypeFontSettings settings("Microsoft YaHei UI", 24); settings.antialiased = true; settings.contours = true; settings.dpi = 72; //settings.direction = OF_TTF_LEFT_TO_RIGHT; settings.addRanges(ofAlphabet::Chinese); settings.addRanges(ofAlphabet::Latin); ttf.load(settings); } void ofApp::draw(){ ofPushStyle(); ofSetColor(255, 0, 0); ttf.drawString("你好啊怎aaa啊啊怎", 100, 100); ofPopStyle(); }
```
It didn't show any syntax errors before I compiled. After I compiled it, it shows the syntax errors as below:
```
C2001 newline in constant
C2146 syntax error: missing ')' before identifier 'ofPopStyle'
C2660 'ofTrueTypeFont::drawString': function does not take 1 arguments
C2146 syntax error: missing ';' before identifier 'ofPopStyle'
```
Might it be the problem with visual studio 2017? Or visual studio cannot perfectly recognize Chinese, so it shows the error?
If I read these Chinese word from a text file in my program, then it is fine.
Does anyone know the reason?
Continue reading...
void ofApp::setup(){ ofTrueTypeFontSettings settings("Microsoft YaHei UI", 24); settings.antialiased = true; settings.contours = true; settings.dpi = 72; //settings.direction = OF_TTF_LEFT_TO_RIGHT; settings.addRanges(ofAlphabet::Chinese); settings.addRanges(ofAlphabet::Latin); ttf.load(settings); } void ofApp::draw(){ ofPushStyle(); ofSetColor(255, 0, 0); ttf.drawString("你好啊怎aaa啊啊怎", 100, 100); ofPopStyle(); }
```
It didn't show any syntax errors before I compiled. After I compiled it, it shows the syntax errors as below:
```
C2001 newline in constant
C2146 syntax error: missing ')' before identifier 'ofPopStyle'
C2660 'ofTrueTypeFont::drawString': function does not take 1 arguments
C2146 syntax error: missing ';' before identifier 'ofPopStyle'
```
Might it be the problem with visual studio 2017? Or visual studio cannot perfectly recognize Chinese, so it shows the error?
If I read these Chinese word from a text file in my program, then it is fine.
Does anyone know the reason?
Continue reading...