Text on 0.9.0 release

The true type fonts on the 0.9.0 release look correct now.
It’s really a great improvement, because in all previous versions it looked always unprofessional (what was not the case in Cinder). Now it looks really good !

Thank you very much !!!

Was it the correction of a bug, or are things now done in another way ?

(tested on OS X 10.10)

we enabled freetype’s auto hinting which makes the rendering much better for certain types

does support unicode on 0.9.0?

it won’t make it in 0.9 but right after it’s released we’ll merge: https://github.com/openframeworks/openFrameworks/pull/3992 which has full support for utf8 and start doing work on better rendering for alphabets that need shaping. you can already copy the ofTruetypeFont from that PR into 0.9 to get support for utf8 if you want.

I had some trouble last week when I has to compile an app I made in OSX for Windows with the utf8 parsing thing. This was in spanish so I had to use áéíóú ñ. Osx and windows gave different results while reading the same text file. I was using the current HEAD. The thing is that this same app, which I wrote like 3 years ago, used to work well both on windows and macosx, but all this new utf8 features wrecked the whole thing and I had to spend a lot of time in something that was just a minor fix. From now on, text must be handled in a different way? How is it going to be?
best!

can you be more specific about the problem?

At first, the original app I wrote 2 or 3 years ago just read a file from which it extracted the text to be displayed using a ofTrueTypeFont instance. It worked with no problems at showing special characters, line the tildes and Ñ, both on windows and mac, with exactly the same code. Now, last week I had to do a minor change to that app (simply changing a parameter) and recompile for windows. Once done, the tildes and Ñ showed no more both on windows and mac. The weird thing is that I fixed it for mac, just searching for the incorrect characters I was getting and replacing by the correct ones. Then once compiled on Windows, the incorrect characters I was getting were different to the ones I got on osx, so I had to do once again this same dirty fix of find and replace.
Something like:
original character: á
on mac was shown as 0xF3 // I really dont remmenber the exact code
on win 0xd323 // I also dont remember but it had two bytes.

Is it clear enough?
best

this should work right away if the text file is saved as utf8

the thing is that I was reading an excel file using a very basic library I found.
I understand that there might be some os related issues, but the strange thing is that before it used to work fine, with no dirty hacks, and now it doesn’t, where the only thing that was updated was OF.
I’ll check how it works with text files.

BEst!

… I am not on my main machine now, but today I have updated the master branch and I get some true type errors. My project was OSX and using ofxUI with non default font.

Could you please point less experienced users on what to copy on top of 0.9.0 version to get the utf8 support. I tried to copy ofTrueTypeFont.cpp and ofTrueTypeFont.h from master branch and compile example given in the following link without luck.

https://github.com/openframeworks/openFrameworks/pull/3992

Compiler throws error: ofTtfSettings was not declared in this scope

Regards,

Michal

where are you copying the files? the class ofTtfSettings should be there so not sure why it’s failing for you. also if you could post the full error it would help knowing what’s the problem

I am overwriting files located in libs/openFrameworks/graphics/ofTrueTypeFont.cpp and libs/openFrameworks/graphics/ofTrueTypeFont.h from OF 0.9.0 with versions taken from github - master branch.

that should be working, can you post the full error?

My ofApp.h includes:

public:
    ofTrueTypeFont myFont;

My ofApp.cpp includes:

void ofApp::setup(){
    ofTtfSettings settings("font.ttf", 40);
    settings.antialiased = true;
    settings.ranges = {
        ofUnicode::Latin1Supplement
    };
    myFont.load(settings);

Error message is as follows:

/home/pi/openFrameworks/apps/myApps/emptyExample/src/ofApp.cpp: In member function ‘virtual void ofApp::setup()’:
/home/pi/openFrameworks/apps/myApps/emptyExample/src/ofApp.cpp:12:2: error: ‘ofTtfSettings’ was not declared in this scope
  ofTtfSettings settings("font.ttf", 40);
  ^
/home/pi/openFrameworks/apps/myApps/emptyExample/src/ofApp.cpp:13:2: error: ‘settings’ was not declared in this scope
  settings.antialiased = true;
  ^
/home/pi/openFrameworks/apps/myApps/emptyExample/src/ofApp.cpp:15:3: error: ‘ofUnicode’ has not been declared
   ofUnicode::Latin1Supplement
   ^
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:199: recipe for target 'obj/linuxarmv6l/Release/src/ofApp.o' failed
make[1]: *** [obj/linuxarmv6l/Release/src/ofApp.o] Error 1

ah ok, the problem is that you are getting the files from master which still doesn’t have this changes. you have to get them from this pull request:

https://github.com/openframeworks/openFrameworks/pull/3992/files

or the branch where that PR comes from:

Thank you very much for your time - it compiles fine now.
The only thing is that ranges is private member of ofTtfSettings class so instead of settings.ranges = {...} we should use settings.add({...})

Michal

Hi there!
Thanks @arturo for implementing this! I’m having an issue to get it to work on windows at the moment tho.
Using Visual studio community 2015 with the feature-ttfUTF8 branch i’m getting a series of this type of error on all “static constexpr” :

Error C4579 ‘ofAlphabet::Arabic’: in-class initialization for type ‘const std::initializer_listofUnicode::range’ is not yet implemented; static member will remain uninitialized at runtime but use in constant-expressions is supported (compiling source file …\openFrameworks\app\ofAppRunner.cpp) openframeworksLib C:\MEDIA\DEV\of-arturoc\openFrameworks\libs\openFrameworks\graphics\ofTrueTypeFont.h 145

static constexpr std::initializer_listofUnicode::range Arabic {
ofUnicode::Space,
ofUnicode::Arabic,
ofUnicode::ArabicExtendedA,
ofUnicode::ArabicMath,
ofUnicode::ArabicPresFormsA,
ofUnicode::ArabicPresFormsB
};

and a series of those:

Severity Code Description Project File Line
Error C2131 expression did not evaluate to a constant (compiling source file src\ofApp.cpp) fontsExample C:\MEDIA\DEV\of-arturoc\openFrameworks\libs\openFrameworks\graphics\ofTrueTypeFont.h 164

static constexpr std::initializer_list<ofUnicode::range> Cyrillic {
		ofUnicode::Space,
		ofUnicode::Cyrillic
	};

I’ve installed VS update1 (https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx) thinking it might have been a compiler bug, but i still get the message.

Do the projects need to be created in different way as in 0.9.0 + projectGenerator ?

i haven’t tested this branch on windows so it might not work there, i’ll need to review it once we finish 0.9.1 and we can merge new features into master. meanwhile if someone finds a fix please post it here or send me a pull request to the original branch