I am building a Nativescript Angular app with code sharing (TNS Code Sharing). Trying to apply Roboto Regular font, but it seems it's not working. I've seen that there are tons of questions about iOS and custom fonts out there, but none of given answers solves my problem, so I guess it has something to do with the fact that I'm using @nativescript/schematics (code sharing) setup.
If I use file name instead of font name, it works fine on Android, but whatever I specify as font-family, it never works on iOS.
Thanks folks.
Here's the code:
Font file location: src/app/fonts/Roboto-Regular.ttf
src/_app-common.scss
.roboto {
font-family: 'Roboto Regular';
}
src/app/pages/my/my.component.tns.html
<Label [nsRouterLink]="['/about']" text="About" class="h1 text-center roboto" textWrap="true"></Label>
package.json
{
"name": "appname",
"nativescript": {
"id": "no.app.id",
"tns-android": {
"version": "4.2.0"
},
"tns-ios": {
"version": "4.2.0"
}
},
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"android": "tns run android --bundle",
"ios": "tns run ios --bundle"
},
"private": true,
"dependencies": {
"@angular/animations": "~6.1.0",
"@angular/common": "~6.1.0",
"@angular/compiler": "~6.1.0",
"@angular/core": "~6.1.0",
"@angular/forms": "~6.1.0",
"@angular/http": "~6.1.0",
"@angular/platform-browser": "~6.1.0",
"@angular/platform-browser-dynamic": "~6.1.0",
"@angular/router": "~6.1.0",
"core-js": "^2.5.4",
"nativescript-angular": "~6.1.0",
"nativescript-theme-core": "~1.0.4",
"normalize.css": "^8.0.0",
"reflect-metadata": "~0.1.8",
"rxjs": "^6.0.0",
"tns-core-modules": "~4.2.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/cli": "^6.2.0",
"@angular/compiler-cli": "~6.0.3",
"@angular-devkit/build-angular": "^0.8.0",
"@nativescript/schematics": "~0.3.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "^0.16.0",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2",
"nativescript-dev-sass": "~1.6.0"
}
}