{"_id":"5a6b684793313c005b692e21","category":{"_id":"5a6b684793313c005b692e0a","version":"5a6b684793313c005b692e07","project":"57c87ef85754fa1700b1228d","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-11-05T21:53:37.386Z","from_sync":false,"order":2,"slug":"reference","title":"Reference"},"project":"57c87ef85754fa1700b1228d","parentDoc":null,"user":"57c73a03e6935b1700b15115","version":{"_id":"5a6b684793313c005b692e07","project":"57c87ef85754fa1700b1228d","__v":1,"createdAt":"2018-01-26T17:41:27.297Z","releaseDate":"2018-01-26T17:41:27.297Z","categories":["5a6b684793313c005b692e08","5a6b684793313c005b692e09","5a6b684793313c005b692e0a","5a6b684793313c005b692e0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.5.3","version":"3.5.3"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-08T18:21:53.677Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":16,"body":"**Using Roboto Fonts**\nOur Primer screens allow you to define a font to be used when displaying text. We support the Roboto font family. By default, Roboto fonts are included on all android devices that our SDK supports. Unfortunately, Samsung devices remove the Roboto font family from most of its devices. You can easily add the Roboto font family to your APK by adding the following compile time dependency in your app's build.gradle file. \nNOTE: this will increase the size of your APK, regardless of whether or not its a samsung device. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"compile 'com.goprimer:roboto-fonts:1.0'\",\n      \"language\": \"groovy\"\n    }\n  ]\n}\n[/block]\n**Using Custom Fonts**\nIf your application uses a custom font, Primer can make use of it as well. The SDK will check for TFF font files in the  **assets >> fonts** folder. If your fonts are located somewhere else, you can configure the SDK when initializing Primer to look in a specified directory for the TFF files. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PrimerOptions.Builder builder = PrimerOptions.builder();\\n\\n/**\\nOptional path to font files located in assets\\nex. if your fonts live in a folder named 'myFonts' inside of 'assets', simply pass in 'myFonts' to this method.\\n*/    \\n\\nbuilder.setFontAssetLocation(\\\"myFonts\\\");\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nCustom fonts can be added for use in the Visual Editor by creating a custom font in Project Settings >> Project Styles.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"NOTE\",\n  \"body\": \"If you do not make at least one font available for use, all text will use the default font and weight on Samsung devices (e.g. Samsung-Sans-Regular).\"\n}\n[/block]","excerpt":"","slug":"fonts","type":"basic","title":"Fonts"}
**Using Roboto Fonts** Our Primer screens allow you to define a font to be used when displaying text. We support the Roboto font family. By default, Roboto fonts are included on all android devices that our SDK supports. Unfortunately, Samsung devices remove the Roboto font family from most of its devices. You can easily add the Roboto font family to your APK by adding the following compile time dependency in your app's build.gradle file. NOTE: this will increase the size of your APK, regardless of whether or not its a samsung device. [block:code] { "codes": [ { "code": "compile 'com.goprimer:roboto-fonts:1.0'", "language": "groovy" } ] } [/block] **Using Custom Fonts** If your application uses a custom font, Primer can make use of it as well. The SDK will check for TFF font files in the **assets >> fonts** folder. If your fonts are located somewhere else, you can configure the SDK when initializing Primer to look in a specified directory for the TFF files. [block:code] { "codes": [ { "code": "PrimerOptions.Builder builder = PrimerOptions.builder();\n\n/**\nOptional path to font files located in assets\nex. if your fonts live in a folder named 'myFonts' inside of 'assets', simply pass in 'myFonts' to this method.\n*/ \n\nbuilder.setFontAssetLocation(\"myFonts\");", "language": "text" } ] } [/block] Custom fonts can be added for use in the Visual Editor by creating a custom font in Project Settings >> Project Styles. [block:callout] { "type": "warning", "title": "NOTE", "body": "If you do not make at least one font available for use, all text will use the default font and weight on Samsung devices (e.g. Samsung-Sans-Regular)." } [/block]