Skip to content

MWE rendering text with FreeType in android GLSurfaceView (via Compose)

License

Notifications You must be signed in to change notification settings

Jerboa-app/FreeTypeAndroid

Repository files navigation

Minimum Working Example of FreeType rendering with Android Jetpack compose

Outline

  • The cpp folder contains basic TextRenderer and Type objects for handling rendering (and loading freetpye) and storing a typeface respectively.
  • A (Java JNI) Kotlin interface is defined in main.cpp
  • The Kotlin counterpart for the interface is here
  • To use a different custom font, place it in the assets/fonts folder
  • The main render loop occurs as part of a GLSurfaceView setup
  • The app runs by an activity, launching a simple compose function
Tested on
  • LGE Nexus 5 Physical device (Android 6.0.1)
  • Sony J8110 (Xperia 1, OG) Physical device (Android 11)

Running

All is included, openning as an Android studio project should allow for a straightforward compilation

FreeType2 is vendored with the code README, the CMakeLists.txt could be edited to use some extant version.

example

About

MWE rendering text with FreeType in android GLSurfaceView (via Compose)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published