@expo-oh/expo-font 0.0.0-stage → 14.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +465 -0
  3. package/LICENSE +21 -0
  4. package/README.md +88 -2
  5. package/android/build.gradle +19 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/java/expo/modules/font/FontLoaderModule.kt +77 -0
  8. package/android/src/main/java/expo/modules/font/FontUtilsModule.kt +82 -0
  9. package/android/src/main/java/expo/modules/font/FontUtilsRecords.kt +16 -0
  10. package/app.plugin.js +1 -0
  11. package/build/ExpoFontLoader.d.ts +13 -0
  12. package/build/ExpoFontLoader.d.ts.map +1 -0
  13. package/build/ExpoFontLoader.js +14 -0
  14. package/build/ExpoFontLoader.js.map +1 -0
  15. package/build/ExpoFontLoader.web.d.ts +7 -0
  16. package/build/ExpoFontLoader.web.d.ts.map +1 -0
  17. package/build/ExpoFontLoader.web.js +203 -0
  18. package/build/ExpoFontLoader.web.js.map +1 -0
  19. package/build/ExpoFontUtils.d.ts +3 -0
  20. package/build/ExpoFontUtils.d.ts.map +1 -0
  21. package/build/ExpoFontUtils.js +3 -0
  22. package/build/ExpoFontUtils.js.map +1 -0
  23. package/build/ExpoFontUtils.web.d.ts +8 -0
  24. package/build/ExpoFontUtils.web.d.ts.map +1 -0
  25. package/build/ExpoFontUtils.web.js +8 -0
  26. package/build/ExpoFontUtils.web.js.map +1 -0
  27. package/build/Font.d.ts +54 -0
  28. package/build/Font.d.ts.map +1 -0
  29. package/build/Font.js +168 -0
  30. package/build/Font.js.map +1 -0
  31. package/build/Font.types.d.ts +66 -0
  32. package/build/Font.types.d.ts.map +1 -0
  33. package/build/Font.types.js +44 -0
  34. package/build/Font.types.js.map +1 -0
  35. package/build/FontHooks.d.ts +24 -0
  36. package/build/FontHooks.d.ts.map +1 -0
  37. package/build/FontHooks.js +63 -0
  38. package/build/FontHooks.js.map +1 -0
  39. package/build/FontLoader.d.ts +5 -0
  40. package/build/FontLoader.d.ts.map +1 -0
  41. package/build/FontLoader.js +30 -0
  42. package/build/FontLoader.js.map +1 -0
  43. package/build/FontLoader.web.d.ts +5 -0
  44. package/build/FontLoader.web.d.ts.map +1 -0
  45. package/build/FontLoader.web.js +56 -0
  46. package/build/FontLoader.web.js.map +1 -0
  47. package/build/FontUtils.d.ts +12 -0
  48. package/build/FontUtils.d.ts.map +1 -0
  49. package/build/FontUtils.js +21 -0
  50. package/build/FontUtils.js.map +1 -0
  51. package/build/FontUtils.types.d.ts +36 -0
  52. package/build/FontUtils.types.d.ts.map +1 -0
  53. package/build/FontUtils.types.js +2 -0
  54. package/build/FontUtils.types.js.map +1 -0
  55. package/build/index.d.ts +4 -0
  56. package/build/index.d.ts.map +1 -0
  57. package/build/index.js +4 -0
  58. package/build/index.js.map +1 -0
  59. package/build/index.server.d.ts +3 -0
  60. package/build/index.server.d.ts.map +1 -0
  61. package/build/index.server.js +5 -0
  62. package/build/index.server.js.map +1 -0
  63. package/build/memory.d.ts +9 -0
  64. package/build/memory.d.ts.map +1 -0
  65. package/build/memory.js +35 -0
  66. package/build/memory.js.map +1 -0
  67. package/build/server.d.ts +13 -0
  68. package/build/server.d.ts.map +1 -0
  69. package/build/server.js +32 -0
  70. package/build/server.js.map +1 -0
  71. package/expo-module.config.json +23 -0
  72. package/harmony/README.md +22 -0
  73. package/harmony/index.ets +1 -0
  74. package/harmony/src/main/cpp/CMakeLists.txt +8 -0
  75. package/harmony/src/main/cpp/ExpoFontLoaderPackage.h +19 -0
  76. package/harmony/src/main/cpp/ExpoFontLoaderTurboModule.cpp +10 -0
  77. package/harmony/src/main/cpp/ExpoFontLoaderTurboModule.h +8 -0
  78. package/harmony/src/main/ets/ExpoFontLoaderPackage.ets +12 -0
  79. package/harmony/src/main/ets/ExpoFontLoaderTurboModule.ets +56 -0
  80. package/harmony/src/main/ets/FontFile.ts +60 -0
  81. package/harmony/tests/font-file.test.mjs +40 -0
  82. package/harmony/tests/font-lifecycle.test.cjs +81 -0
  83. package/harmony/tests/rnoh/CMakeLists.txt +14 -0
  84. package/harmony/tests/rnoh/PackageCompileTest.cpp +9 -0
  85. package/harmony-upstream.json +7 -0
  86. package/ios/ExpoFont.podspec +30 -0
  87. package/ios/FontExceptions.swift +50 -0
  88. package/ios/FontFamilyAliasManager.swift +72 -0
  89. package/ios/FontLoaderModule.swift +48 -0
  90. package/ios/FontUtils.swift +90 -0
  91. package/ios/FontUtilsModule.swift +52 -0
  92. package/ios/FontUtilsRecords.swift +10 -0
  93. package/ios/UIFont+FontFamilyAlias.swift +29 -0
  94. package/jest-rsc.config.js +1 -0
  95. package/mocks/ExpoFontLoader.ts +25 -0
  96. package/mocks/ExpoFontUtils.ts +8 -0
  97. package/package.json +63 -4
  98. package/plugin/build/utils.d.ts +2 -0
  99. package/plugin/build/utils.js +34 -0
  100. package/plugin/build/withFonts.d.ts +21 -0
  101. package/plugin/build/withFonts.js +21 -0
  102. package/plugin/build/withFontsAndroid.d.ts +24 -0
  103. package/plugin/build/withFontsAndroid.js +129 -0
  104. package/plugin/build/withFontsIos.d.ts +2 -0
  105. package/plugin/build/withFontsIos.js +54 -0
  106. package/plugin/src/utils.ts +34 -0
  107. package/plugin/src/withFonts.ts +49 -0
  108. package/plugin/src/withFontsAndroid.ts +179 -0
  109. package/plugin/src/withFontsIos.ts +63 -0
  110. package/plugin/tsconfig.json +9 -0
  111. package/src/ExpoFontLoader.ts +28 -0
  112. package/src/ExpoFontLoader.web.ts +259 -0
  113. package/src/ExpoFontUtils.ts +3 -0
  114. package/src/ExpoFontUtils.web.ts +11 -0
  115. package/src/Font.ts +226 -0
  116. package/src/Font.types.ts +73 -0
  117. package/src/FontHooks.ts +73 -0
  118. package/src/FontLoader.ts +40 -0
  119. package/src/FontLoader.web.ts +65 -0
  120. package/src/FontUtils.ts +29 -0
  121. package/src/FontUtils.types.ts +39 -0
  122. package/src/index.server.ts +5 -0
  123. package/src/index.ts +3 -0
  124. package/src/memory.ts +42 -0
  125. package/src/server.ts +40 -0
  126. package/src/ts-declarations/react-native-assets.d.ts +1 -0
  127. package/tsconfig.json +9 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,2 @@
1
+ // @generated by expo-module-scripts
2
+ module.exports = require('expo-module-scripts/eslintrc.base.js');
package/CHANGELOG.md ADDED
@@ -0,0 +1,465 @@
1
+ # Changelog
2
+
3
+ ## Unpublished
4
+
5
+ ### 🛠 Breaking changes
6
+
7
+ ### 🎉 New features
8
+
9
+ ### 🐛 Bug fixes
10
+
11
+ ### 💡 Others
12
+
13
+ ## 14.0.12 — 2026-05-28
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Sanitize values in web font loader and Android config plugin ([#45887](https://github.com/expo/expo/pull/45887) by [@kitten](https://github.com/kitten))
18
+
19
+ ## 14.0.11 — 2026-01-20
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
23
+ ## 14.0.10 — 2025-12-05
24
+
25
+ _This version does not introduce any user-facing changes._
26
+
27
+ ## 14.0.9 — 2025-10-09
28
+
29
+ ### 🐛 Bug fixes
30
+
31
+ - fix android image scaling in `renderToImageAsync` ([#40113](https://github.com/expo/expo/pull/40113) by [@vonovak](https://github.com/vonovak))
32
+
33
+ ## 14.0.8 — 2025-09-11
34
+
35
+ _This version does not introduce any user-facing changes._
36
+
37
+ ## 14.0.7 — 2025-09-02
38
+
39
+ _This version does not introduce any user-facing changes._
40
+
41
+ ## 14.0.6 — 2025-08-31
42
+
43
+ _This version does not introduce any user-facing changes._
44
+
45
+ ## 14.0.5 — 2025-08-27
46
+
47
+ ### 🛠 Breaking changes
48
+
49
+ - [android] improve bitmap rendering for `renderToImageAsync` ([#39118](https://github.com/expo/expo/pull/39118) by [@vonovak](https://github.com/vonovak))
50
+
51
+ ## 14.0.4 — 2025-08-26
52
+
53
+ ### 💡 Others
54
+
55
+ - Fix types and adjust platform checks. ([#37302](https://github.com/expo/expo/pull/37302) by [@EvanBacon](https://github.com/EvanBacon))
56
+
57
+ ## 14.0.3 — 2025-08-25
58
+
59
+ _This version does not introduce any user-facing changes._
60
+
61
+ ## 14.0.2 — 2025-08-16
62
+
63
+ _This version does not introduce any user-facing changes._
64
+
65
+ ## 14.0.1 — 2025-08-15
66
+
67
+ _This version does not introduce any user-facing changes._
68
+
69
+ ## 14.0.0 — 2025-08-13
70
+
71
+ ### 🎉 New features
72
+
73
+ - expose `ExpoFontLoader` on web ([#37991](https://github.com/expo/expo/pull/37991) by [@vonovak](https://github.com/vonovak))
74
+ - Add local package mocks. ([#37736](https://github.com/expo/expo/pull/37736) by [@aleqsio](https://github.com/aleqsio))
75
+
76
+ ### 💡 Others
77
+
78
+ - [web] remove deprecated style 'type' attribute ([#38114](https://github.com/expo/expo/pull/38114) by [@vonovak](https://github.com/vonovak))
79
+ - Add missing `react-native` peer dependency ([#38540](https://github.com/expo/expo/pull/38540) by [@kitten](https://github.com/kitten))
80
+ - Update remaining `@expo/config-plugins` in config plugin to `expo/config-plugins` ([#38580](https://github.com/expo/expo/pull/38580) by [@kitten](https://github.com/kitten))
81
+
82
+ ## 13.3.2 - 2025-07-01
83
+
84
+ _This version does not introduce any user-facing changes._
85
+
86
+ ## 13.3.1 — 2025-05-02
87
+
88
+ ### 🐛 Bug fixes
89
+
90
+ - Bail out early when `getLoadedFonts` returns an empty array. ([#36586](https://github.com/expo/expo/pull/36586) by [@brentvatne](https://github.com/brentvatne))
91
+
92
+ ## 13.3.0 — 2025-04-30
93
+
94
+ ### 🎉 New features
95
+
96
+ - [Android] Added support for font weight styles (through XML font definitions) to config plugin. ([#26082](https://github.com/expo/expo/pull/26082) by [@jongbelegen](https://github.com/jongbelegen))
97
+
98
+ ## 13.2.2 — 2025-04-25
99
+
100
+ _This version does not introduce any user-facing changes._
101
+
102
+ ## 13.2.1 — 2025-04-21
103
+
104
+ _This version does not introduce any user-facing changes._
105
+
106
+ ## 13.2.0 — 2025-04-21
107
+
108
+ ### 🎉 New features
109
+
110
+ - Render to image ([#36185](https://github.com/expo/expo/pull/36185) by [@jakex7](https://github.com/jakex7))
111
+
112
+ ## 13.1.2 — 2025-04-14
113
+
114
+ _This version does not introduce any user-facing changes._
115
+
116
+ ## 13.1.1 — 2025-04-09
117
+
118
+ _This version does not introduce any user-facing changes._
119
+
120
+ ## 13.1.0 — 2025-04-04
121
+
122
+ ### 🛠 Breaking changes
123
+
124
+ - Bump minimum macOS version to 11.0. ([#34980](https://github.com/expo/expo/pull/34980) by [@gabrieldonadel](https://github.com/gabrieldonadel))
125
+
126
+ ### 🎉 New features
127
+
128
+ - Support loading expo-font in a `react-server` environment. ([#34736](https://github.com/expo/expo/pull/34736) by [@EvanBacon](https://github.com/EvanBacon))
129
+
130
+ ### 🐛 Bug fixes
131
+
132
+ - Add missing export specifier. ([#34839](https://github.com/expo/expo/pull/34839) by [@EvanBacon](https://github.com/EvanBacon))
133
+
134
+ ### 💡 Others
135
+
136
+ - [Android] Started using expo modules gradle plugin. ([#34176](https://github.com/expo/expo/pull/34176) by [@lukmccall](https://github.com/lukmccall))
137
+
138
+ ## 13.0.4 - 2025-02-19
139
+
140
+ _This version does not introduce any user-facing changes._
141
+
142
+ ## 13.0.3 - 2025-01-10
143
+
144
+ ### 🐛 Bug fixes
145
+
146
+ - [ios] Fix crash when writing to fontFamilyAliases ([#34044](https://github.com/expo/expo/pull/34044) by [@techied](https://github.com/techied))
147
+
148
+ ## 13.0.2 - 2024-12-19
149
+
150
+ ### 🐛 Bug fixes
151
+
152
+ - [iOS] Fix crash when accessing resource from multiple threads ([#33574](https://github.com/expo/expo/pull/33574) by [@chrfalch](https://github.com/chrfalch))
153
+
154
+ ## 13.0.1 — 2024-11-05
155
+
156
+ ### 💡 Others
157
+
158
+ - Remove deprecated Font.processFontFamily() ([#32631](https://github.com/expo/expo/pull/32631) by [@brentvatne](https://github.com/brentvatne))
159
+
160
+ ## 13.0.0 — 2024-10-22
161
+
162
+ ### 🛠 Breaking changes
163
+
164
+ - Bumped iOS and tvOS deployment target to 15.1. ([#30840](https://github.com/expo/expo/pull/30840) by [@tsapeta](https://github.com/tsapeta))
165
+
166
+ ### 🎉 New features
167
+
168
+ - More detailed error messages for `FontLoader` native module rejections ([#31104](https://github.com/expo/expo/pull/31104) by [@vonovak](https://github.com/vonovak))
169
+ - Add `getLoadedFonts()` function ([#30431](https://github.com/expo/expo/pull/30431) by [@vonovak](https://github.com/vonovak))
170
+
171
+ ### 🐛 Bug fixes
172
+
173
+ - `useFonts` could previously attempt to set state on an unmounted component ([#31143](https://github.com/expo/expo/pull/31143) by [@vonovak](https://github.com/vonovak))
174
+ - On iOS `loadAsync()` will reject if font loading fails. ([#31053](https://github.com/expo/expo/pull/31053) by [@vonovak](https://github.com/vonovak))
175
+ - Add missing `react` peer dependencies for isolated modules. ([#30467](https://github.com/expo/expo/pull/30467) by [@byCedric](https://github.com/byCedric))
176
+ - Only import from `expo/config` to follow proper dependency chains. ([#30501](https://github.com/expo/expo/pull/30501) by [@byCedric](https://github.com/byCedric))
177
+
178
+ ### 💡 Others
179
+
180
+ - Stopped scoping font family names in Expo Go on Android. ([#28797](https://github.com/expo/expo/pull/28797) by [@lukmccall](https://github.com/lukmccall))
181
+ - Replaced `@testing-library/react-hooks` with `@testing-library/react-native`. ([#30742](https://github.com/expo/expo/pull/30742) by [@byCedric](https://github.com/byCedric))
182
+ - Removed all `NativeModulesProxy` occurrences. ([#31496](https://github.com/expo/expo/pull/31496) by [@reichhartd](https://github.com/reichhartd))
183
+
184
+ ## 12.0.10 - 2024-09-03
185
+
186
+ ### 🐛 Bug fixes
187
+
188
+ - Fix support for macOS. ([#31307](https://github.com/expo/expo/pull/31307) by [@gabrieldonadel](https://github.com/gabrieldonadel))
189
+
190
+ ## 12.0.9 - 2024-07-16
191
+
192
+ ### 🐛 Bug fixes
193
+
194
+ - On `iOS`, fix issues where fonts were removed when the app is backgrounded. ([#30400](https://github.com/expo/expo/pull/30400) by [@alanjhughes](https://github.com/alanjhughes))
195
+
196
+ ## 12.0.8 - 2024-07-11
197
+
198
+ ### 🎉 New features
199
+
200
+ - Allow `woff` and `woff2` format on iOS with the config plugin. ([#30220](https://github.com/expo/expo/pull/30220) by [@titozzz](https://github/Titozzz))
201
+
202
+ ## 12.0.7 - 2024-06-06
203
+
204
+ ### 🐛 Bug fixes
205
+
206
+ - On `iOS`, store the font `postscriptName` instead of `fullName` which is what `iOS` will use to register the font. ([#29502](https://github.com/expo/expo/pull/29502) by [@alanjhughes](https://github.com/alanjhughes))
207
+
208
+ ## 12.0.6 - 2024-05-29
209
+
210
+ ### 🐛 Bug fixes
211
+
212
+ - [iOS] Fix font registration failing when font was in use. ([#28989](https://github.com/expo/expo/pull/28989) by [@aleqsio](https://github.com/aleqsio))
213
+
214
+ ## 12.0.5 — 2024-05-10
215
+
216
+ ### 🐛 Bug fixes
217
+
218
+ - Fixed some vector icons not rendering correctly. ([#28747](https://github.com/expo/expo/pull/28747) by [@tsapeta](https://github.com/tsapeta))
219
+
220
+ ## 12.0.4 — 2024-04-24
221
+
222
+ _This version does not introduce any user-facing changes._
223
+
224
+ ## 12.0.3 — 2024-04-24
225
+
226
+ - Fix font name lookup when name is not the same as family. ([#28407](https://github.com/expo/expo/pull/28407) by [@brentvatne](https://github.com/brentvatne))
227
+
228
+ ## 12.0.2 — 2024-04-23
229
+
230
+ _This version does not introduce any user-facing changes._
231
+
232
+ ## 12.0.1 — 2024-04-22
233
+
234
+ ### 💡 Others
235
+
236
+ - Stopped scoping font family names in Expo Go on iOS. ([#28344](https://github.com/expo/expo/pull/28344) by [@tsapeta](https://github.com/tsapeta))
237
+
238
+ ## 12.0.0 — 2024-04-18
239
+
240
+ ### 🎉 New features
241
+
242
+ - [iOS] The native module has been simplified and rewritten to Swift. ([#26380](https://github.com/expo/expo/pull/26380) by [@tsapeta](https://github.com/tsapeta))
243
+
244
+ ### 💡 Others
245
+
246
+ - drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
247
+ - Remove most of Constants.appOwnership. ([#26313](https://github.com/expo/expo/pull/26313) by [@wschurman](https://github.com/wschurman))
248
+ - Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
249
+
250
+ ## 11.10.3 - 2024-02-16
251
+
252
+ ### 🐛 Bug fixes
253
+
254
+ - Only include supported font files when using the plugin. ([#27002](https://github.com/expo/expo/pull/27002) by [@alanjhughes](https://github.com/alanjhughes))
255
+
256
+ ## 11.10.2 - 2024-01-18
257
+
258
+ _This version does not introduce any user-facing changes._
259
+
260
+ ## 11.10.1 - 2024-01-10
261
+
262
+ ### 🎉 New features
263
+
264
+ - Added support for macOS platform. ([#26242](https://github.com/expo/expo/pull/26242) by [@tsapeta](https://github.com/tsapeta))
265
+
266
+ ## 11.10.0 — 2023-12-12
267
+
268
+ ### 🎉 New features
269
+
270
+ - Added custom native fonts support to `Font.isLoaded()`. ([#25770](https://github.com/expo/expo/pull/25770) by [@kudo](https://github.com/kudo))
271
+
272
+ ## 11.9.0 — 2023-11-14
273
+
274
+ ### 🛠 Breaking changes
275
+
276
+ - Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
277
+ - On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
278
+
279
+ ### 🐛 Bug fixes
280
+
281
+ - Handle the case where no argument is passed to the plugin. ([#25138](https://github.com/expo/expo/pull/25138) by [@alanjhughes](https://github.com/alanjhughes))
282
+
283
+ ## 11.8.0 — 2023-10-17
284
+
285
+ ### 🛠 Breaking changes
286
+
287
+ - Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
288
+
289
+ ### 🎉 New features
290
+
291
+ - Added config plugin to allow fonts to be linked at build time. ([#24772](https://github.com/expo/expo/pull/24772) by [@alanjhughes](https://github.com/alanjhughes))
292
+ - Remove `unimodule.json` in favour of `expo-module.config.json`. ([#25099](https://github.com/expo/expo/pull/25099) by [@reichhartd](https://github.com/reichhartd))
293
+
294
+ ## 11.7.0 — 2023-09-15
295
+
296
+ ### 🎉 New features
297
+
298
+ - Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
299
+
300
+ ### 💡 Others
301
+
302
+ - Updated types for server functions. ([#23911](https://github.com/expo/expo/pull/23911) by [@EvanBacon](https://github.com/EvanBacon))
303
+
304
+ ## 11.6.0 — 2023-09-04
305
+
306
+ ### 🎉 New features
307
+
308
+ - Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
309
+ - Add static font extraction support with `expo-router`. ([#24027](https://github.com/expo/expo/pull/24027) by [@EvanBacon](https://github.com/EvanBacon))
310
+
311
+ ### 💡 Others
312
+
313
+ - Migrated `FontLoaderModule` to use Expo Modules API. ([#24015](https://github.com/expo/expo/pull/24015) by [@lukmccall](https://github.com/lukmccall))
314
+
315
+ ## 11.5.1 — 2023-08-02
316
+
317
+ ### 💡 Others
318
+
319
+ - Change unloaded font error to a warning. ([#23788](https://github.com/expo/expo/pull/23788) by [@EvanBacon](https://github.com/EvanBacon))
320
+
321
+ ## 11.5.0 — 2023-07-28
322
+
323
+ ### 🐛 Bug fixes
324
+
325
+ - Gracefully catch exceptions during font loading on web with `fontfaceobserver`. ([#22954](https://github.com/expo/expo/pull/22954) by [@bradjones1](https://github.com/bradjones1))
326
+
327
+ ## 11.4.0 — 2023-06-21
328
+
329
+ _This version does not introduce any user-facing changes._
330
+
331
+ ## 11.3.0 — 2023-06-13
332
+
333
+ ### 🐛 Bug fixes
334
+
335
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
336
+
337
+ ## 11.2.0 — 2023-05-08
338
+
339
+ ### 🐛 Bug fixes
340
+
341
+ - Fix require cycle on web. ([#21593](https://github.com/expo/expo/pull/21593) by [@EvanBacon](https://github.com/EvanBacon))
342
+
343
+ ## 11.1.1 — 2023-02-09
344
+
345
+ _This version does not introduce any user-facing changes._
346
+
347
+ ## 11.1.0 — 2023-02-03
348
+
349
+ ### 💡 Others
350
+
351
+ - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
352
+
353
+ ## 11.0.1 — 2022-10-28
354
+
355
+ _This version does not introduce any user-facing changes._
356
+
357
+ ## 11.0.0 — 2022-10-06
358
+
359
+ ### 🛠 Breaking changes
360
+
361
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
362
+
363
+ ### 🎉 New features
364
+
365
+ - Added support for Metro web. ([#19234](https://github.com/expo/expo/pull/19234) by [@EvanBacon](https://github.com/EvanBacon))
366
+
367
+ ## 10.2.0 — 2022-07-07
368
+
369
+ _This version does not introduce any user-facing changes._
370
+
371
+ ## 10.1.0 — 2022-04-18
372
+
373
+ ### ⚠️ Notices
374
+
375
+ - On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
376
+
377
+ ## 10.0.5 - 2022-02-01
378
+
379
+ ### 🐛 Bug fixes
380
+
381
+ - Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
382
+
383
+ ## 10.0.4 — 2021-11-17
384
+
385
+ _This version does not introduce any user-facing changes._
386
+
387
+ ## 10.0.1 — 2021-10-01
388
+
389
+ _This version does not introduce any user-facing changes._
390
+
391
+ ## 10.0.0 — 2021-09-28
392
+
393
+ ### 🛠 Breaking changes
394
+
395
+ - Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
396
+
397
+ ### 🐛 Bug fixes
398
+
399
+ - Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
400
+
401
+ ## 9.3.0 — 2021-09-08
402
+
403
+ ### 💡 Others
404
+
405
+ - Rewrite android code to Kotlin ([#13956](https://github.com/expo/expo/pull/13956) by [@kkafar](https://github.com/kkafar))
406
+
407
+ ## 9.2.0 — 2021-06-16
408
+
409
+ ### 🐛 Bug fixes
410
+
411
+ - Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
412
+
413
+ ### 💡 Others
414
+
415
+ - Migrated `unimodules-font-interface` and `unimodules-constants-interface` to `expo-modules-core`. ([#12949](https://github.com/expo/expo/pull/12949), [#12876](https://github.com/expo/expo/pull/12876) by [@tsapeta](https://github.com/tsapeta))
416
+ - Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo))
417
+
418
+ ## 9.1.0 — 2021-03-10
419
+
420
+ ### 🎉 New features
421
+
422
+ - Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
423
+
424
+ ### 🐛 Bug fixes
425
+
426
+ - Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
427
+
428
+ ## 9.0.0 — 2021-01-15
429
+
430
+ ### 🛠 Breaking changes
431
+
432
+ - Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta))
433
+
434
+ ### 🐛 Bug fixes
435
+
436
+ - Remove Expo.AppLoading reference in error. ([#11204](https://github.com/expo/expo/pull/11204) by [@brentvatne](https://github.com/brentvatne))
437
+ - Removed `fbjs` dependency ([#11396](https://github.com/expo/expo/pull/11396) by [@cruzach](https://github.com/cruzach))
438
+
439
+ ## 8.4.0 — 2020-11-17
440
+
441
+ _This version does not introduce any user-facing changes._
442
+
443
+ ## 8.3.0 — 2020-08-18
444
+
445
+ _This version does not introduce any user-facing changes._
446
+
447
+ ## 8.2.2 — 2020-07-27
448
+
449
+ ### 🐛 Bug fixes
450
+
451
+ - Fixed fonts not being loaded in Internet Explorer. ([#8652](https://github.com/expo/expo/pull/8652) by [@d4rky-pl](https://github.com/d4rky-pl))
452
+
453
+ ## 8.2.1 — 2020-05-29
454
+
455
+ _This version does not introduce any user-facing changes._
456
+
457
+ ## 8.2.0 — 2020-05-27
458
+
459
+ _This version does not introduce any user-facing changes._
460
+
461
+ ## 8.1.1 - 4/07/2020
462
+
463
+ ### 🐛 Bug fixes
464
+
465
+ - Fixed timeout on Firefox [#7420](https://github.com/expo/expo/pull/7420)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,89 @@
1
- # Temporary Holding Version
1
+ # @expo-oh/expo-font
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Expo Font 的 HarmonyOS 适配版本,通过 RNOH 字体注册接口加载字体,并用于 React Native 文本渲染。
4
+
5
+ 上游基线:`expo-font@14.0.12`。本包由 [expo-harmony-cli](https://github.com/stonehill-2345/expo-harmony-cli) 项目维护,非 Expo 官方发行版本。
6
+
7
+ [鸿蒙快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md) · [适配源码](https://github.com/stonehill-2345/expo-harmony-cli/tree/main/packages/expo-font) · [验收记录](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/releases/2026-10-09-sdk54-expo-oh-candidate.md) · [问题反馈](https://github.com/stonehill-2345/expo-harmony-cli/issues)
8
+
9
+ ## 安装
10
+
11
+ 以下命令适用于已经配置好 `@expo-oh` SDK54 依赖组合的项目。普通 Expo 项目请先阅读[鸿蒙快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md);仅安装此包不会自动完成 RNOH 和原生工程配置。
12
+
13
+ ```bash
14
+ # npm
15
+ npm install --save-exact expo-font@npm:@expo-oh/expo-font@14.0.13
16
+
17
+ # pnpm
18
+ pnpm add --save-exact expo-font@npm:@expo-oh/expo-font@14.0.13
19
+ ```
20
+
21
+ 保留原依赖键:
22
+
23
+ ```json
24
+ {
25
+ "dependencies": {
26
+ "expo-font": "npm:@expo-oh/expo-font@14.0.13"
27
+ }
28
+ }
29
+ ```
30
+
31
+ 本包的鸿蒙适配已包含在 npm 产物中,无需额外应用本包的本地 patch。使用完整依赖组合及 overrides,保留锁文件;不要混装另一组 SDK 版本。
32
+
33
+ ## 使用方式
34
+
35
+ 将有效 TTF 字体放入 `assets/fonts/Example.ttf`:
36
+
37
+ ```tsx
38
+ import { useFonts } from "expo-font";
39
+ import { Text } from "react-native";
40
+
41
+ export default function App() {
42
+ const [loaded, error] = useFonts({
43
+ Example: require("./assets/fonts/Example.ttf"),
44
+ });
45
+ if (error) return <Text>{error.message}</Text>;
46
+ if (!loaded) return null;
47
+ return <Text style={{ fontFamily: "Example" }}>鸿蒙字体示例</Text>;
48
+ }
49
+ ```
50
+
51
+ 也可使用 `loadAsync`。资源先由 Asset 解析为本地文件,再交给原生字体加载器。
52
+
53
+ ## 鸿蒙支持范围
54
+
55
+ | 能力 | HarmonyOS 实现与限制 |
56
+ | --- | --- |
57
+ | 运行时字体加载 | 校验非空本地 file:// 文件、TTF/OTF 头和表目录后注册字体 |
58
+ | getLoadedFonts / isLoaded | 成功注册后才能报告加载完成 |
59
+ | 字体集合 TTC | 当前不支持 ttcf 字体集合 |
60
+ | renderToImageAsync | 当前 Harmony 后端未实现 |
61
+ | Web 卸载接口 | 不作为 Harmony 能力提供 |
62
+ | 静态字体插件 | 本文示例采用运行时加载,不承诺上游 config plugin 的字体嵌入流程在鸿蒙等价可用 |
63
+
64
+ ## 生成和运行原生工程
65
+
66
+ 从已配置项目根目录执行:
67
+
68
+ ```bash
69
+ npx expo prebuild --platform harmony
70
+ npx expo run:harmony
71
+ ```
72
+
73
+ 日常开发启动 Metro:`npx expo start`。安装或更新原生依赖、应用配置后,需要重新生成并构建;重启 Metro 不能替代原生构建。
74
+
75
+ 兼容基线为 Expo SDK54、React 19.1.1、React Native 0.82.1、RNOH 0.82.30。设备、DevEco、签名要求见[快速开始](https://github.com/stonehill-2345/expo-harmony-cli/blob/main/docs/harmony/getting-started.md)。普通 Expo Go 不能作为本组合的鸿蒙运行容器。
76
+
77
+ ## 排查与反馈
78
+
79
+ - 安装后版本或功能不符:检查 package.json alias、overrides 和锁文件,使用 `npx expo install --check` 核对受管组合。
80
+ - 原生模块缺失或更新无效:确认使用同组合的 Core/Autolinking,重新 prebuild、构建并安装。
81
+ - 旧 patch 项目不会自动迁移;保留原项目,按指南新建项目后迁移业务代码,不叠加旧补丁。
82
+
83
+ 请在[本仓库 Issues](https://github.com/stonehill-2345/expo-harmony-cli/issues) 提供包版本、RNOH/系统版本、设备类型、最小复现及日志。已记录的模板运行结果不代表全部 API 或所有设备均已验证。
84
+
85
+ ## 上游与许可证
86
+
87
+ - [上游参考](https://docs.expo.dev/versions/v54.0.0/sdk/font/):用于通用 API 或原始包说明;HarmonyOS 支持以本文为准。
88
+ - 原始来源:[Expo 源码](https://github.com/expo/expo/tree/main/packages/expo-font)。
89
+ - 保留上游许可证和来源声明,详见包内 `LICENSE`。遵循 Expo 上游 MIT 许可证。
@@ -0,0 +1,19 @@
1
+ plugins {
2
+ id 'com.android.library'
3
+ id 'expo-module-gradle-plugin'
4
+ }
5
+
6
+ group = 'host.exp.exponent'
7
+ version = '14.0.12'
8
+
9
+ android {
10
+ namespace "expo.modules.font"
11
+ defaultConfig {
12
+ versionCode 29
13
+ versionName "14.0.12"
14
+ }
15
+ }
16
+
17
+ dependencies {
18
+ implementation 'com.facebook.react:react-android'
19
+ }
@@ -0,0 +1,3 @@
1
+ <manifest>
2
+
3
+ </manifest>
@@ -0,0 +1,77 @@
1
+ // Copyright 2015-present 650 Industries. All rights reserved.
2
+
3
+ package expo.modules.font
4
+
5
+ import android.content.Context
6
+ import android.graphics.Typeface
7
+ import android.net.Uri
8
+ import com.facebook.react.common.assets.ReactFontManager
9
+ import expo.modules.kotlin.exception.CodedException
10
+ import expo.modules.kotlin.exception.Exceptions
11
+ import expo.modules.kotlin.modules.Module
12
+ import expo.modules.kotlin.modules.ModuleDefinition
13
+ import java.io.File
14
+
15
+ private const val ASSET_SCHEME = "asset://"
16
+
17
+ private class FileNotFoundException(uri: String) :
18
+ CodedException("File '$uri' doesn't exist")
19
+
20
+ open class FontLoaderModule : Module() {
21
+ private val context: Context
22
+ get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
23
+
24
+ override fun definition() = ModuleDefinition {
25
+ // could be a Set, but to be able to pass to JS we keep it as an array
26
+ var loadedFonts: List<String> = queryCustomNativeFonts()
27
+
28
+ Name("ExpoFontLoader")
29
+
30
+ Function("getLoadedFonts") {
31
+ return@Function loadedFonts
32
+ }
33
+
34
+ AsyncFunction("loadAsync") { fontFamilyName: String, localUri: String ->
35
+ val context = appContext.reactContext ?: throw Exceptions.ReactContextLost()
36
+
37
+ // TODO(nikki): make sure path is in experience's scope
38
+ val typeface: Typeface = if (localUri.startsWith(ASSET_SCHEME)) {
39
+ Typeface.createFromAsset(
40
+ context.assets, // Also remove the leading slash.
41
+ localUri.substring(ASSET_SCHEME.length + 1)
42
+ )
43
+ } else {
44
+ val file = Uri.parse(localUri).path?.let { File(it) }
45
+ ?: throw FileNotFoundException(localUri)
46
+
47
+ if (file.length() == 0L) {
48
+ throw CodedException(
49
+ "Font file for $fontFamilyName is empty. Make sure the local file path is correctly populated."
50
+ )
51
+ }
52
+
53
+ Typeface.createFromFile(file)
54
+ }
55
+
56
+ ReactFontManager.getInstance().setTypeface(fontFamilyName, Typeface.NORMAL, typeface)
57
+ loadedFonts = loadedFonts.toMutableSet().apply { add(fontFamilyName) }.toList()
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Queries custom native font names from the assets.
63
+ * Alignment with React Native's implementation at:
64
+ * https://github.com/facebook/react-native/blob/363ee484b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/assets/ReactFontManager.java#L146-L161
65
+ */
66
+ private fun queryCustomNativeFonts(): List<String> {
67
+ val assetManager = context.assets
68
+ val fontFileRegex = Regex("^(.+?)(_bold|_italic|_bold_italic)?\\.(ttf|otf)$")
69
+
70
+ return assetManager.list("fonts/")
71
+ ?.mapNotNull { fileName ->
72
+ fontFileRegex.find(fileName)?.groupValues?.get(1)
73
+ }
74
+ ?.filter { it.isNotBlank() }
75
+ .orEmpty()
76
+ }
77
+ }