Apply font fix for button and span (#3907)

This commit is contained in:
Mohamed CHOUCHANE 2018-09-28 16:39:29 +00:00 коммит произвёл Shane Neuville
Родитель 34b129bc38
Коммит 0ad6302938
2 изменённых файлов: 67 добавлений и 3 удалений

Просмотреть файл

@ -86,6 +86,70 @@ namespace Xamarin.Forms.Controls.Issues
stack.Children.Add(issueTestLabel2);
stack.Children.Add(issueTestLabel3Description);
stack.Children.Add(issueTestLabel3);
Label issueTestSpan1Description = new Label
{
Text = "Span with font"
};
Label issueTestSpan1 = new Label()
{
HorizontalTextAlignment = TextAlignment.Center,
};
Span span = new Span()
{
TextColor = Color.Red,
FontSize = 40,
Text = "Hello, I'm in Pick Ax font"
};
switch (Device.RuntimePlatform)
{
case Device.WPF:
span.FontFamily = "/Assets/#Pick Ax";
break;
default:
break;
}
Span span1 = new Span()
{
TextColor = Color.Blue,
FontSize = 30,
Text = " - without font but blue"
};
issueTestSpan1.FormattedText = new FormattedString();
issueTestSpan1.FormattedText.Spans.Add(span);
issueTestSpan1.FormattedText.Spans.Add(span1);
stack.Children.Add(issueTestSpan1Description);
stack.Children.Add(issueTestSpan1);
Label issueTestButton1Description = new Label
{
Text = "Button with font"
};
Button issueTestButton1 = new Button
{
TextColor = Color.Red,
FontSize = 40,
Text = "Hello, I'm in Button - Pick Ax font"
};
switch (Device.RuntimePlatform)
{
case Device.WPF:
issueTestButton1.FontFamily = "/Assets/#Pick Ax";
break;
default:
break;
}
stack.Children.Add(issueTestButton1Description);
stack.Children.Add(issueTestButton1);
Content = stack;
}
}

Просмотреть файл

@ -18,7 +18,7 @@ namespace Xamarin.Forms.Platform.WPF
self.FontSize = font.UseNamedSize ? GetFontSize(font.NamedSize) : font.FontSize;
if (!string.IsNullOrEmpty(font.FontFamily))
self.FontFamily = new FontFamily(font.FontFamily);
self.FontFamily = new FontFamily(new Uri("pack://application:,,,/"), font.FontFamily);
else
self.FontFamily = (FontFamily)System.Windows.Application.Current.Resources["FontFamilySemiBold"];
@ -60,7 +60,7 @@ namespace Xamarin.Forms.Platform.WPF
self.FontSize = font.UseNamedSize ? GetFontSize(font.NamedSize) : font.FontSize;
if (!string.IsNullOrEmpty(font.FontFamily))
self.FontFamily = new FontFamily(font.FontFamily);
self.FontFamily = new FontFamily(new Uri("pack://application:,,,/"), font.FontFamily);
else
self.FontFamily = (FontFamily)System.Windows.Application.Current.Resources["FontFamilyNormal"];
@ -80,7 +80,7 @@ namespace Xamarin.Forms.Platform.WPF
self.FontSize = element.FontSize;
if (!string.IsNullOrEmpty(element.FontFamily))
self.FontFamily = new FontFamily(element.FontFamily);
self.FontFamily = new FontFamily(new Uri("pack://application:,,,/"), element.FontFamily);
else
self.FontFamily = (FontFamily)System.Windows.Application.Current.Resources["FontFamilySemiBold"];