Git Product home page Git Product logo

harfbuzz-example's Introduction

harfbuzz-example

Simple Harfbuzz text-shaping example with OpenGL and GLFW using Freetype.

This project uses CMake, you can download it here or use your favorite installation package tool like homebrew. Make sure to update git submodules before you build:

git submodule update --init --recursive

Then build and run:

mkdir build && cd build
cmake .. && make
cd bin
./harfbuzz-example.out

00

harfbuzz-example's People

Contributors

bcamper avatar karimnaaji avatar tallytalwar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

harfbuzz-example's Issues

Unnecessary Manual Kerning

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.

Rendering Emojies

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)?

Compiling with Visual Studio 2012

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 :)

  1. 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);

  2. Missing preprocessor define "GLEW_STATIC" in "harfbuzz-example.out" project, otherwise link errors with glew

  3. 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;" ...

  4. 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 );

  5. Post-build to copy the fonts don't work. -minor problem-

Again thanks !

Missing `#include <cstdint>` in freetypelib.h?

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.

Linking Error Occurs

[ 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.