GithubHelp home page GithubHelp logo

fontysfaction's Introduction

Fontysfaction

Fontysfaction is an Open Source Android library that allows developers to easily create applications with custom fonts. Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.

Screenshot

Setup

1. In Eclipse, import the library as an Android library project. Project > Clean to generate the binaries you need, like R.java, etc.

2. Then, add Fontysfaction as a dependency to your existing project.

3. At Last quick setup your application class and you are good to go!

public class TestApplication extends Application {

	@Override
	public void onCreate() {
		super.onCreate();
		
		//Create a base FontyConfiguration and initialize FontyLoader
		FontyConfiguration configuration = FontyConfigurationBuilder.builder()
		    ...		
		    .build();
		FontyLoader.getInstance().init(configuration);
	}
}

Configuration

All options in FontyConfiguration builder are optional. Use only those you really want to customize.

FontyConfiguration configuration = FontyConfigurationBuilder.builder()
	.fontEntity(MyFontyEntity .class)
	.sourceTypo(FontySourceTypo.assets)
	.extension(".ttf")
	.path("base_path")
	.build();

FontyEntity

You can configure your FontyEntity via Annotations, only required one is @FontyEntity! Screenshot

//full configuration example
@FontyPath("fonts")
@FontyEntity
public class MyFontyEntity {

	@FontyIdentifier(FontyTypo.regular)
	@FontyName("MyFont-Regular")
	@FontyPath("myfont")
	public String regular;

	@FontyIdentifier(FontyTypo.bold)
	@FontyName("MyFont-Bold")
	@FontyPath("myfont")
	public String bold;

	@FontyIdentifier(FontyTypo.light)
	@FontyName("MyFont-Light")
	@FontyPath("myfont")
	public String light;

	@FontyIdentifier(FontyTypo.regular_italic)
	@FontyName("MyFont-Regular-Italic")
	@FontyPath("myfont")
	public String regular_italic;

	@FontyIdentifier(FontyTypo.bold_italic)
	@FontyName("MyFont-Bold-Italic")
	@FontyPath("myfont")
	public String bold_italic;

	@FontyIdentifier(FontyTypo.light_italic)
	@FontyName("MyFont-Light-Italic")
	@FontyPath("myfont")
	public String light_italic;
}

XML Usage

If you decide to use Fontysfaction as a view, you can define it in your xml layouts like this:

<com.fattorini.luca.android.fontysfaction.view.FontyTextView
    xmlns:fonty="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hey, this is a regular TextView Fontysfaction"
    fonty:font="regular" />

<com.fattorini.luca.android.fontysfaction.view.FontyButton
    xmlns:fonty="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hey, this is a bold Button Fontysfaction!"
    fonty:font="bold" />
    
<com.fattorini.luca.android.fontysfaction.view.EditText
    xmlns:fonty="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hey, this is a regular-italic EditText Fontysfaction!"
    fonty:font="regular_italic" />

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.