Draw Unicode Strings in 0.9.0

hello. i want to read file which containing UTF8 korean texts, and draw that strings.
with officially released 0.9.0 oF, it drawing ..., instead right strings contained.

so I googled. and find this thread below from github.

ofTrueTypeFont: add UTF8 support

I update ofTrueTypeFont.h/.cpp. and trying with updated new classe.
but i stucked.

this is error logs and the code I tried.

error

/home/icq4ever/Documents/oF/libs/openFrameworks/graphics/ofTrueTypeFont.h:126: error: ‘std::vector<ofUnicode::range> ofTtfSettings::ranges’ is private
  vector<ofUnicode::range> ranges;
                           ^    

ofApp.cpp

void ofApp::setup(){
	ofTtfSettings settings("UnBatang.ttf", 14);
	settings.antialiased = true;
	settings.ranges ={            // error occured with this context
		ofUnicode::Latin1Supplement,
			ofUnicode::Hiragana,
			ofUnicode::Katakana,
			ofUnicode::CJKUnified
	};
	ofTrueTypeFont::setGlobalDpi(72);
	koPub.load(settings);
	koPub.setLineHeight(18.0f);
	koPub.setLetterSpacing(1.037);
}

is there anything I missed ?

you need to call:

settings.add({           
	ofUnicode::Latin1Supplement,
	ofUnicode::Hiragana,
	ofUnicode::Katakana,
	ofUnicode::CJKUnified
});

instead and it should work

pehw ~_~. another error logs here…

/home/icq4ever/Documents/oF/libs/openFrameworksCompiled/lib/linux64/libopenFrameworksDebug.a(ofTrueTypeFont.o): -1: In function `ofTrueTypeFont::load(ofTtfSettings const&)’:
File not found: /home/icq4ever/Documents/oF/libs/openFrameworkscompiled/lib/linux64/libopenFrameworksdebug.a(ofTrueTypefont.o)

is this openFrameworks compiling issue?
I tried rebuild openFrameworks in Qt Creator in Ubuntu 64… but it’s not work…


and this error

/home/icq4ever/Documents/oF/libs/openFrameworks/graphics/ofTrueTypeFont.cpp:619: error: undefined reference to `ofUnicode::Latin1Supplement’

ofTrueTypeFont.cpp:618 line

	if(settings.ranges.empty()){
		settings.ranges.push_back(ofUnicode::Latin1Supplement); // above error occured
	}
	int border = 1;

I used ofTrueTypeFont class from feature-ttfUTF8 branch

i haven’t touched this code in a while and there’s been som fixes for other stuff that might have broken somethings. i’ll take a look and merge it once 0.9.1 is ready which should happen soon but if you find a fix please send a PR

1 Like

ok. Thanks for your help!