Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Custom Fonts don't work with Webpack on ios devices #12

Closed
leocaseiro opened this issue Jul 20, 2016 · 1 comment
Closed

Custom Fonts don't work with Webpack on ios devices #12

leocaseiro opened this issue Jul 20, 2016 · 1 comment

Comments

@leocaseiro
Copy link

At the function registerCustomFonts(), there's a fontsFolderPath which is trying to find the /tns_modules path. However, /tns_modules is not included in the _dirname path when we bundle.

/tns-core-modules/ui/styling/font.ios.ts

var fontsFolderPath = fs.path.join(__dirname.substring(0, __dirname.indexOf("/tns_modules")), "fonts");

@DomGaud and I have a temporary fix for that:

var fontsFolderPath = fs.path.join(__dirname.substring(0, __dirname.indexOf("/tns_modules")), "fonts");

// Try from root as well for webpack bundle.js
if (!fs.Folder.exists(fontsFolderPath)) {
    fontsFolderPath = fs.path.join(__dirname, "fonts");
}

if (fs.Folder.exists(fontsFolderPath)) {
...

Someone with a better fix or should we send a PR?

@NathanaelA
Copy link

@leocaseiro - Nice I just traced the exact same issue down myself. Was about to post a bug report.

My "temporary" solution to work around it was:

if (global.NSObject && global.NSString) {
  var font = require('ui/styling/font');
  font.ios.registerFont('fontawesome-webfont.ttf');
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants