2010-11-10 14 views
32

एक WPF एप्लिकेशन का डिफ़ॉल्ट फ़ॉन्ट परिवार क्या है? क्या यह प्रणाली निर्भर है? मुझे अपने सिस्टम पर ताहोमा मिला।एक WPF एप्लिकेशन का डिफ़ॉल्ट फ़ॉन्ट परिवार क्या है?

यदि मैं नियंत्रण बनाता हूं तो नियंत्रण का डिफ़ॉल्ट फ़ॉन्टफैमली सेट क्या होगा?

उत्तर

38

"डिफ़ॉल्ट" फ़ॉन्ट आपके वर्तमान ओएस का वर्तमान सिस्टम फ़ॉन्ट है। ताहोमा विंडोज एक्सपी का डिफॉल्ट सिस्टम फ़ॉन्ट है, विस्टा पर, विंडोज 7 यह सेगो यूआई है।

+0

लेकिन डिफ़ॉल्ट फ़ॉन्ट जब मैं एमएस वर्ड खुला "Times New Roman" .. –

+9

है कि डिफ़ॉल्ट फ़ॉन्ट आप के साथ * प्रकार * लेकिन यूआई का नहीं फ़ॉन्ट है (यानी मेनू और शब्द के बटन में इस्तेमाल फ़ॉन्ट)। – bitbonk

+0

विंडोज 8 के लिए कोई विचार? विंडोज 8 के लिए –

3

विंडोज 8 पर, ऐसा लगता है कि फॉलबैक फ़ॉन्ट 0.9 बेसलाइन और 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

यह उल्लेखनीय है कि यह फ़ॉन्ट परिवार 'SystemFonts.MessageFontFamily' स्थिर संपत्ति से आता है। इसलिए यदि आपको कभी भी अपने ऐप में कहीं भी इसका उपयोग करने की ज़रूरत है - तो आपको इसे अपने द्वारा ''FontFamily' उदाहरण बनाने के बजाय वहां से पढ़ना चाहिए। – torvin

संबंधित मुद्दे