2010-11-10 34 views

Trả lời

38

Phông chữ "mặc định" là phông chữ hệ thống hiện tại của hệ điều hành hiện tại của bạn. Tahoma là font hệ thống mặc định của Windows XP, trên Vista, Windows 7 là Segoe UI.

+0

Nhưng khi tôi mở MS Word phông chữ mặc định là "Times New Roman" .. –

+9

Đó là phông chữ mặc định bạn * Loại * với nhưng không phải là phông chữ của giao diện người dùng (tức là phông chữ được sử dụng trong menu và các nút của Word). – bitbonk

+0

Bất kỳ ý tưởng nào cho Windows 8? –

3

Trên Windows 8, có vẻ như phông chữ dự phòng là giao diện người dùng Segoe với đường cơ sở 0,9 và khoảng cách dòng 1,2.

Simulating WPF default font

<Page 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:clr="clr-namespace:System;assembly=mscorlib"> 
    <Page.Resources> 
     <clr:String x:Key="someText">The quick brown fox, ABCD, 1234567890, /@#</clr:String> 
     <SolidColorBrush x:Key="lightColor">#bbbbbb</SolidColorBrush> 
     <SolidColorBrush x:Key="darkColor">#000000</SolidColorBrush> 
     <FontFamily x:Key="default">non existent font</FontFamily> 
     <FontFamily x:Key="segoe">Segoe UI</FontFamily> 
     <FontFamily x:Key="segoe_base" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/composite-font" 
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
       xmlns:s="clr-namespace:System;assembly=mscorlib" 
       Baseline="0.9" 
       LineSpacing="1.2"> 
     <FontFamily.FamilyNames> 
      <s:String x:Key="en-US" >Baseline Segoe UI</s:String> 
     </FontFamily.FamilyNames> 
     <FontFamily.FamilyMaps> 
      <FontFamilyMap Target="Segoe UI" /> 
     </FontFamily.FamilyMaps> 
     </FontFamily> 
    </Page.Resources> 

    <StackPanel Margin="10" Width="250"> 
     <TextBlock TextWrapping="Wrap">Segoe UI with a baseline of 0.9 and line spacing of 1.2 lines up with the default font</TextBlock> 
     <Grid Margin="5"> 
     <TextBlock Foreground="{StaticResource darkColor}" TextWrapping="Wrap" FontSize="20" FontFamily="{StaticResource default}" Text="{StaticResource someText}"/> 
     <TextBlock Foreground="{StaticResource lightColor}" TextWrapping="Wrap" FontSize="20" FontFamily="{StaticResource segoe_base}" Text="{StaticResource someText}"/> 
     </Grid> 
     <TextBlock Margin="0,10,0,0" TextWrapping="Wrap">Segoe UI with the default baseline and line spacing does not line up with the default font</TextBlock> 
     <Grid Margin="5"> 
     <TextBlock Foreground="{StaticResource darkColor}" TextWrapping="Wrap" FontSize="20" FontFamily="{StaticResource default}" Text="{StaticResource someText}"/> 
     <TextBlock Foreground="{StaticResource lightColor}" TextWrapping="Wrap" FontSize="20" FontFamily="{StaticResource segoe}" Text="{StaticResource someText}"/> 
     </Grid> 
    </StackPanel> 
    </Page> 
+1

Điều đáng nói đến là họ phông chữ này xuất phát từ thuộc tính tĩnh 'SystemFonts.MessageFontFamily'. Vì vậy, nếu bạn cần phải sử dụng nó ở đâu đó trong ứng dụng của bạn - bạn nên đọc nó từ đó thay vì xây dựng cá thể 'FontFamily' mới của chính bạn. – torvin

Các vấn đề liên quan