Skip to content

Commit

Permalink
Fix github flavored markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterAttardo committed Jun 29, 2017
1 parent cf7b5a9 commit cf7e625
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#Fontain
# Fontain

Fontain is a lightweight library for displaying text in custom fonts in your Android applications

##Features
## Features
Fontain allows you to include a number of custom fonts within your app, and then access them by their Font Family, Weight, Width and Slope. It simplifies the process of selecting the proper typeface for any given usage.

##Usage
## Usage

###Gradle
### Gradle

```groovy
compile 'com.scopely:fontain:1.0.0'
```

###Setup
### Setup

In order for Fontain to be able to make use of your custom fonts, they must be placed in the Assets folder, with the following directory structure:

Expand Down Expand Up @@ -41,7 +41,7 @@ Example:
The weight, width and slope information of a particular font will be parsed from its name, so any relevant descriptors must remain in the font name. "Helvetica.otf" will be assumed to have Normal weight, Normal width and not italic. "Helvetica-UltraBold-Italic.otf" will be treated as having UltraBold weight, Normal width and italic.


###Initializing
### Initializing
You must initialize Fontain with a ```Context``` and the name of whatever font family you want to be the default.

Fontain must be initialized before it is used (including the inflation of any of Fontain's custom Font Views), so that it may create fonts from the assets folder, but it need only be initialized once.
Expand All @@ -55,11 +55,11 @@ Fontain.init(Context context)

Your application's onCreate() method is the recommended place to initialize Fontain.

###Usage
### Usage

Fontain can be used primarily in one of two ways:

####Font Views
#### Font Views

Fontain provides a number of Font Views that are extended from Android's basic text views (```TextView``` => ```FontTextView```, ```Button``` => ```FontButton```, etc). You can use these views exactly as you would use the regular android version, and on creation they will seek out the default Typeface from Fontain and apply it to themselves. Additionally these views come with custom XML attributes that allow you to specify the Font Family, Weight, Width and/or Caps Mode directly in layout XML (Slope is taken from Android's native TextStyle attribute). Example usage:

Expand All @@ -81,12 +81,12 @@ Fontain provides a number of Font Views that are extended from Android's basic t
</LinearLayout>
```

#####Caps Mode
##### Caps Mode
All of the Font Views include the ability to set a Caps Mode. Doing so will initialize the view with a ```TransformationMethod``` that will display the text of the view with certain letters capitalized. Caps Mode ```characters``` will capitalize all letters, Caps Mode ```words``` will capitalize the first letter of each word, and Caps Mode ```sentences``` will capitalize the first letter of each sentence. Caps Mode ```title``` is equivalent to ```words``` except that certain words, such as 'a', 'of', etc, are not capitalized*. Caps Mode is analagous to, and is implemented with, Android's ```TextUtils.CAP_MODE_XXXXX```, but with more granular control in xml than merely ```android:textAllCaps```.

*\*Caps Mode ```title``` is only applicable to English. In non-'en' locales, Caps Mode ```title``` will behave the same as Caps Mode``` words```.*

####Apply to View Hierarchy
#### Apply to View Hierarchy
Fontain also contains methods for walking a view hierarchy and applying a given typeface to any TextView contained therein. Fontain provides several overloaded methods that achieve the same thing:

```java
Expand All @@ -109,7 +109,7 @@ The use case for these methods is generally when the layout in question is provi

Each of these methods also has an overloaded version that takes a ```Predicate<TextView>``` that allows you to introspect each TextView in the hierarchy and return ```true``` to apply the Font/FontFamily/TransformationMethod, or ```false``` to skip the TextView in question.

##Spans
## Spans
Fontain also provides the following spans that allow you to change font within a single TextView:

FontSpan: applies a specified typeface to the spanned text
Expand All @@ -120,8 +120,8 @@ Fontain also provides the following spans that allow you to change font within a
These spans all extend ```MetricAffectingSpan``` are applied in the same manner as sibling classes such as ```RelativeSizeSpan``` and ```SubscriptSpan```.


##Definitions
###Weight
## Definitions
### Weight
The weight of a font is its thickness. Bold is the classic descriptor related to weight, but there are many more, and all correspond to a numerical value on a scale that ranges from 100 to 900. The names and numerical values used by Fontain are listed below:

HAIRLINE: 100
Expand All @@ -145,7 +145,7 @@ The weight of a font is its thickness. Bold is the classic descriptor related to
FAT: 900
POSTER: 900

###Width
### Width
The width of a font is the the horizontal space taken up by each letter relative to the letter's height. There are commonly accepted descriptors, but no standard numerical value the way there is with weight. Fontain simply maps the descriptors to a 1-5 scale. The names used by Fontain are listed below:

ULTRA_COMPRESSED: 1
Expand All @@ -168,5 +168,5 @@ The width of a font is the the horizontal space taken up by each letter relative
EXTRA_EXPANDED: 5
ULTRA_EXPANDED: 5

###Slope
### Slope
The slope of a font is the angle at which the presumably vertical elements of the font rest. In Fontain this is a simple boolean: the font is either Normal or it is Italic.

0 comments on commit cf7e625

Please sign in to comment.