Performing font substitution

Call the TStandardFontSubstituter::StyleMissingCharacters member function to perform font substitution processing on a text string. You need to first create your text instance and apply the primary font style.

For example, suppose that you create a text string containing a mixture of ASCII and Greek characters, and apply the Geneva font, as follows:

      TStandardText text( "Roman" );
      text.Insert( TGreek::kCapitalLetterEta );
      text.Insert( TGreek::kSmallLetterLamda );
      text.Insert( TGreek::kSmallLetterLamda );
      text.Insert( TGreek::kSmallLetterAlpha );
      text.Insert( TGreek::kSmallLetterFinalSigma );
      
      TToken genevaName( "Geneva" );
      TFontFamilyStyle geneva( genevaName );
      text.AddStyles( geneva );
The Geneva font does not contain glyphs representing the Greek characters alpha, eta, lambda, or sigma. Without calling the font substitution mechanism first, you cannot display these Greek characters. An empty box appears for each of these characters.

To request font substitution, instantiate TStandardFontSubstituter and call the StyleMissingCharacters member function:

      TStandardFontSubstituter substituter;
      substituter.StyleMissingCharacters( text );
This call causes the font substituter to iterate through your installed fonts until it finds glyphs representing these Greek characters.

After you call the StyleMissingCharacters function, your text string is ready to
be displayed.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker