What is the default font android

What is the default font family in Android?

Starting in API 16, Jellybean Roboto was introduced as available font family to use. See whats «new» in Android 16 here.

Specifying android:fontFamily=»sans-serif» (Roboto in API 16+) on a TextView the default fontFamily of the TextView ?

From Material design typography website:

«Roboto and Noto are the standard typefaces on Android and Chrome.»

«Roboto is a sans-serif typeface family developed by Google as the system font for its mobile operating system Android.»

I do not see in the docs what the default fontFamily of Android is. See references:

  • https://developer.android.com/reference/android/R.attr.html#fontFamily
  • Valid values for android:fontFamily and what they map to?
  • https://developer.android.com/about/versions/android-4.1.html#Fonts
  • http://alvinalexander.com/photos/android-roboto-fonts-examples

Answers

There is no documentation on d.android.com for font family names. However, if you look at AOSP, the default fonts are loaded in android.graphics.* . The FontListParser loads the default fonts from /system/etc/fonts.xml (Android 5.0+) or /system/etc/system_fonts.xml (Android 4.1). The default fonts are loaded in Typeface#init.

The two XML files have some documentation. The first font is the default font. You can pull /system/etc/fonts.xml from your device. A device manufacturer or custom ROM may change the default system fonts.

fonts.xml (API 21+)

NOTE: this is the newer (L) version of the system font configuration, supporting richer weight selection. Some apps will expect the older version, so please keep system_fonts.xml and fallback_fonts.xml in sync with any changes, even though framework will only read this file.

All fonts withohut names are added to the default list. Fonts are chosen based on a match: full BCP-47 language tag including script, then just language, and finally order (the first font containing the glyph).

Order of appearance is also the tiebreaker for weight matching. This is the reason why the 900 weights of Roboto precede the 700 weights — we prefer the former when an 800 weight is requested. Since bold spans effectively add 300 to the weight, this ensures that 900 is the bold paired with the 500 weight, ensuring adequate contrast.

system_fonts.xml (API 16-20)

This file lists the font families that will be used by default for all supported glyphs. Each entry consists of a family, various names that are supported by that family, and up to four font files. The font files are listed in the order of the styles which they support: regular, bold, italic and bold-italic. If less than four styles are listed, then the styles with no associated font file will be supported by the other font files listed.

The first family is also the default font, which handles font request that have not specified specific font names.

Источник

How to Install Fonts on Android

So you can be really fontsy

Have you ever paid attention to how many different fonts you look at throughout your day? Fonts are all over the internet, in documents you read, in every app you use, and of course – on your smartphone. Sometimes a certain font can even be a determining factor in whether you choose to read the content or use a certain app or not.

Читайте также:  Как восстановить закрытые вкладки яндекс андроид

Android phones come with a built-in default font. If you don’t like it, that’s no reason to stop using your phone. Especially since on Android you can easily change it and install another font that you like. Learn about all the methods you can use to install new fonts on your Android smartphone.

How to Change the Default Font on Your Android Device

The easiest way to change fonts on your Android device is by using the built-in option to do it. Unfortunately, if you’re using a clean or “vanilla” Android like a Pixel phone, this option won’t be available and you’ll have to rely on other methods to change your font. However, many devices like Samsung, LG, HTC will allow you to change the font through the smartphone’s settings.

The exact path to changing the default font on your Android will differ depending on your smartphone’s brand. To begin with, open the Settings app on your phone. On some phones, you’ll find the option to change your font under Display > Font Style, while other models allow you to download and install new fonts by following the path Display > Fonts > Download.

Have a look around your smartphone’s settings and see if any of these options are available for you.

Install New Fonts on Android Using iFont

If you tried the built-in method and it didn’t work for you, the next thing to try is installing a third-party app called iFont that allows you to change install fonts on your Android. iFont is an app that will let you change your default Android font and use a custom one of your choice. Once you install the font, iFont will change it everywhere within your smartphone’s OS (operating system).

iFont works differently depending on whether your smartphone’s rooted or not. Rooting your phone is a procedure that gives you more control over your Android device and allows you to perform such configurations like removing pre-installed bloatware from your phone to free up your memory, or installing and running apps that require special privileges.

How to Use iFont on a Non-Rooted Smartphone

Even if your phone isn’t rooted, you can still give iFont a try and see if you can use it to install fonts on your Android.

  1. Before using the app, make sure you enable Unknown source installations on your phone. To do that, follow the path Settings >Security >App Installation >Unknown source installations, then choose iFont >Allow to enable it.

  1. The next step is to open the app and choose a font that you like. You can either use the Recommended or Find tab to do it.

  1. Select the font that you like. Then select Download.

  1. You’ll see a pop-up message on your phone when the download’s complete. Select Set.

  1. When using iFont for the first time, the app will prompt you to go through the instructions before changing the font on your smartphone. You can choose to read or skip it.

Some smartphones will change the font straight away. If that didn’t happen, follow the path Settings > Display > Font to manually switch to the font you just downloaded.

How to Use iFont on a Rooted Smartphone

For some smartphones, iFont needs special permission to install and change your factory font. That’s no problem for users who have previously rooted their smartphones. If you’re using a rooted Android and have Unknown source installations enabled, here’s how to use the app to install custom fonts on your Android.

  1. Download and open the iFont app. Then select the font you’d like to use.
Читайте также:  Kinoplay для телевизора андроид

  1. On the desired font’s page, select Download at the bottom of the screen.

  1. After the download’s complete, select Set.

You’ll see a pop-up message informing you that iFont is requesting SuperUser permissions. After you accept the request, your font should change. If that didn’t happen, follow the path Settings > Display > Font to manually switch to the font you just downloaded.

Install New Fonts on Android Using Action Launcher

If all the methods described above failed, you can try using a third-party launcher to change your factory font on Android. Its main function is to give you more control over the User Interface and layout of your smartphone’s homescreen.

A launcher will also allow you to use a custom font instead of the default one. The only downside is that the changed font will only affect the main UI, meaning that it won’t change the font within the apps you’re using.

There are a few different third-party launchers that you can try, including the Action Launcher. It’s a free app that supports various custom fonts. Here’s how to use it to install a new font on your Android.

  1. Download and install Action Launcher from the Google Play store.
  1. Action Launcher will prompt you to go through all of the customization options first and give it permission to change your default Launcher. Select Done after you’re finished.

  1. You’ll now see an Action Launcher Settings icon on your home screen. Select Action Settings.

  1. Select Appearance.

  1. Select Font to change the default font on your smartphone. Choose a font that you like from the list.

Action Launcher will then automatically apply the font you selected to your main UI.

Time to Customize Your Android

The main advantage of an Android smartphone is how customizable it is. You can tweak and change your phone to your liking, down to the smallest detail such as font. Even though different manufacturers have different paths that you’ll have to follow, you’re bound to find a way to install custom fonts on your Android device after trying the various methods that we described in this article.

Have you ever tried to change the factory font on your Android device? Which method (or methods) did you choose to do it? Share your experience with customizing your smartphone in the comments section below.

Anya is a freelance technology writer. Originally from Russia, she is currently a full-time Remote Worker and Digital Nomad. With a background in Journalism, Language Studies, and Technical Translation, Anya couldn’t imagine her life and work without using modern technology on a daily basis. Always looking out for new ways to make her life and location-independent lifestyle easier, she hopes to share her experiences as a tech- and internet-addict through her writing. Read Anya’s Full Bio

Источник

Android и кастомные шрифты или «Да здравствует API 26»

Как было раньше. Краткий обзор

Если было много view где требовались нестандартные шрифты, то мы использовали что-то вроде такого:

view.xml

CustomFontTextView.class

И это я пропустил огромный кусок который отвечает за то, чтобы не писать каждый раз путь к шрифту, а указывать

Ну, или шли на гитхаб и в результате находили Calligraphy (7000 звезд!)

Ни для кого не секрет что этот подход содержал много минусов как в огромном количестве boilerplate кода, так и в том, чтобы сделать это эффективно и где-нибудь не утечь по памяти запрашивая каждый раз Typeface.

Читайте также:  Apk для андроид мобильная версия

Но все изменилось в API 26

Похоже, гугл наконец-то сдался и решил отказаться от навязывания Roboto и сделал удобное подключение сторонних шрифтов, за что ему огромное спасибо.

Линк для тех, кто любит читать в оригинале.

Теперь подключение состоит всего из нескольких несложных шагов:

1. Создаем папку font в res
Resource type выбираем font

2. Перетаскиваем в новую папку все нужные нам в проекте шрифты

3. Создаем файл для семейства шрифтов.

Обратите внимание: я сразу добавил в пример то как должен выглядеть файл, если вы хотите поддерживать и более старые версии Андроида. (Начиная с 14). Если вам повезло и у вас таргет только на супер-новые девайсы, то ваш файл сократится в 2 раза

Ну а дальше остается только наслаждаться сборкой

Использование в TextView

Используем в стилях

И у вас больше не болит голова об эффективности 🙂

Источник

What is the default font family in Android?

Starting in API 16, Jellybean Roboto was introduced as available font family to use. See whats «new» in Android 16 here.

Specifying android:fontFamily=»sans-serif» (Roboto in API 16+) on a TextView the default fontFamily of the TextView ?

From Material design typography website:

«Roboto and Noto are the standard typefaces on Android and Chrome.»

«Roboto is a sans-serif typeface family developed by Google as the system font for its mobile operating system Android.»

I do not see in the docs what the default fontFamily of Android is. See references:

  • https://developer.android.com/reference/android/R.attr.html#fontFamily
  • Valid values for android:fontFamily and what they map to?
  • https://developer.android.com/about/versions/android-4.1.html#Fonts
  • http://alvinalexander.com/photos/android-roboto-fonts-examples

Answers

There is no documentation on d.android.com for font family names. However, if you look at AOSP, the default fonts are loaded in android.graphics.* . The FontListParser loads the default fonts from /system/etc/fonts.xml (Android 5.0+) or /system/etc/system_fonts.xml (Android 4.1). The default fonts are loaded in Typeface#init.

The two XML files have some documentation. The first font is the default font. You can pull /system/etc/fonts.xml from your device. A device manufacturer or custom ROM may change the default system fonts.

fonts.xml (API 21+)

NOTE: this is the newer (L) version of the system font configuration, supporting richer weight selection. Some apps will expect the older version, so please keep system_fonts.xml and fallback_fonts.xml in sync with any changes, even though framework will only read this file.

All fonts withohut names are added to the default list. Fonts are chosen based on a match: full BCP-47 language tag including script, then just language, and finally order (the first font containing the glyph).

Order of appearance is also the tiebreaker for weight matching. This is the reason why the 900 weights of Roboto precede the 700 weights — we prefer the former when an 800 weight is requested. Since bold spans effectively add 300 to the weight, this ensures that 900 is the bold paired with the 500 weight, ensuring adequate contrast.

system_fonts.xml (API 16-20)

This file lists the font families that will be used by default for all supported glyphs. Each entry consists of a family, various names that are supported by that family, and up to four font files. The font files are listed in the order of the styles which they support: regular, bold, italic and bold-italic. If less than four styles are listed, then the styles with no associated font file will be supported by the other font files listed.

The first family is also the default font, which handles font request that have not specified specific font names.

Источник

Оцените статью