Skip to content

Commit d865a80

Browse files
committed
fix: resolve issue #120
- Add custom font support for iOS - Update font handling in NitroTextImpl+Font.swift - Add font assets and configuration - Update example app to demonstrate custom fonts
1 parent 1aab144 commit d865a80

15 files changed

Lines changed: 253 additions & 126 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ project.xcworkspace
3939
.settings
4040
local.properties
4141
android.iml
42+
issue*
4243

4344
# Cocoapods
4445
#
115 KB
Binary file not shown.
157 KB
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"migIndex": 1,
3+
"data": [
4+
{
5+
"path": "assets/fonts/ChivoMono.ttf",
6+
"sha1": "fe260b56219f603a8aaf7fba5cfd2c898bf2bca0"
7+
},
8+
{
9+
"path": "assets/fonts/Tourney.ttf",
10+
"sha1": "1c7f16792740c9c6398692ea2149c5c3a6aaf6e5"
11+
}
12+
]
13+
}

example/assets/fonts/ChivoMono.ttf

115 KB
Binary file not shown.

example/assets/fonts/Tourney.ttf

157 KB
Binary file not shown.

example/ios/NitroTextExample.xcodeproj/project.pbxproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
1313
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
1414
94EE308912A9FD340098AA08 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
15+
98F6E17588234B2CA2A4AE98 /* Tourney.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FF9EF60F857E4AB0B9823535 /* Tourney.ttf */; };
16+
B5298A4D660D4F30A37B2814 /* ChivoMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3F04B18644AC4671BB0B3299 /* ChivoMono.ttf */; };
1517
/* End PBXBuildFile section */
1618

1719
/* Begin PBXFileReference section */
@@ -20,11 +22,13 @@
2022
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = NitroTextExample/Info.plist; sourceTree = "<group>"; };
2123
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = NitroTextExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
2224
3B4392A12AC88292D35C810B /* Pods-NitroTextExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NitroTextExample.debug.xcconfig"; path = "Target Support Files/Pods-NitroTextExample/Pods-NitroTextExample.debug.xcconfig"; sourceTree = "<group>"; };
25+
3F04B18644AC4671BB0B3299 /* ChivoMono.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = ChivoMono.ttf; path = ../assets/fonts/ChivoMono.ttf; sourceTree = "<group>"; };
2326
5709B34CF0A7D63546082F79 /* Pods-NitroTextExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NitroTextExample.release.xcconfig"; path = "Target Support Files/Pods-NitroTextExample/Pods-NitroTextExample.release.xcconfig"; sourceTree = "<group>"; };
2427
5DCACB8F33CDC322A6C60F78 /* libPods-NitroTextExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NitroTextExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
2528
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = NitroTextExample/AppDelegate.swift; sourceTree = "<group>"; };
2629
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = NitroTextExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
2730
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
31+
FF9EF60F857E4AB0B9823535 /* Tourney.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = Tourney.ttf; path = ../assets/fonts/Tourney.ttf; sourceTree = "<group>"; };
2832
/* End PBXFileReference section */
2933

3034
/* Begin PBXFrameworksBuildPhase section */
@@ -51,6 +55,16 @@
5155
name = NitroTextExample;
5256
sourceTree = "<group>";
5357
};
58+
2D10C1EE03554F54B2107B66 /* Resources */ = {
59+
isa = PBXGroup;
60+
children = (
61+
FF9EF60F857E4AB0B9823535 /* Tourney.ttf */,
62+
3F04B18644AC4671BB0B3299 /* ChivoMono.ttf */,
63+
);
64+
name = Resources;
65+
path = "";
66+
sourceTree = "<group>";
67+
};
5468
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
5569
isa = PBXGroup;
5670
children = (
@@ -75,6 +89,7 @@
7589
83CBBA001A601CBA00E9B192 /* Products */,
7690
2D16E6871FA4F8E400B85C8A /* Frameworks */,
7791
BBD78D7AC51CEA395F1C20DB /* Pods */,
92+
2D10C1EE03554F54B2107B66 /* Resources */,
7893
);
7994
indentWidth = 2;
8095
sourceTree = "<group>";
@@ -161,6 +176,8 @@
161176
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
162177
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
163178
94EE308912A9FD340098AA08 /* PrivacyInfo.xcprivacy in Resources */,
179+
98F6E17588234B2CA2A4AE98 /* Tourney.ttf in Resources */,
180+
B5298A4D660D4F30A37B2814 /* ChivoMono.ttf in Resources */,
164181
);
165182
runOnlyForDeploymentPostprocessing = 0;
166183
};

example/ios/NitroTextExample/Info.plist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<true/>
3333
</dict>
3434
<key>NSLocationWhenInUseUsageDescription</key>
35-
<string></string>
35+
<string/>
3636
<key>RCTNewArchEnabled</key>
3737
<true/>
3838
<key>UILaunchStoryboardName</key>
@@ -49,5 +49,10 @@
4949
</array>
5050
<key>UIViewControllerBasedStatusBarAppearance</key>
5151
<false/>
52+
<key>UIAppFonts</key>
53+
<array>
54+
<string>Tourney.ttf</string>
55+
<string>ChivoMono.ttf</string>
56+
</array>
5257
</dict>
5358
</plist>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"migIndex": 1,
3+
"data": [
4+
{
5+
"path": "assets/fonts/ChivoMono.ttf",
6+
"sha1": "fe260b56219f603a8aaf7fba5cfd2c898bf2bca0"
7+
},
8+
{
9+
"path": "assets/fonts/Tourney.ttf",
10+
"sha1": "1c7f16792740c9c6398692ea2149c5c3a6aaf6e5"
11+
}
12+
]
13+
}

example/react-native.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ module.exports = {
1515
root: path.join(__dirname, '..'),
1616
},
1717
},
18+
assets: ['./assets/fonts'],
1819
}

0 commit comments

Comments
 (0)