Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marteinn/android-fontmanager
FontManager makes it easier to work with external fonts in Android.
https://github.com/marteinn/android-fontmanager
Last synced: about 1 month ago
JSON representation
FontManager makes it easier to work with external fonts in Android.
- Host: GitHub
- URL: https://github.com/marteinn/android-fontmanager
- Owner: marteinn
- License: mit
- Created: 2014-06-21T18:16:48.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-23T18:01:01.000Z (over 10 years ago)
- Last Synced: 2023-04-26T15:40:58.255Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 262 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Android-FontManager
==============
FontManager is a utility that makes it easier to work with fonts in Android.## How it works
FontManagers loads fonts and converts them as typefaces, then allows you to apply them by either using the `ApplyFont` annotation or the `get` method.
## Implementation
FontManager's primary feature is the @ApplyFont annotation, just specify it along with the component you want to apply the font to:
public class Main extends Activity {
@ApplyFont(Fonts.AKKURAT_LIGHT)
TextView label;
Then just call `apply` when your components has been initialized with the class containing the component.
FontsManager.getInstance().apply(this);
You can also retrive the Typefaces through `get`.FontsManager.getInstance().get(Fonts.AKKURAT_LIGHT);
## Setting up:
1. First put your fonts in **assets/fonts**, I use two font files called Akkurat-Bold.otf and Akkurat-Light.otf. *(I have only worked with .otf files so far)*.
2. Create a new class that will hold the filenames for your fonts, I named mine Fonts.javapackage com.example.app;
public class Fonts {
public static final String AKKURAT_BOLD = "Akkurat-Bold.otf";
public static final String AKKURAT_LIGHT = "Akkurat-Light.otf";
}3. Time to let FontManager know which fonts to work with, go to your application class and define them.
se.marteinn.utils.fonts.fontmanager.FontManager;
@Override
protected void onCreate(Bundle savedInstanceState) {FontsManager.createInstance(this)
.define(new String[]{
Fonts.AKKURAT_BOLD,
Fonts.AKKURAT_LIGHT
});
}## Setup
#### Locally
Download [fontmanager.aar](https://github.com/marteinn/Android-FontManager/blob/master/dist/fontmanager.aar) and move it to your libs folder, then make sure you got libs specified as a flatDir in `gradle.config`
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}After that just include it as any other dependency.
dependencies {
compile 'se.marteinn.utils.fonts:fontmanager:1.0-BETA@aar'
}## Contributing
Want to contribute? Awesome. Just send a pull request.
This project is setup as a Android Library for Android Studio. Use `make build` to build.
## License
Android-FontManager is released under the [MIT License](http://www.opensource.org/licenses/MIT).