I want to know if it is possible to read kerning pairs using a font using the Android API.
There is no open API for reading kerning pairs from a TTF file. However, I pulled the appropriate code from Apache FOP , and you can read kerning pairs using this library .
Using an example:
TTFFile file = TTFFile.open(getAssets().open("fonts/font.ttf")); Map<Integer, Map<Integer, Integer>> kerning = file.getKerning();
You can also get other metadata. Example:
TTFFile ttfFile = TTFFile.open(new File("/system/fonts/Roboto-Regular.ttf")); String name = ttfFile.getFullName(); // "Roboto Regular" String family = ttfFile.getSubFamilyName(); // "Regular" int fontWeight = ttfFile.getWeightClass(); // 400 String copyright = ttfFile.getCopyrightNotice(); // "Font data copyright Google 2014"
I want to enable kerning for the displayed text.
Cm:
How to set up text kerning in Android TextView?
setLetterSpacing (float)
source share