ofTrueTypeFont and full character set


#1

Hi why ofTrueTypeFont do not draw character as œ ?

this character is in the true type font (https://www.dafont.com/fr/kg-ten-thousand-reasons.font), full character set option is on …

Any advice ? ii it an issue ?

Cheers
Sebastien


#2

you need to load the needed character ranges.
I don’t know which range includes that one but to do so use the following

ofTrueTypeFontSettings settings("font.ttf", size);
// add the ranges that you need.
settings.addRanges(ofAlphabet::Emoji);
settings.addRanges(ofAlphabet::Japanese);
settings.addRanges(ofAlphabet::Chinese);
settings.addRanges(ofAlphabet::Korean);
settings.addRanges(ofAlphabet::Arabic);
settings.addRanges(ofAlphabet::Devanagari);
settings.addRanges(ofAlphabet::Latin);
settings.addRanges(ofAlphabet::Greek);
settings.addRanges(ofAlphabet::Cyrillic);
     
font.load(settings); // font is an instance of ofTrueTypeFont

You could also load just the particular range of characters.
use any of the following:

settings.addRange(ofUnicode::Space);
settings.addRange(ofUnicode::IdeographicSpace);
settings.addRange(ofUnicode::Latin);
settings.addRange(ofUnicode::Latin1Supplement);
settings.addRange(ofUnicode::LatinA);
settings.addRange(ofUnicode::Greek);
settings.addRange(ofUnicode::Cyrillic);
settings.addRange(ofUnicode::Arabic);
settings.addRange(ofUnicode::ArabicSupplement);
settings.addRange(ofUnicode::ArabicExtendedA);
settings.addRange(ofUnicode::Devanagari);
settings.addRange(ofUnicode::HangulJamo);
settings.addRange(ofUnicode::VedicExtensions);
settings.addRange(ofUnicode::LatinExtendedAdditional);
settings.addRange(ofUnicode::GreekExtended);
settings.addRange(ofUnicode::GeneralPunctuation);
settings.addRange(ofUnicode::SuperAndSubScripts);
settings.addRange(ofUnicode::CurrencySymbols);
settings.addRange(ofUnicode::LetterLikeSymbols);
settings.addRange(ofUnicode::NumberForms);
settings.addRange(ofUnicode::Arrows);
settings.addRange(ofUnicode::MathOperators);
settings.addRange(ofUnicode::MiscTechnical);
settings.addRange(ofUnicode::BoxDrawing);
settings.addRange(ofUnicode::BlockElement);
settings.addRange(ofUnicode::GeometricShapes);
settings.addRange(ofUnicode::MiscSymbols);
settings.addRange(ofUnicode::Dingbats);
settings.addRange(ofUnicode::Hiragana);
settings.addRange(ofUnicode::Katakana);
settings.addRange(ofUnicode::HangulCompatJamo);
settings.addRange(ofUnicode::KatakanaPhoneticExtensions);
settings.addRange(ofUnicode::CJKLettersAndMonths);
settings.addRange(ofUnicode::CJKUnified);
settings.addRange(ofUnicode::DevanagariExtended);
settings.addRange(ofUnicode::HangulExtendedA);
settings.addRange(ofUnicode::HangulSyllables);
settings.addRange(ofUnicode::HangulExtendedB);
settings.addRange(ofUnicode::AlphabeticPresentationForms);
settings.addRange(ofUnicode::ArabicPresFormsA);
settings.addRange(ofUnicode::ArabicPresFormsB);
settings.addRange(ofUnicode::KatakanaHalfAndFullwidthForms);
settings.addRange(ofUnicode::KanaSupplement);
settings.addRange(ofUnicode::RumiNumericalSymbols);
settings.addRange(ofUnicode::ArabicMath);
settings.addRange(ofUnicode::MiscSymbolsAndPictographs);
settings.addRange(ofUnicode::Emoticons);
settings.addRange(ofUnicode::TransportAndMap);
settings.addRange(ofUnicode::EnclosedCharacters);
settings.addRange(ofUnicode::Uncategorized);
settings.addRange(ofUnicode::AdditionalEmoticons);
settings.addRange(ofUnicode::AdditionalTransportAndMap);

The default range is ofUnicode::Latin1Supplement (added automatically).

Check http://jrgraphix.net/research/unicode_blocks.php for a reference to these ranges

hope this helps


#3

Thanks. That makes sense to me,
but I can not find the class ofTrueTypeFontSettings even it is in OF documentation.

is it OF.10.0 feature ? Could you tell me more ?

Sebastien


#4

Yes, it is a v0.10 feature. it is a really simple class, it is mostly a data holder.


#5

At this time, my project is a 0.9.8 project, and I don’t really want to change now (because of some addons maybe not compatible, project nearly finished and i don’t want surprises)

I tried to convert my project to OF10, but ofxBullet seems no more compatible, is there a way to add special characters in OF0.9.8 ?

Bests


#6

in my opinion, it is an issue because extented characters as Ù or ç are availables…


#7

this is pretty much what is supported until 0.9.8:

https://cs.stanford.edu/people/miles/iso8859.html

anything not in that table except for a couple of symbols we were pulling manually won’t be rendered

You could try to bring the new ofTrueTypeFont in 0.10 to 0.9.8 but it has dependencies with glm so it won’t work right away


#8

Yeah,

œ is in Latin A supplement, but ç and Ù are not.
I tried to put the new ofTrueTypeFont, I had to stop because of some ofGetRenderer() faults that I don’t get.

I switch into a rough replacement œ -> oe … not proud of it