Android font weight

broken image
broken image

fixfonts.sh /path/to/root/FontDemo/android/app/src/main/res/fontĬreate the android/app/src/main/res/font/raleway.xml file with the below content. You can use the below bash script (make sure you give the font folder as first argument): #!/bin/bash

broken image

Replace any uppercase letter with its lowercase counterpart.We must rename the font files following these rules to comply with Android asset names restrictions: Copy and rename assets to the resource font folder mkdir android/app/src/main/res/fontĬp /tmp/raleway/*.ttf android/app/src/main/res/font This name will be used in React fontFamily style. It is shipped with many Linux distributions. You will need otfinfo installed in your system to perform this step. I will use Raleway for this example, but this method should work with any font family! I am assuming that you have the whole Raleway font family TTF files, extracted in a temporary folder, /tmp/raleway. Remark: This procedure is available in React Native since commit fd6386a07eb75a8ec16b1384a3e5827dea520b64 ( ), with the addition of ReactFontManager::addCustomFont method. I have written a complete guide here for a consistent typeface multi-platform experience. Since React Native 0.66.0 (tested with RN 0.66.3), it is absolutely feasible! The solution is to use XML Fonts feature for Android.

broken image