I found the problem cause I put page inside folder, but why?
In you code, you are using following code to set FontFamily
:
FontFamily="Assets/fonts/NotoSansCJKtc-Thin.otf#Noto Sans CJK TC"
The URI you've used is a relative URI, It will access files relative to the current XAML page. In your case, while using this in BlankPage1, it will try to access Assets/fonts/NotoSansCJKtc-Thin.otf
file in current folder which is the "UI" folder. As there is no such file in "UI" folder, the FontFamily
property will use its default value.
To access files relative to the root of the package, from a XAML page, you can use an absolute path URIs (those that begin with a "/") like following:
<TextBlock Margin="0,80,0,0"
HorizontalAlignment="Center"
FontFamily="/Assets/fonts/NotoSansCJKtc-Thin.otf#Noto Sans CJK TC"
FontSize="80"
Foreground="#878787">
微abc012
</TextBlock>
Or using ms-appx:
scheme like following:
<TextBlock Margin="0,80,0,0"
HorizontalAlignment="Center"
FontFamily="ms-appx:///Assets/fonts/NotoSansCJKtc-Thin.otf#Noto Sans CJK TC"
FontSize="80"
Foreground="#878787">
微abc012
</TextBlock>
And FontFamily="Assets/fonts/NotoSansCJKtc-Thin.otf#Noto Sans CJK TC" can work, but FontFamily="Assets/fonts/NotoSansCJKtc-Thin.otf#Noto Sans CJK TC Thin" won't.
I have the same issue in my side. Form the otf file, its font name should be "Noto Sans CJK TC Thin".
However using this font name won't work both in XAML Designer and run-time. I think this issue may related to the otf file as I tested with some other fonts, they all worked as expected.
I also try to reference other project font resource in same solution.
To reference other project font resource in same solution, you can refer to my previous answer in UWP - Font only applied in Designer.