Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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)`