开发者

How does GetGlyphOutline function work? (WinAPI)

Basically I want to get bezier control points from a ttf font and then draw them. I was basic开发者_开发技巧ally wondering 2 things.

  1. Does it return an array of points or is it more complex?
  2. How can you tell the points of 1 contour from another ex: the letter O which has 2 contours?

Thanks


Found it:

The native buffer returned by GetGlyphOutline when GGO_NATIVE is specified is a glyph outline. A glyph outline is returned as a series of one or more contours defined by a TTPOLYGONHEADER structure followed by one or more curves. Each curve in the contour is defined by a TTPOLYCURVE structure followed by a number of POINTFX data points. POINTFX points are absolute positions, not relative moves. The starting point of a contour is given by the pfxStart member of the TTPOLYGONHEADER structure. The starting point of each curve is the last point of the previous curve or the starting point of the contour. The count of data points in a curve is stored in the cpfx member of TTPOLYCURVE structure. The size of each contour in the buffer, in bytes, is stored in the cb member of TTPOLYGONHEADER structure. Additional curve definitions are packed into the buffer following preceding curves and additional contours are packed into the buffer following preceding contours. The buffer contains as many contours as fit within the buffer returned by GetGlyphOutline.


@Milo: A void pointer is where you define a pointer to any memory location regardless of that locations defined "type" (basically, it's similiar to the "pointers" used in assembly). The problem is, it's usually not portable between different machine architectures and if you want to do anything with arrays you have to a) Manually implement boundries between each member and keep track of byte sizes (which is usually even more architecture dependant) or b) Cast it to a predefined struct or series of structs, and generally if you have to do this, you could likely just use a pointer to the struct and avoid the use of void pointers entirely.

The reason I say usually, is because there are certain circumstances when the drawbacks of using void pointers don't apply. Also, I know assembly dosen't use "pointers" per se, but it is still very similiar and I just used the term to help clarify my explanation. Remember, many things aren't set in stone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜