Set Font Family to Times New Roman Rotativa Mvc
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
FontFamily Class
Cheers.
Definition
Represents a family of related fonts.
public ref class FontFamily [System.ComponentModel.TypeConverter(typeof(Arrangement.Windows.Media.FontFamilyConverter))] [System.Windows.Localizability(System.Windows.LocalizationCategory.Font)] public class FontFamily [<System.ComponentModel.TypeConverter(typeof(System.Windows.Media.FontFamilyConverter))>] [<Organisation.Windows.Localizability(System.Windows.LocalizationCategory.Font)>] type FontFamily = class Public Class FontFamily - Inheritance
- Attributes
Remarks
A font family unit is a set up of typefaces that share the same family proper noun, such as "Times New Roman", but that differ in features. These feature differences include Style, such as italic, and Weight, such as bold.
Example of typefaces that are members of the "Times New Roman" font family
Nearly user interface (UI) elements, such as Push and TextBlock, provide a FontFamily property that tin exist used to specify a font for the text content of a control. You lot ascertain the font past setting that property with a FontFamily value. The following examples show how to reference a font, in Extensible Application Markup Language (XAML) and in code.
myTextBlock.FontFamily = new FontFamily("Comic Sans MS"); myTextBlock.FontFamily = New FontFamily("Comic Sans MS") <TextBlock FontFamily="Comic Sans MS">Hello, world</TextBlock> In the preceding example, the font that is referenced, "Comic Sans MS", is referred to by its friendly proper noun. Also, in this example the font is assumed to be in the organisation font collection.
Specifying Fonts in Alternate Directories
A Windows Presentation Foundation (WPF) application can specify a directory, other than the directory that contains the systems font drove, for resolving font references. The friendly name of the font tin specify an absolute uniform resource identifier (URI) value to resolve the font reference, equally shown in the following Extensible Application Markup Language (XAML) and lawmaking examples.
// Create a new FontFamily object, using an accented URI reference. myTextBlock.FontFamily = new FontFamily("file:///d:/MyFonts/#Pericles Light"); ' Create a new FontFamily object, using an absolute URI reference. myTextBlock.FontFamily = New FontFamily("file:///d:/MyFonts/#Pericles Lite") <TextBlock FontFamily="file:///d:/MyFonts/#Pericles Calorie-free"> Aegean Bounding main </TextBlock> The friendly name of the font can also specify a relative URI value, which requires a base URI to resolve the font reference. The BaseUri property of the FontFamily object corresponds to the base URI value. The following lawmaking instance shows how to create a font reference that is composed of a base URI value and a relative URI value.
// Create a new FontFamily object, using a base of operations URI reference and a relative URI reference. myTextBlock.FontFamily = new FontFamily(new Uri("file:///d:/MyFonts/"), "./#Pericles Light"); ' Create a new FontFamily object, using a base of operations URI reference and a relative URI reference. myTextBlock.FontFamily = New FontFamily(New Uri("file:///d:/MyFonts/"), "./#Pericles Light") You lot can utilize a base URI value when you reference a font that is packaged every bit role of the application. For example, the base URI value can be a "pack://application" URI, which lets y'all reference fonts that are packaged as application resource. The post-obit code example shows a font reference that is composed of a base URI value and a relative URI value.
// The font resource reference includes the base URI reference (application directory level), // and a relative URI reference. myTextBlock.FontFamily = new FontFamily(new Uri("pack://application:,,,/"), "./resources/#Pericles Low-cal"); ' The font resources reference includes the base URI reference (application directory level), ' and a relative URI reference. myTextBlock.FontFamily = New FontFamily(New Uri("pack://application:,,,/"), "./resources/#Pericles Calorie-free") When a FontFamily is specified as an attribute in markup, the base URI value is ever implied - its value is the URI of the XAML page. The implied base URI value is used with the relative URI value in the friendly name cord to obtain the location of the font. In the following Extensible Awarding Markup Linguistic communication (XAML) instance, notice that the relative URI value uses the "./" note, which means "in the current binder" of the base URI value.
<TextBlock FontFamily="./resources/#Pericles Light"> Aegean Sea </TextBlock> A WPF application can packet fonts as either a content particular, a resource item, or a library resource detail. For more information, come across Packaging Fonts with Applications.
Font Fallback
Font fallback refers to the automatic substitution of a font other than the font that is selected by the client application. At that place are 2 master reasons why font fallback is invoked:
-
The font that is specified by the client application does non be on the organization.
-
The font that is specified by the client application does non contain the glyphs that are required to render text.
InWPF, the font fallback mechanism uses the default fallback font family, "Global User Interface", as the substitute font. This font is defined equally a composite font, whose file name is "GlobalUserInterface.CompositeFont". For more information about composite fonts, see the Composite Fonts department in this topic.
The WPF font fallback machinery replaces previous Win32 font commutation technologies.
Defining a Font Fallback Sequence in Code
You can define a font fallback sequence in your code, which lets yous define an alternate font. When you lot create a FontFamily object, provide multiple font family unit names, separated past commas, for the String parameter, such as "Comic Sans MS, Verdana". In this case, if the glyphs from the "Comic Sans MS" typeface are not bachelor, glyphs from the "Verdana" typeface are used. If neither "Comic Sans MS" nor "Verdana" have the required glyphs, the fallback font family unit of the typeface is used, which is "Global User Interface" past default.
The following examples show how to define a font fallback sequence, in Extensible Application Markup Language (XAML) and in code.
myTextBlock.FontFamily = new FontFamily("Comic Sans MS, Verdana"); myTextBlock.FontFamily = New FontFamily("Comic Sans MS, Verdana") <TextBlock FontFamily="Comic Sans MS, Verdana">Hullo, world</TextBlock> Any i of the fonts in the fallback sequence can specify font locations. In the post-obit examples, "Pericles Lite" is referenced as an application resource, and "Verdana" is referenced every bit a arrangement font collection member.
myTextBlock.FontFamily = new FontFamily(new Uri("pack://awarding:,,,/"), "./resource/#Pericles Light, Verdana"); myTextBlock.FontFamily = New FontFamily(New Uri("pack://application:,,,/"), "./resources/#Pericles Low-cal, Verdana") <TextBlock FontFamily="./resources/#Pericles Light, Verdana">Aegean Ocean</TextBlock> Composite Fonts
The WPF platform provides a blended font feature to allow the structure of total range multilingual fonts, and to avoid displaying missing glyphs. Composite fonts supplant the Win32 font linking, font fallback, font binding, font association, and end-user-defined characters (EUDC) mechanisms.
A blended font family unit is available to applications through the FontFamily and Typeface constructors just like any other font family. Each composite font family is named, and, as with other fonts, can provide localized variants of its name in multiple languages.
The following markup case shows how a blended font family can be defined as a disk file. This file can be stored in the default Windows font directory as with whatsoever other installed font, or tin can be referenced in any location by including its URI when referencing the family by name.
The following example shows the font family markup in a ".CompositeFont" file.
<FontFamily xmlns="http://schemas.microsoft.com/winfx/2006/xaml/composite-font" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" Baseline="0.nine" LineSpacing="1.ii"> <!-- Name mapping --> <FontFamily.FamilyNames> <Organization:String ten:Key="en-Usa">Global User Interface</System:String> </FontFamily.FamilyNames> <!-- Faces to report in font chooser UI --> <FontFamily.FamilyTypefaces> <FamilyTypeface Weight="Normal" Stretch="Normal" Style="Normal" UnderlinePosition="-0.1" UnderlineThickness="0.05" StrikethroughPosition="0.three" StrikethroughThickness="0.05" CapsHeight="0.5" XHeight="0.3" /> <FamilyTypeface Weight="Bold" Stretch="Normal" Style="Normal" UnderlinePosition="-0.ane" UnderlineThickness="0.05" StrikethroughPosition="0.3" StrikethroughThickness="0.05" CapsHeight="0.v" XHeight="0.3" /> </FontFamily.FamilyTypefaces> <!-- Character to family unit lookups (in lookup guild) --> <FontFamily.FamilyMaps> <!-- Basic Latin 0000-007F Latin-ane Supplement 0080-00FF Latin Extended-A 0100-017F Latin Extended-B 0180-024F IPA Extensions 0250-02AF Spacing Modifier Messages 02B0-02FF Combining Diacritics Marks 0300-036F Greek and Coptic 0370-03FF Cyrillic 0400-04FF Cyrillic Supplement 0500-052F Phonetic Extensions 1D00-1D7F Latin Extended Additional 1E00-1EFF Greek Extended 1F00-1FFF Alpha Pres Forms Latin FB00-FB0F --> <!-- CHS --> <FontFamilyMap Unicode="0000-052F, 1D00-1FFF, FB00-FB0F" Language="zh-Hans" Target="Times New Roman" Calibration="1.0" /> <!-- CHT --> <FontFamilyMap Unicode="0000-052F, 1D00-1FFF, FB00-FB0F" Language="zh-Hant" Target="Times New Roman" Scale="1.0" /> <!-- Other (include JA and KO) --> <FontFamilyMap Unicode="0000-052F, 1D00-1FFF, FB00-FB0F" Target="Comic Sans MS, Verdana" Scale="4.0" /> <!-- Armenian 0530-058F Georgian 10D0-10FF Blastoff Pres Forms Armenian FB10-FB1C --> <FontFamilyMap Unicode="0530-058F, 10D0-10FF, FB10-FB1C" Target="Sylfaen" Scale="1.0" /> <!-- Other FontFamilyMap elements defined ... --> </FontFamily.FamilyMaps> </FontFamily> The following four composite fonts appear in the default Windows font directory as part of the WPF installation.
| Font | Notes |
|---|---|
| GlobalMonospace.CompositeFont | Renders text by using a monospace font, for example, "Courier New" for Latin characters. |
| GlobalSanSerif.CompositeFont | Renders text by using a sans serif font, for example, "Arial" for Latin characters. |
| GlobalSerif.CompositeFont | Renders text by using a serif font, for case, "Times New Roman" for Latin characters. |
| GlobalUserInterface.CompositeFont | Renders text past using a default font, for example, "Times New Roman" for Latin characters. |
XAML Aspect Usage
<object FontFamily="fontFamilyName"/> - or - <object FontFamily="fontFamilyNamesList"/> - or - <object FontFamily="fontFamilyFolderReference"/> - or - <object FontFamily="fontFamilyUriReference"/> XAML Values
fontFamilyName
A string specifying a font family proper name. For example, "Arial" or "Century Gothic".
fontFamilyNamesList
A string specifying multiple font family names, each separated by a comma (any white space following a comma is ignored). The starting time font family unit specified serves every bit the primary font family; subsequent font families serve as fallback families to be used in cases where the primary font family unit is unavailable or not applicable. For example, "Arial, Century Gothic" specifies Arial as the primary font family, with Century Gothic every bit the fallback font family.
fontFamilyFolderReference
A string specifying a binder containing the font, along with a font family unit name. The folder and font family name are delimited by a # character. The binder reference may be absolute, or relative. For example, "Custom Fonts\#My Custom Font".
fontFamilyUriReference
A string specifying a uniform resource identifier (URI) for the font, along with a font family name. The URI and font family name are delimited past a # character. For case, "http://MyFontServer/Fonts/#My Custom Font".
Constructors
Backdrop
| Baseline | Gets or sets the distance betwixt the baseline and the character cell peak. |
| BaseUri | Gets the base of operations compatible resource identifier (URI) that is used to resolve a font family proper name. |
| FamilyMaps | Gets the drove of FontFamilyMap objects. |
| FamilyNames | Gets a collection of strings and CultureInfo values that stand for the font family unit names of the FontFamily object. |
| FamilyTypefaces | Gets a collection of typefaces for the FontFamily object. |
| LineSpacing | Gets or sets the line spacing value for the FontFamily object. The line spacing is the recommended baseline-to-baseline distance for the text in this font relative to the em size. |
| Source | Gets the font family name that is used to construct the FontFamily object. |
Methods
| Equals(Object) | Gets a value that indicates whether the current font family object and the specified font family object are the aforementioned. |
| GetHashCode() | Serves as a hash function for FontFamily. It is suitable for employ in hashing algorithms and data structures such as a hash table. |
| GetType() | Gets the Type of the current instance. (Inherited from Object) |
| GetTypefaces() | Returns a collection of Typeface objects that stand for the type faces in the default system font location. |
| MemberwiseClone() | Creates a shallow copy of the electric current Object. (Inherited from Object) |
| ToString() | Returns the value of the Source property. |
Applies to
Run across besides
- Fonts
williamsraiddece99.blogspot.com
Source: https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.fontfamily
0 Response to "Set Font Family to Times New Roman Rotativa Mvc"
Post a Comment