FreeType:Android:NDK
lastmod 2021-01-02created 2016-06-232 edits
Explains how to use FreeType in the Android NDK.
Using FreeType in the Android NDK
Copy libskia.so from the emulator or device to the local library folder. It seems to differ by version, but in my environment shown here I confirmed that this file contains FreeType.
Register the added libskia.so file in the Android.mk file.
Add the FreeType header to the native code and use the functions.
Using FreeType fonts in the NDK
The Android platform includes the freetype font library, but the ndk does not provide it, so you have to fetch it from the emulator or phone with the pull command. The freetype font library is located at /system/lib/libskia.so.
Copy the extracted library to the NDK lib folder for the platform. The Android 2.2 library folder in NDK r5 is as follows.
Edit Android.mk so that libskia.so is linked during JNI compilation.
To use the freetype header files, download the freetype files from the link below. The URL is http://sourceforge.net/projects/freetype/files/.
Extract the archive and copy the header files in the include folder to the NDK include folder (android-ndk-r5b\platforms\android-8\arch-arm\usr\include\). The Android 2.2 header file folder in NDK r5 is as follows.
In the JNI code, add the header files as below and use them.