How can I use superscripts with DirectWrite?

  • Thread starter Thread starter simon22
  • Start date Start date
S

simon22

Guest
I am using DirectWrite with my Visual C++ MFC Visual Studio 2017 application, and I need to be able to use DirectWrite to display superscript text. I had thought that I could get away with using special unicode superscript characters, even though these are only available in a restricted set of fonts, because (so I thought) the superscript text I needed was entirely numeric (superscript characters are pretty much restricted to numerics). However, unfortunately, I now realise I need to use a comma too, to separate some of these superscript numerics. So it looks like, just for the sake of these commas, I am going to have to find a way of supporting superscript properly (i.e. allowing any text to be displayed as superscript, using the current font).

I know that, until recently at least, there was no support for superscripts built-in to DirectWrite. However, on this page:

What's new in DirectWrite

it list the following in the "What's New in Windows 8" section:

  • "Additional font properties, such as: super/subscript, caret slope, PANOSE, and Unicode ranges."

What I can't see is how to set these superscript font properties. Can anyone advise please? I'd really love to see a code example, preferably written in Visually C++ and not in XAML or anything like that (which I am not familiar with).

If superscript support was added to DirectWrite in Windows 8, is there anyway it can be used with earlier versions of Windows like Vista? If not, can anyone give me a link to a code example of a customisation of DirectWrite to implement superscripts which can be used with Vista?

All help very much appreciated.






Simon

Continue reading...
 

Similar threads

Back
Top