5 Answer(s)
-
0
Hi @avanekar02
You can create a similar file to fonts-roboto.css (under wwwroot/fonts folder) and create a folder with font files similar to wwwroot/fonts/Robot.
-
0
Thanks, let us say i do add a mohareb folder with mohareb-1.ttk and a a font-mohareb.css for the same, how do i set it commonly across for all arabic page in mobile.shared app.
thanks Anwar
-
0
@avanekar02
I thought you were talking about Web App. You can check https://forums.xamarin.com/discussion/37410/how-to-set-font-family-to-whole-application for that.
-
0
i copied the font cairo under mobile.shared project in ui/assets folder then i added the font int app.xaml in the same project and reference it in label control
<!-- font families --> <OnPlatform x:Key="RegularFontFamily" x:TypeArguments="x:String"> <On Platform="iOS">HelveticaNeue</On> <On Platform="Android">/UI/Assets/Cairo-Black.ttf#Cairo-Black</On> <!--<On Platform="Android">sans-serif</On>--> </OnPlatform> <!-- STYLES --> <Style TargetType="Label" ApplyToDerivedTypes="True" CanCascade="True"> <Setter Property="FontFamily" Value="{StaticResource RegularFontFamily}" /> <Setter Property="FontSize" Value="{ StaticResource BaseFontSize }" /> <Setter Property="TextColor" Value="{ StaticResource LabelColor }" /> </Style>
but it does not show .
selected the cairo.ttf file and set the build mode as content, and always copy.
it throws error "Java.Lang.RuntimeException: native typeface cannot be made "
but i loaded the same font in paint or word it works fine so the .ttf file is not corrupt, also i tried various combinations of file name in lowercase,uppercase with spaces but does not work.
thanks Anwar
-
0
hi,
did you check this https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts#using-a-custom-font