Closed Pra3t0r5 closed 4 years ago
Thanks for the issue! This issue appears to be a support request. We use this issue tracker exclusively for bug reports and feature requests. Please use our forum or our slack channel for questions about the framework.
Thank you for using Ionic!
Bug Report
Ionic version: [ ] 4.x [x] 5.3.3
Current behavior: No matter what i do, there is no way to make iOS Simulator load the custom fonts.
I've tested everything I've found across different Ionic versions and all platforms and the current setup works perfectly in
Google Chrome Browser
,Safari Browser
,Android Device
andAndroid Emulator
but not iniOS Simulator
(could not test it iniOS Device
since i don't have one yet).No custom font dependent component is shown except when commenting its font styling (second image).
Expected behavior: Fonts loaded correctly like in any other tested platform: Image reference
Steps to reproduce:
ionic cordova build ios
Related code:
global.scss
(with repeated styling just to test if its correctly loaded only from certain sources)@import '~@ionic/angular/css/padding.css'; @import '~@ionic/angular/css/float-elements.css'; @import '~@ionic/angular/css/text-alignment.css'; @import '~@ionic/angular/css/text-transformation.css'; @import '~@ionic/angular/css/flex-utils.css'; @import '~animate.css/animate.min';
@font-face { font-family: "Gotham";
src: local('GothamMedium'), local('GothamMedium'), url('assets/GothamMedium.eot') format('embedded-opentype'), url('assets/GothamMedium.woff2') format('woff2'), url('assets/GothamMedium.woff') format('woff'), url('assets/GothamMedium.ttf') format('truetype'), url('assets/GothamMedium.svg#GothamMedium') format('svg'); font-weight: normal; font-style: normal; }
@font-face { font-family: "Gotham"; src: local('GothamBold'), local('GothamBold'), url('assets/GothamBold.eot') format('embedded-opentype'), url('assets/GothamBold.woff2') format('woff2'), url('assets/GothamBold.woff') format('woff'), url('assets/GothamBold.ttf') format('truetype'), url('assets/GothamBold.svg#GothamBold') format('svg'); font-weight: bold; font-style: normal; }
@mixin font($weight, $size: false, $shadow: false, $align: false) { font-family: "Gotham" !important; font-weight: $weight;
} //... /:root[mode=ios] .gotham, :root[mode=md] .gotham{ --ion-font-family: 'Gotham' !important; font-family: 'Gotham' !important; }/ }
.subtitulo { @include font(normal, 3.5vw, false, center); margin: auto !important; }
ion-card-title, h1 { top: -10px; @include font(bold, 9vw, true); color: var(--ion-color-primary); }
fonts.scss
(i was going to deprecate it if theglobals.scss
code block functioned correctly, or the inverse). I do usemixins
to make styling faster.angular.json
package.json
Ionic info:
Ionic:
Ionic CLI : 6.11.12 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.3.3 @angular-devkit/build-angular : 0.901.12 @angular-devkit/schematics : 9.1.12 @angular/cli : 9.1.12 @ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0 Cordova Platforms : ios 6.1.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 15 other plugins)
Utility:
cordova-res : 0.15.1 native-run (update available: 1.2.2) : 1.1.0
System:
ios-sim : 8.0.2 NodeJS : v12.16.2 (/usr/local/bin/node) npm : 6.14.4 OS : macOS Catalina Xcode : Xcode 12.0.1 Build version 12A7300
StackOverflow Question