Vector fonts

3 posts / 0 new
Last post
alfkil
alfkil's picture
Offline
Last seen: 2 years 8 months ago
Joined: 2011-05-10 22:02
Vector fonts

I am wondering, if there is some (easy) way of obtaining a vector map
of a corresponging set of glyphs (eg. a string)? I need it to be able to AreaFill a rotated text item.

I have looked in the diskfont.library autodoc, but I find the information there wildly confusing. What am I supposed to do with the information returned from OpenOutlineFont? Why is there a bitmap entry in the Glyph structure but no vector map?

Sorry, I am not very much into fonts, I barely know how to SetFont()/Move()/Text()...

EDIT: Also of course I know the alternative of rotating a bitmapped string with CompositeTags, but sadly that is no option in this case.

hypex
hypex's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 2011-09-09 16:20
As I understand it whenever a

As I understand it whenever a font is loaded into memory it is rendered for each size specified as a BitMap. Hence why there is no vector info. Also, the vectors coud be in different formats, so how do you deal with that?

If you looks in diskfont/diskfonttag.h there are a few tags you can enquire with but I can't see anything specific to vectors. The only thing I notice is OT_MemPtr and OT_MemSize for specifying a font in memory.

But what is it you need to do? Do you wish to plot the outline of font characters rotated and fill in the inside? If so then for fonts they may not be one colour and with anti-aliasing a simple ouline could be too simplified unless it was a shadow.

There are the tags OT_RotateSin and OT_RotateCos but I don't kniw if these will help you to render a rotated character to help you.

alfkil
alfkil's picture
Offline
Last seen: 2 years 8 months ago
Joined: 2011-05-10 22:02
@hypex The thing I am trying

@hypex

The thing I am trying to do is this:

QPainterPath path;
path.addText(somefont, "Some text");
/* transformations to path eg. rotate*/
QPainter painter(someWidget);
/* outline, texture fill etc. to painter */
painter.drawPath(path);

So Qt needs to be able to handle text as a QPainterPath object (represented as a series of points with lines or bezier curves between) to be able to transform it (it will not work to just use the bitmapped verison for rotation because of this specific structure).

Log in or register to post comments