Skip to content

Test program for low level text rendering via FreeType and HarfBuzz.

License

Notifications You must be signed in to change notification settings

virxkane/freetype_textdraw

Repository files navigation

freetype_textdraw demo program

freetype_textdraw is demo program developed to learn how to use library Freetype to draw any text.

Features

Draw some text with customizations:

  • select font file to draw
  • enable/disable kerning
  • enabled/disable ligatures
  • enable/disable text antialiasing
  • enable/disable hinting
  • change font size
  • change gamma of antialiasing
  • change text or background color

Please note that library HarfBuzz is required to implement ligatures and kerning. Also for selected font you can see for which languages there is a full set of glyphs.
The most important: you can study sources of this project to write your own.

LICENSE

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Dependencies

cmake, Freetype, HarfBuzz (optional), Qt5.

Build Instructions

Follow standard cmake build instructions:

  • make build directory:
    # mkdir build
    # cd build
  • call cmake to configure:
    # cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_HARFBUZZ=ON ..

To omit HarfBuzz support replace "-DUSE_HARFBUZZ=ON" with "-DUSE_HARFBUZZ=OFF", but you lost ligatures and kerning features in modern fonts!

  • call make to build:
    # make

Screenshots

  • Main window Main window
  • Antialiasing
    • Without antialiasing: antialiasing-none
    • With antialiasing: antialiasing-gray
  • Kerning
    • Kerning disabled: kerning-off
    • Kerning enabled: kerning-on
  • Ligatures
    • Ligatures disabled: ligatures-off
    • Ligatures enabled: ligatures-on

About

Test program for low level text rendering via FreeType and HarfBuzz.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published