InflationX / Calligraphy

Custom fonts in Android the easy way...
Apache License 2.0
1.09k stars 82 forks source link

allow injection of fonts directly into the font cache #18

Closed deano2390 closed 5 years ago

deano2390 commented 5 years ago

the motive here was to allow me to load fonts from the file system rather than the assets folder

deano2390 commented 5 years ago

typical usage might be like so:

File fontFile = new File("regular.ttf"); Typeface font = Typeface.createFromFile(fontFile); TypefaceUtils.installFont("regular", font);

and then in your layout:

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" fontPath="regular"/>

deano2390 commented 5 years ago

just realised pull request #17 pretty much solves the same issue in another way!

jbarr21 commented 5 years ago

let's go with #17 instead