IXpsOMGlyphs::SetFontFaceIndex method

Sets the index of the font face to be used.

This value is only used when GetFontResource returns an IXpsOMFontResource interface that represents a TrueType font collection.

Syntax

HRESULT SetFontFaceIndex(
  [in] SHORT fontFaceIndex
);

Parameters

  • fontFaceIndex [in]
    The index value of the font face to be used.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the table that follows. For information about XPS document API return values that are not listed in this table, see XPS Document Errors.

Return code Description
S_OK

The method succeeded.

E_INVALIDARG

The value of fontFaceIndex is not valid; it must be an integer that is greater than or equal to –1.

 

Remarks

The default value of the font face index property is –1, which means that a font index has not been set or the font resource is not a TrueType font collection.

If this value is specified and is not –1, "#<Index>" is appended to the Font URI during serialization. Here, <Index> is the value that is set by SetFontFaceIndex.

The following markup of a FixedPage shows the result of setting the fontFaceIndex to 1. Notice that the FontUri attribute of the Glyphs element has a value of ../Resources/Fonts/Font.TTF#1, which includes the index of the font face.

    <FixedPage Height="1056" Width="816" xml:lang="en-US"
    xmlns="https://schemas.microsoft.com/xps/2005/06">
      <Glyphs
      OriginX="96"
      OriginY="96"
      UnicodeString="This is Page 1!"
      FontUri="../Resources/Fonts/Font.TTF#1"
      FontRenderingEmSize="16" />
    </FixedPage>

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Header

Xpsobjectmodel.h

IDL

XpsObjectModel.idl

See also

IXpsOMGlyphs

XPS Document Errors

XML Paper Specification