Text Service: Display Attributes

If your text service wishes to display text in different colors (e.g., displaying the current composition in red), then your text service needs to implement these interfaces:

Interface

How Obtained

ITfDisplayAttributeProvider

Obtained by QI from ITfTextInputProcessor

IEnumTfDisplayAttributeInfo

Returned from ITfDisplayAttributeProvider::EnumDisplayAttributeInfo

ITfDisplayAttributeInfo

Returned from ITfDisplayAttributeProvider::GetDisplayAttributeInfo

If you implement ITfDisplayAttributeProvider, you must also understand how properties work (because display attributes are set via properties), and you must also register your text service as a display attribute property provider at install time, like this:

ITfCategoryMgr::RegisterCategory(<clsid of text service>, GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, <clsid of text service>);

MSDN also mentions GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY, but it doesn't seem to be used in the samples or in any text service I can find.

A working example of a text service that implements display attributes can be found in MSDN.