Or Continue to Thread: [DETAILED GUIDE][CM11] Build y…
Find Your Device:
28th June 2014, 07:13 PM   |  #2  
codekidX's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 1,738
 
1,091 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Extra Step :

This is to know about font family. Let's say you have a thin or light version of your font ! You add it to the fonts folder inside assets folder like always, but you need to make some changes to the fonts.xml now.

Changes :

You have to make a new family for that. Let's say you have a Roboto light font. To make a new family do this
Code:
<family>
        <nameset>
            <name>sans-serif-light</name>
        </nameset>
        <fileset>
            <file>Roboto-Light.ttf</file>
            <file>Roboto-LightItalic.ttf</file>
        </fileset>
    </family>
See the workflow :

family --> nameset tag --> name(family name. in this case light)
fileset tag --> file(the font name)

Let me explain it with one more example. This is for thin fonts :

Code:
<family> //Declare a new family
        <nameset> 
            <name>sans-serif-thin</name> //family name
        </nameset>
        <fileset>
            <file>Roboto-Thin.ttf</file> //file name
            <file>Roboto-ThinItalic.ttf</file>
        </fileset>
    </family> //End of this family
Families :

sans-serif family has the following types of fonts
Regular
Bold
Italic and
BoldItalic

And the thin and light families has the above types explained in extra step.

Now you say what is the default family set of android, here you go :

Code:
<?xml version="1.0" encoding="utf-8"?>
<familyset>
    <family>
        <nameset>
            <name>sans-serif</name>
            <name>arial</name>
            <name>helvetica</name>
            <name>tahoma</name>
            <name>verdana</name>
        </nameset>
        <fileset>
            <file>Roboto-Regular.ttf</file>
            <file>Roboto-Bold.ttf</file>
            <file>Roboto-Italic.ttf</file>
            <file>Roboto-BoldtItalic.ttf</file>
        </fileset>
    </family>
    
    <family>
        <nameset>
            <name>sans-serif-light</name>
        </nameset>
        <fileset>
            <file>Roboto-Light.ttf</file>
            <file>Roboto-LightItalic.ttf</file>
        </fileset>
    </family>
    
    <family>
        <nameset>
            <name>sans-serif-thin</name>
        </nameset>
        <fileset>
            <file>Roboto-Thin.ttf</file>
            <file>Roboto-ThinItalic.ttf</file>
        </fileset>
    </family>
    
   <family>
        <nameset>
            <name>sans-serif-condensed</name>
        </nameset>
        <fileset>
            <file>RobotoCondensed-Regular.ttf</file>
            <file>RobotoCondensed-Bold.ttf</file>
            <file>RobotoCondensed-Italic.ttf</file>
            <file>RobotoCondensed-BoldItalic.ttf</file>
        </fileset>
    </family>
</familyset>

Last edited by codekidX; 16th December 2014 at 12:40 PM.
The Following 8 Users Say Thank You to codekidX For This Useful Post: [ View ]