Android Font Library (core)

Font library for Android with xml, style and textAppearance support. Include fontlib-native or fontlib-suport instead of fontlib-core.

License

License

GroupId

GroupId

com.innovattic
ArtifactId

ArtifactId

fontlib-core
Last Version

Last Version

5.1.0
Release Date

Release Date

Type

Type

aar
Description

Description

Android Font Library (core)
Font library for Android with xml, style and textAppearance support. Include fontlib-native or fontlib-suport instead of fontlib-core.
Project URL

Project URL

https://github.com/Innovattic/Android-Font-Library
Source Code Management

Source Code Management

https://github.com/Innovattic/Android-Font-Library

Download fontlib-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.innovattic/fontlib-core/ -->
<dependency>
    <groupId>com.innovattic</groupId>
    <artifactId>fontlib-core</artifactId>
    <version>5.1.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.innovattic/fontlib-core/
implementation 'com.innovattic:fontlib-core:5.1.0'
// https://jarcasting.com/artifacts/com.innovattic/fontlib-core/
implementation ("com.innovattic:fontlib-core:5.1.0")
'com.innovattic:fontlib-core:aar:5.1.0'
<dependency org="com.innovattic" name="fontlib-core" rev="5.1.0">
  <artifact name="fontlib-core" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.innovattic', module='fontlib-core', version='5.1.0')
)
libraryDependencies += "com.innovattic" % "fontlib-core" % "5.1.0"
[com.innovattic/fontlib-core "5.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Android-Font-Library

This is a library that makes it easy for you to add custom fonts to your Android application. For a detailed description of why we made this library and how it works, please read this blogpost. For those that want a quickstart, read on below.

Gradle dependency

If you are using the Android Support Library, use this dependency to use font aware TextView's that extend from their AppCompat versions of the support library. The support library is not a transitive dependency, so you have to add it by yourself.

compile 'com.innovattic:fontlib-support:5.0.0'

Otherwise, use the following variant to use the font aware TextView's that extend from the native counterparts:

compile 'com.innovattic:fontlib-native:5.0.0'

Usage

To use the library, add it to your project as a gradle dependency, specify your font xml file, call TypefaceManager.init() (typically in your Application class' onCreate) and use any of the font aware TextViews.

A font xml file is placed in app/res/xml and can look like this:

<?xml version="1.0" encoding="utf-8"?>
<familyset>
	<family>
		<nameset>
			<name>aspergit</name>
			<name>any-alias</name>
		</nameset>
		<fileset>
			<file>aspergit/Aspergit.ttf</file>
			<file>aspergit/Aspergit Bold.ttf</file>
			<file>aspergit/Aspergit Italic.ttf</file>
			<file>aspergit/Aspergit Bold Italic.ttf</file>
		</fileset>
	</family>
</familyset>

In your layout xml files, use any of the font aware TextViews and set its flFont attribute to your font's name, like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:gravity="center_vertical"
	android:orientation="vertical">

	<com.innovattic.font.FontTextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:text="I am a text view with the font aspergit"
		app:flFont="aspergit" />

	<com.innovattic.font.FontTextView
		style="@style/AspergitStyle"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:text="I am a bold-italic text view with the font aspergit"
		android:textStyle="bold|italic" />

	<com.innovattic.font.FontTextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:textAppearance="@style/AspergitTextAppearance"
		android:text="I am a bold text view with the font aspergit" />
		
</LinearLayout>

Where the styles used in the last two FontTextView's are defined like this:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android" >

	<style name="AspergitStyle">
		<item name="flFont">aspergit</item>
	</style>

	<style name="AspergitTextAppearance">
		<item name="flFont">aspergit</item>
		<item name="android:textStyle">bold</item>
	</style>

</resources>
com.innovattic

Innovattic

Versions

Version
5.1.0
5.0.0