I have some persian text and I need to draw them from right to left, for example if my screen size is 1920 x 1080 and my text draw positions is like this :
I need it to start drawing from the point (1820, 500) and draw the rest of the text to the left side of screen. I used this functions (ofTranslate, ofRotate) but the problem is the text is upside down! how can I solve this? is there any better way?
ofTrueTypeFont now supports unicode in the nightly builds and should support persian by selecting the right alphabet using ofTtfSetings too. We don’t have a specific range for persian but you can specify the correct unicode range if the ones there are not enough. Let me know if you need a different range than the ones already there and i’ll add it as well.
Not sure if persian will work without any problem though, i think it might need ligatures which are not still implemented but i don’t think ofxTrueTypeUC does ligatures either anyway
I test the new nightly build and It works with Arabic unicode range but the problem is the letter are separated from each other, It should be:
but it is:
ن ی م ا
in the ofxTrueTypeFontUC the problem was the same but I used some reshape trick to fix this issue, I pass some thing like this text: “ﺎﻤﯿﻧ” as input and every things worked fine, but here when I pass the reshaped text It shows nothing, Is this a range issue?
Reshape means to replace characters with their correct shapes according to their surroundings characters. It is a way to show Persian or Arabic text in applications that don’t support this kind of languages.
I think if you look at this library description you can find good clue in this problem.
ah ok that’s interesting i think we are just missing some unicode keypoints in the alphabet. looking at this:
it seems the contextual forms are in the range FE?? which in ofTTF is in ArabicPresFormsB, are you adding the range as ofUnicode::Arabic or ofAlphabet::Arabic? the latest should include the contextual forms too
that’s great to hear, i though reshaping was a much more involved process but if it just means swapping some characters with others depending on their relative position in the word it might be easy to integrate into OF itself. i might ping you when it’s implemented so you can check if it works correctly if you don’t mind
Which nightly build have you been using? I’ve tested the of_v20170714_osx_release and had no success with stichting Arabic letters. Moreover, the ofTrueTypeFont.h and ofTrueTypeFont.cpp of that build do not appear to support OfTtfSettings.
However, the results in OF using ofTrueTypeFont does not yield the desired results. WhenI’m using OfxTrueTypeFontUC its better, but it needs manual adding of characters to ensure some show up properly.
I’m wondering if I have the right header and cpp file for ofTrueTypeFont, in the latest nightly build it does not offer ofTtfSettings functionality. I’ve found a header and cpp file that does, but this does not give the right results. Would you mind sharing your ofTrueTypeFont.h and .cpp?
Another possible error could be that i’m loading the text incorrectly. How do you feed your input string?
I’m hoping you have some time to help me out.
All the best,