Поделиться через


Font Class

Properties for a Single Font.When the object is serialized out as xml, its qualified name is w:font.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.Font

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(FontFamily))> _
<ChildElementInfoAttribute(GetType(Pitch))> _
<ChildElementInfoAttribute(GetType(FontSignature))> _
<ChildElementInfoAttribute(GetType(AltName))> _
<ChildElementInfoAttribute(GetType(FontCharSet))> _
<ChildElementInfoAttribute(GetType(NotTrueType))> _
<ChildElementInfoAttribute(GetType(EmbedRegularFont))> _
<ChildElementInfoAttribute(GetType(Panose1Number))> _
<ChildElementInfoAttribute(GetType(EmbedBoldFont))> _
<ChildElementInfoAttribute(GetType(EmbedItalicFont))> _
<ChildElementInfoAttribute(GetType(EmbedBoldItalicFont))> _
Public Class Font _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Font
[ChildElementInfoAttribute(typeof(FontFamily))]
[ChildElementInfoAttribute(typeof(Pitch))]
[ChildElementInfoAttribute(typeof(FontSignature))]
[ChildElementInfoAttribute(typeof(AltName))]
[ChildElementInfoAttribute(typeof(FontCharSet))]
[ChildElementInfoAttribute(typeof(NotTrueType))]
[ChildElementInfoAttribute(typeof(EmbedRegularFont))]
[ChildElementInfoAttribute(typeof(Panose1Number))]
[ChildElementInfoAttribute(typeof(EmbedBoldFont))]
[ChildElementInfoAttribute(typeof(EmbedItalicFont))]
[ChildElementInfoAttribute(typeof(EmbedBoldItalicFont))]
public class Font : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • AltName <w:altName>

  • Panose1Number <w:panose1>

  • FontCharSet <w:charset>

  • FontFamily <w:family>

  • NotTrueType <w:notTrueType>

  • Pitch <w:pitch>

  • FontSignature <w:sig>

  • EmbedRegularFont <w:embedRegular>

  • EmbedBoldFont <w:embedBold>

  • EmbedItalicFont <w:embedItalic>

  • EmbedBoldItalicFont <w:embedBoldItalic>

[ISO/IEC 29500-1 1st Edition]

17.8.3.10 font (Properties for a Single Font)

This element specifies the properties for one of the fonts used in this document. A font element shall be written out for each font face used in the document, and includes:

  • The name of the font as used in the document's stories

  • (optionally) Font metrics allowing other applications to locate appropriate substitute fonts as needed

  • (optionally) Embedded forms of the font

[Example: Consider the following information stored for a single font:

<w:font w:name="Times New Roman">
<w:panose1 w:val="02020603050405020304" />
<w:charset w:val="00" />
<w:family w:val="roman" />
<w:pitch w:val="variable" />
<w:sig w:usb0="20002A87" w:usb1="80000000" w:usb2="00000008" w:usb3="00000000" w:csb0="000001FF" w:csb1="00000000" />
</w:font>

The font element contains information about the Times New Roman font; specifically, information used to locate a substitute font if it is not available. end example]

Parent Elements

fonts (§17.8.3.11)

Child Elements

Subclause

altName (Alternate Names for Font)

§17.8.3.1

charset (Character Set Supported By Font)

§17.8.3.2

embedBold (Bold Style Font Style Embedding)

§17.8.3.3

embedBoldItalic (Bold Italic Font Style Embedding)

§17.8.3.4

embedItalic (Italic Font Style Embedding)

§17.8.3.5

embedRegular (Regular Font Style Embedding)

§17.8.3.6

family (Font Family)

§17.8.3.9

notTrueType (Raster or Vector Font)

§17.8.3.12

panose1 (Panose-1 Typeface Classification Number)

§17.8.3.13

pitch (Font Pitch)

§17.8.3.14

sig (Supported Unicode Subranges and Code Pages)

§17.8.3.16

Attributes

Description

name (Primary Font Name)

Specifies the primary name of the current font. This name shall be used to link the information stored in this element with uses of this value in the rFonts element (§17.3.2.26) in document content.

[Example: Consider the following information stored for a single font:

<w:font w:name="Times New Roman">

</w:font>

The name attribute specifies that the information contained in this element must be used to look up information about all uses of the Times New Roman font in the document contents. end example]

The possible values for this attribute are defined by the ST_String simple type (§22.9.2.13).

[Note: The W3C XML Schema definition of this element’s content model (CT_Font) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Font Members

DocumentFormat.OpenXml.Wordprocessing Namespace