GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MostafaTaghipour/FontManager: A font manager for Android to apply custom font to whole app, support multi font and change font at runtime

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
app
app
 
 
fontmanager
fontmanager
 
 
gradle/wrapper
gradle/wrapper
 
 
screenshots
screenshots
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

AndroidFontManager

iOS version is here

AndroidFontManger is a font manager for Android:

  • Support custom fonts
  • Apply to entire app
  • Support Multiple fonts
  • Change font at runtime
  • XML compatible
  • Code compatible
  • Supports various text appearances and font weights

custom font app

Requirements

  • Api 14+

Installation

Add JitPack to repositories in your project's root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency to your module's build.gradle file:

dependencies {
    ...
    implementation 'com.github.MostafaTaghipour:fontmanager:${version}'
}

Usage

  • Add your custom fonts to your project

fonts

  • Declare your fonts
companion object {
    val exo: AppFont
        get() = AppFont.AppFontBuilder(1, "Exo", "fonts/exo/", "Exo-Regular", "ttf")
                .thin("Exo-Thin")
                .extraLight("Exo-ExtraLight")
                .light("Exo-Light")
                .regular("Exo-Regular")
                .medium("Exo-Medium")
                .semiBold("Exo-SemiBold")
                .bold("Exo-Bold")
                .extraBold("Exo-ExtraBold")
                .black("Exo-Black")
                .build()


    val taviraj: AppFont
        get() = AppFont.AppFontBuilder(2, "Taviraj", "fonts/taviraj/", "Taviraj-Regular", "ttf")
                .thin("Taviraj-Thin")
                .extraLight("Taviraj-ExtraLight")
                .light("Taviraj-Light")
                .regular("Taviraj-Regular")
                .medium("Taviraj-Medium")
                .semiBold("Taviraj-SemiBold")
                .bold("Taviraj-Bold")
                .extraBold("Taviraj-ExtraBold")
                .black("Taviraj-Black")
                .build()
}
  • Wrap the Activity Context:
override fun attachBaseContext(newBase: Context) {
    super.attachBaseContext(FontManager.wrapContext(newBase))
}
  • Any time you need to change the font of the application use the following code
FontManager.getInstance().currentFont = taviraj /* your desired font */
  • Thats it, enjoy it

TextAppearance

If you want use TextAppearances use the following code

XML

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="some text"
        android:textAppearance="@style/Text.Subhead" />

Code

FontManager.applyTextAppearanceToTextView(this,textView,R.style.Text_Bold)

Dependencies

  • Calligraphy3
  • Viewpump

Author

Mostafa Taghipour, [email protected]

License

AndroidFontManager is available under the MIT license. See the LICENSE file for more info.

About

A font manager for Android to apply custom font to whole app, support multi font and change font at runtime

Topics

customfontfont-managerfontweightmultifonttext-apetextappearancetypography

Resources

Readme
Activity

Stars

6 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.