Giter Site home page Giter Site logo

makemeglow's Introduction

makemeglow logo Text rasterizer lib with glowing effect.

Quick start

Don't forget to checkout submodules

git submodule update --init --recursive

Build

mkdir build
cd build
cmake ..
make

Run tests

make tests

Render text

You can use glow app and listen Lenny's masterpiece.

./glow_app -f ../../tests/data/font/JosefinSans-Regular.ttf -s 40 I belong to you

glow_app1

Chose different font, size and specify colors

./glow_app -f ../../tests/data/font/IndieFlower-Regular.ttf -s 30 -c f0ff00 -b 100050 -- And you you belong to me too

glow_app2

Set Gauss kernel params

./glow_app -f ../../tests/data/font/NotoSansJP-Black.otf -s 30 -c 0fff9f --kernel 15 --sigma 15.0 -- You make my life complete

glow_app3

Specify output

./glow_app -f ../../tests/data/font/NotoSansJP-Black.otf -o ./path_to_text.png -s 30 -b 55124f  -- You make me feel so sweet

glow_app4

For full help use

./glow_app -h

Note, that I use cxxopts to parse command line input, it can skip some chars like comas, quote marks, etc. If you have some problems, just paste your string here

Requirements

Compiler with C++14 support.

Libpng and Freetype

Install on Linux

sudo apt-get install libfreetype6-dev
sudo apt-get install libpng-dev

To get freetype ppa use one of these links 12

Install on Mac

brew install libpng
brew install freetype

Lib also uses gtest and cxxopts, but they're git submodules, so you shouldn't worry.

Notes

  • Pixel size.
    I use freetype lib for text rasterization. Pixel size in rendering request is the pixel_height in FT_Set_Pixel_Sizes

  • How resulted picture size is calculated?
    You can find code here

  • Glow effect
    I've implemented two pass Gaussian blur algorithm mentioned in this article

  • Margin size
    It's computed automatically. For text without glowing it equals to 0. It equals to kernel_size / 2 for rendering with blur.

  • Testing
    Lib was tested on

    • Ubuntu 18.04.3, gcc 7.4.0 & clang 6.0.0, cmake 3.10.2
    • Mac OS 10.14.5, Apple LLVM version 10.0.1, cmake version 3.15.2
    • Ubuntu 16.04.6, gcc 5.4.0, cmake 3.5.1, some of rasterization tests could fail due to different sizes of png

TODO list

  • png read/write with different bitdepth and color modes
  • fixed size fonts
  • support for alpha channel in text and background color
  • non-ASCII encodings
  • multiple Gauss kernel pass
  • stable approach to test font rasterization

makemeglow's People

Contributors

dekonoplyov avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

00mjk

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.