Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to style the android fonts styles with leading and tracking?

Is it possible to have the followings in android font styling.

  1. Leading (the space vertically between lines of text - name comes from the physical piece of lead that used to be used in mechanical printing process to separate lines of text).

  2. Tracking (the horizontal space between each character).

If you have any ideas please share with me.

like image 748
Joshua Avatar asked Apr 11 '11 10:04

Joshua


2 Answers

  1. You can change leading by calling TextView's method setLineSpacing() or changing corresponding XML attributes of TextView in layout (android:lineSpacingExtra or android:lineSpacingMultiplier).

  2. As answered here:

AFAIK, you cannot adjust kerning in TextView. You may be able to adjust kerning if you draw the text on the Canvas yourself using the 2D graphics APIs.

Update: since API 21 there is an option to set kerning/tracking/letter spacing. You can call method setLetterSpacing() or set it in XML with attribute letterSpacing.

like image 66
Sergey Glotov Avatar answered Oct 20 '22 01:10

Sergey Glotov


For Tracking, check out this answer. It works fine for me.

like image 31
Pedro Barros Avatar answered Oct 20 '22 01:10

Pedro Barros