File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
src/Uno.UI.Runtime.WebAssembly/Xaml/Media Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -155,9 +155,11 @@ public static void main(string[] orgs)
155
155
// You can add more than one, but preload too many fonts could hurt user experience.
156
156
// IMPORTANT: The string parameter should be exactly the same string (including casing)
157
157
// used as FontFamily in the application.
158
- Windows .UI .Xaml .Media .FontFamilyHelper .PreloadAsync (" ms-appx:///Assets/Fonts/yourfont01.ttf#ApplicationFont01" );
159
- Windows .UI .Xaml .Media .FontFamilyHelper .PreloadAsync (" https://fonts.cdnfonts.com/s/71084/antikythera.woff#Antikythera" );
160
- Windows .UI .Xaml .Media .FontFamilyHelper .PreloadAsync (" Roboto" );
158
+ Uno .UI .Xaml .Media .FontFamilyHelper .PreloadAsync (" ms-appx:///Assets/Fonts/yourfont01.ttf#ApplicationFont01" );
159
+ Uno .UI .Xaml .Media .FontFamilyHelper .PreloadAsync (" https://fonts.cdnfonts.com/s/71084/antikythera.woff#Antikythera" );
160
+
161
+ // Preloads a font which has been specified as a CSS font, either with a data uri or a remote resource.
162
+ Uno .UI .Xaml .Media .FontFamilyHelper .PreloadAsync (" Roboto" );
161
163
162
164
Windows .UI .Xaml .Application .Start (_ => _app = new App ());
163
165
```
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Text ;
4
+ using System . Threading . Tasks ;
5
+ using Windows . UI . Xaml . Media ;
6
+
7
+ namespace Uno . UI . Xaml . Media ;
8
+
9
+ /// <summary>
10
+ /// WebAssembly specific <see cref="FontFamily"/> helper
11
+ /// </summary>
12
+ public partial class FontFamilyHelper
13
+ {
14
+ /// <summary>
15
+ /// Pre-loads a font to minimize loading time and prevent potential text re-layouts.
16
+ /// </summary>
17
+ /// <returns>True is the font loaded successfuly, otherwise false.</returns>
18
+ public static Task < bool > PreloadAsync ( FontFamily family )
19
+ => FontFamily . PreloadAsync ( family ) ;
20
+
21
+ /// <summary>
22
+ /// Pre-loads a font to minimize loading time and prevent potential text re-layouts.
23
+ /// </summary>
24
+ /// <returns>True is the font loaded successfuly, otherwise false.</returns>
25
+ public static Task < bool > PreloadAsync ( string familyName )
26
+ => PreloadAsync ( new FontFamily ( familyName ) ) ;
27
+ }
You can’t perform that action at this time.
0 commit comments