Search code examples
font-sizeuniscribe

How to adjust the width of a font using the Uniscribe API


Please bear with me, I am new to Uniscribe so I hope this isn't a dumb question but I have been unable to find the solution anywhere else. So, here goes...

I am trying to use the Uniscribe API to reduce the width of a font; that is, given a specific font of a particular height, I would like to be able to reduce the width of each character (and all the relevant spacings) by some user-defined percentage.

I have successfully achieved this without calling any Uniscribe functions by obtaining a LOGFONT structure for the current font and adjusting the lfWidth field to be a percentage of its original value. I realise that this is just an average character width but it seemed to have the desired result.

However, when I try to do the same thing using Uniscribe I've noticed that the lfWidth field gets reset to 0 following calls to ScriptShape(). As a result, all rendered text is output using its original width. I'm at a loss to explain why this is or what to do to get around it.

Does anybody have any idea if it's even possible to do what I am trying to do?


Solution

  • You might want to start here (look at the Generate Glyph Information Section), then lead to this.

    Hope it helps!