Skip to content

Commit

Permalink
测试修改字体名,然而没有效果
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Oct 7, 2023
1 parent c00c7f7 commit 137568a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class MainWindow : Window
public MainWindow()
{
InitializeComponent();
var file = "f:\\temp\\汉仪文黑-85W.ttf";
var file = "f:\\temp\\hw.ttf";

PrivateFontCollection collection = new PrivateFontCollection();
collection.AddFontFile(file);
Expand All @@ -33,8 +33,8 @@ public MainWindow()
}

var uri = new Uri(file);
FontFamily fontFamily = new FontFamily(uri, "汉仪文黑-85W");
//TextBlock.FontFamily = fontFamily;
FontFamily fontFamily = new FontFamily(uri, "hw");
TextBlock.FontFamily = fontFamily;
TextBlock.FontWeight = FontWeight.FromOpenTypeWeight(485);
Loaded += MainWindow_Loaded;
}
Expand Down

0 comments on commit 137568a

Please sign in to comment.