mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #2512 from NativeScript/hdeshev/bundle-ios-fonts-dir
Fix iOS font registration when bundling scripts.
This commit is contained in:
@ -315,11 +315,10 @@ export module ios {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerCustomFonts() {
|
function registerFontsInFolder(fontsFolderPath) {
|
||||||
var fontsFolderPath = fs.path.join(__dirname.substring(0, __dirname.indexOf("/tns_modules")), "fonts");
|
const fontsFolder = fs.Folder.fromPath(fontsFolderPath);
|
||||||
if (fs.Folder.exists(fontsFolderPath)) {
|
|
||||||
var fontsFolder = fs.Folder.fromPath(fontsFolderPath);
|
fontsFolder.eachEntity((fileEntity: fs.FileSystemEntity) => {
|
||||||
var onEachEntityFunc = function (fileEntity: fs.FileSystemEntity): boolean {
|
|
||||||
if (fs.Folder.exists(fs.path.join(fontsFolderPath, fileEntity.name))) {
|
if (fs.Folder.exists(fs.path.join(fontsFolderPath, fileEntity.name))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -329,9 +328,14 @@ function registerCustomFonts() {
|
|||||||
ios.registerFont(fileEntity.name);
|
ios.registerFont(fileEntity.name);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fontsFolder.eachEntity(onEachEntityFunc);
|
function registerCustomFonts() {
|
||||||
|
const appDir = fs.knownFolders.currentApp().path
|
||||||
|
const fontsDir = fs.path.join(appDir, "fonts");
|
||||||
|
if (fs.Folder.exists(fontsDir)) {
|
||||||
|
registerFontsInFolder(fontsDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user