Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/workarounds/typography
**DEPRECATED**. Use the native and support library variants instead - https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html. An android library that makes it easy to add custom fonts to edittexts and textviews
https://github.com/workarounds/typography
Last synced: 3 months ago
JSON representation
**DEPRECATED**. Use the native and support library variants instead - https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html. An android library that makes it easy to add custom fonts to edittexts and textviews
- Host: GitHub
- URL: https://github.com/workarounds/typography
- Owner: workarounds
- Created: 2015-08-23T15:06:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-25T19:10:17.000Z (over 8 years ago)
- Last Synced: 2024-04-25T23:34:33.411Z (6 months ago)
- Language: Java
- Homepage:
- Size: 148 KB
- Stars: 43
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-android - Typography - An Android library that makes it easy to use custom fonts in views. (Libraries / Other)
- awesome-android - Typography - An Android library that makes it easy to use custom fonts in views. (Libraries / Other)
README
[![Build Status](https://travis-ci.org/workarounds/typography.svg?branch=master)](https://travis-ci.org/workarounds/typography)
#### Add to your project ####
Add this line to your dependencies in `build.gradle`
```
compile 'in.workarounds.typography:typography:0.0.8'
```#### Using the views ####
There are two important attributes that define a font
+ `font_name` Ex: 'Roboto', 'Helvetica'
+ `font_variant` Ex: 'Bold', 'Condensed'So if you want to add a TextView with the font 'Roboto-Condensed', you add the following to your layout file
``` xml```
You can utilize the following views to improve the typography in your app:
`in.workarounds.typography.`
+ TextView
+ EditText
+ AutoCompleteTextView
+ Button
+ Checkbox
+ RadioButton
+ ToggleButton#### Font Files ####
Place your fonts in `assets/fonts/` folder and use the following naming convention
```
`-.`
````` can be `ttf` or `otf`. Both `font_name` and `font_variant` attribute are **case insensitive**.
Note: If you want to use `Roboto.ttf`, do not use the `font_variant` attribute.
#### FontLoader ####
`FontLoader` is the class responsible for caching the `Typeface`s and setting the fonts to the Views.Set the default font name and font variant in your Application class
> `FontLoader.setDefaultFont(fontName, fontVariant)`Enable detailed logs(errors are always logged)
> `FontLoader.setLoggingEnabled(true)`