hironishihara / ofxtruetypefontuc Goto Github PK
View Code? Open in Web Editor NEWAn extension of ofTrueTypeFont class for using UNICODE characters. Tested on OSX, iOS, and Windows.
License: Other
An extension of ofTrueTypeFont class for using UNICODE characters. Tested on OSX, iOS, and Windows.
License: Other
Dear Hironishihara,
Thanks for your kind contribution to the community. I would like to remark an issue I have been experiencing. I am trying to implement your addon for Windows Visual Studio 2015 using of0.9. There seems to be a problem with the addon, because non-Latin characters are printed as ? (question marks) instead. I'd appreciate if you can help us solve this matter.
Kind regards
こんにちは
いつも便利に使わせてもらっています、ありがとうございます
getStringAsPointsでofPathがとれてきていなかったので、
getStringAsPoints
shapes.push_back(getCharacterAsPoints(str[index]));
shapes.push_back(getCharacterAsPoints(cy));
getCharacterAsPoints
return charOutlines[character-NUM_CHARACTER_TO_START_UC];
return charOutlines[character];
のような感じに修正してみました。
ここにフォークしてコミットしてあります
https://github.com/Akira-Hayasaka/ofxTrueTypeFontUC
ご報告でした!
Hi!
I'm trying to add some letters that rotate on screen but even this example doesn't work, the text appears horizontal on screen:
ofPushMatrix();
ofRotate(0.5);
font->drawStringAsShapes("אבגדהוזחטיכלמנסעפצקרשתםןףץ", 0, ofGetHeight()/2);
ofPopMatrix();
I also tried with "drawString" but the same happens.
bool ofxTrueTypeFontUC::loadFont(string filename, int fontsize, bool _bAntiAliased, bool makeContours, float _simplifyAmt, int _dpi) {
mImpl->implLoadFont(filename, fontsize, _bAntiAliased, makeContours, _simplifyAmt, _dpi);
}
lost return value
//------------------------------------------------------------------
ofPath ofxTrueTypeFontUC::getCharacterAsPoints(wstring src) {
#ifdef TARGET_WIN32
ustring character = util::ofxTrueTypeFontUC::convUTF16ToUCS4(src);
#elif defined(__clang_major__) && (__clang_major__ <= 3)
wstring character = util::ofxTrueTypeFontUC::convToUCS4<wchar_t>(src);
#else
wstring character = src;
#endif
int charID = mImpl->getCharID(character[0]);
if(mImpl->cps[charID].character == mImpl->kTypefaceUnloaded)
mImpl->loadChar(charID);
return mImpl->getCharacterAsPointsFromCharID(charID);
}
ofPath ofxTrueTypeFontUC::getCharacterAsPoints(string character) {
return getCharacterAsPoints(util::ofxTrueTypeFontUC::convToWString(character));
}
"ustring" undefined
simple fixed by add "typedef basic_string ustring;" before this function
there is a ustring typedef before, but don't know why compiler miss this.
Platform win7 x64, vs2012, of 0.8.0dev
The library compiles fine for me on xcode and mac, but when using the visual studio compiler I get the error:
error C2864:
'ofxTrueTypeFontUC::Impl::librariesInitialized': only static const integral data members can be initialized within a class
On line 73 of ofxTrueTypeFontUC.cpp:
bool librariesInitialized = false;
If I remove the declaration:
bool librariesInitialized;
and add it at the top:
public:
Impl(){librariesInitialized = false;};
~Impl(){};
everything appears to work fine.
Hi
I tried to used the addons with OF 0.81 and iOS but got the following Semantic Issue errors:
no member named 'unloadTextures' in 'ofxTrueTypeFonyUC'
no member named 'reloadTextures' in 'ofxTrueTypeFonyUC'
no member named 'all_fonts' in 'TrueTypeFontUC::Impl'
It worked for Korean TTF fonts without modification.
Many thanks.
I tested UTF-8 and showed garbled characters
Hi,
I'm trying to use your library to draw Emoji using Apple's Color Emoji ttf. Unfortunately I am getting this error:
[ error ] ofxTrueTypeFontUC::loadFont - Error with FT_Load_Glyph 112: FT_Error = 22
Code:
// in setup
myFont.loadFont("Apple Color Emoji.ttf", 72);
// in draw
myFont.drawString("🐞", 100, 100);
Thanks in advance!
In OF 10.1 the following didn't work to include freetype:
#include "freetype.h"
#include "ftglyph.h"
#include "ftoutln.h"
#include "fttrigon.h"
I reverted it back so it was including it like so and it worked fine. (Just noting it here incase it's helpful to others)
#include "freetype2/freetype/freetype.h"
#include "freetype2/freetype/ftglyph.h"
#include "freetype2/freetype/ftoutln.h"
#include "freetype2/freetype/fttrigon.h"
Hi there,
I fail to compile a project in OF 0.8.4 and the compilation error is that the above was not declared in this scope.
I have included the addon in the addon.make file, but when I open the project it does not appear under the "addons" folders and it cannot compile.
this function can not be foudn in any of the #includes.
What is going on?
thank you!
はじめまして。
Mac OS X 10.7.5 で利用していますが、
stringWidth(wstring s)メンバ関数 の結果がどうもおかしいので、調べた所、
当方の環境ではllvmマクロとclangマクロが定義されているのですが、
stringWidth(wstring s)メンバ関数 ofxTrueTypeFontUC.cpp 575行目で
一度 util::ofxTrueTypeFontUC::convToUCS4<wchar_t> で変換され、
その後getStringBoundingBox内で再度全く同じように変換されていることが原因のようですので
報告します。
stringWidth(wstring s)メンバ関数のほうの変換をコメントアウトしたところ問題なくなりました。
環境依存の問題で上手く再現しないかもしれませんがよろしくお願いします。
ofTrueTypeFont
provides these two functions for caching string in draw phase:
ofTrueTypeFont font;
// load fonts...
ofVboMesh mesh;
void update()
{
if (needs_update) {
std::string const str = some_updated_string();
mesh = font.getStringMesh(str, 0, 0);
}
}
void draw()
{
font.getFontTexture().bind();
mesh.draw();
font.getFontTexture().unbind();
}
So is there any way to provide this in ofxTrueTypeFontUC
?
I know it's a bit tricky since the texture in ofxTrueTypeFontUC
is divided into each chars, but in ofTrueTypeFont
, is not (which is concatenated, I think).
Hi! @hironishihara Great work on this, was wondering if you could include the font that works with the example...I just tried a random font, didn't work with the japanese characters, maybe I am doing something wrong.
I am in the process of making ofxUI's font renderer swappable and ofxTrueTypeFontUC would be insanely helpful! Thanks for the help in advanced!
Hi,hironishihara. I found when i set the GLVersion in 4.0.
int main() {
ofGLWindowSettings settings;
settings.setGLVersion(4, 0);
settings.width = 1920;
settings.height = 1080;
ofCreateWindow(settings);
ofRunApp(new ofApp());
}
The font can't show correct.It became many pieces of rectangle.
And when i use " ofTrueTypeFont " instead "ofxTrueTypeFontUC" to show the English font.It can work in OpenGL 4.0 ~ Is there any suggestion make ofxTrueTypeFontUC working in OpenGL 4.0?
Hi, thanks for this addon, I've been using it for some time. But recently I´m getting a very bad font rendering, text looks like in a very low resolution image. I've tried to change font DPI, change font files, no difference, can´t get it to render properly. I'm using Windows 10, OF 0.9.8. Any hints on what could be the problem?
Hi
Nice addon, actually it works well on of 0.9.8. I'm having a strange issue when I call ofxTrueTypeFontUC inside an object. It appears "Call to implicitly-deleted copy constructor of "my object"" but it only appears when I add ofxTrueTypeFontUC myFont; inside myObject.h.
Have you seen something similar before?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.