tangrams / harfbuzz-example Goto Github PK
View Code? Open in Web Editor NEWHarfbuzz text-shaping example with OpenGL using Freetype
License: MIT License
Harfbuzz text-shaping example with OpenGL using Freetype
License: MIT License
Hello there,
I would like to render text which includes emojies into .png file.
Now I am able to render complex languages characters, but I'm still not able to render emojies as there is no 'Harfbuzz script' type for it.
In harfbuzz-example/src/main.cc line 37 a Harfbuzz text is created as follows, for Arabic language for example:
HBText hbt2 = {
"تسجّل يتكلّم",
"ar",
HB_SCRIPT_ARABIC,
HB_DIRECTION_RTL
};
The HB_SCRIPT_ARABIC
is a 'Harfbuzz script' type called from hb-common.h
.
And then we are passing this text to the shaper which has been assigned with a specific font.
what I need now is: HB_SCRIPT_EMOJI
or something similar in order to render emojies into .png file same as what we are applying with languages.
what am I messing? How can I render the emoji into .png using Harfbuzz?
And is there a ready script which I can use to render text into .png (no matter if the text includes emojies, arabic, english or indian all together)?
First of all, thank for your work.
I send you a feedback because I love what you have put together and maybe this feedback is useful (or maybe as we are talking about an outdated Visual Studio version, just trash it :)
assert(!FT_New_Face(lib, fontName.c_str(), 0, face)) is wrong because "assert(x)" is defined as "void(0)" so in release the code is not executed anymore. Need to remove the assert.
Or rewrite the code
assert(glewInit() == GLEW_OK);
becomes
GLenum initOk = glewInit();assert(initOk == GLEW_OK);
Missing preprocessor define "GLEW_STATIC" in "harfbuzz-example.out" project, otherwise link errors with glew
VC2012 is not fully C++0X compilant.
static const GLchar* vertexSrc =R"END(.... doesn't compile
I need to use
static const GLchar* vertexSrc ="attribute vec4 a_position;" "attribute vec2 a_uv;" ...
VC2012 is not fully C++0X compilant.
vertices[0] = { x0,y0, s0,t0 };doesn't compile
I had to write a constructor Vertex(float _x, float _y, float _s, float _t) : x(_x), y(_y), s(_s), t(_t) {}
and use vertices[0] = gl::Vertex( x0,y0, s0,t0 );
Post-build to copy the fonts don't work. -minor problem-
Again thanks !
For some reason, the file fonts/Sanskrit2003.ttf
has the x
bits set in its mode. Might be an idea to remove these.
I have use the demo on android. but didn't draw anything.
The code in src/hbshaper.h
is doing its own kerning by calling hb_font_get_glyph_kerning_for_direction
. This is unnecessary, as HarfBuzz will take care of it via the font’s own kern
feature. DejaVu Sans has this.
On my Debian Unstable system, I got an error message that the “-stdlib=libc++
” option was not recognized. When I removed that, it built fine.
Really not a big deal but I had to add that #include
in order to avoid a compilation error. In my experience, what's provided by system header files varies between compiler versions, and since uint32_t
is used in the freetypelib.h, maybe the source code is not compliant with the C++ standard without that #include
.
Other than that, works like charm on my Ubuntu machine. Beautiful! Thanks.
[ 99%] Built target icucommon
Linking CXX executable bin/harfbuzz-example.out
harfbuzz-icu-freetype/libharfbuzz.a(hb-ft.cc.o): In function hb_ft_font_set_funcs': hb-ft.cc:(.text+0x109e): undefined reference to
FT_Set_Var_Blend_Coordinates'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/harfbuzz-example.out] Error 1
make[1]: *** [CMakeFiles/harfbuzz-example.out.dir/all] Error 2
make: *** [all] Error 2
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.