Skip to content

Rendering compound bezier curves with holes #52

@t-veor

Description

@t-veor

I'm trying to render glyphs by loading the control points from a font and issuing the relevant bezier curve commands to Canvas, and of course this happens when I try to render an O:
image

This is because the O glyph consists of two paths in opposite winding directions (I've coloured the start and end points of each path segment going from red to green so I could see the winding directions):

image

But of course with me trying to render two paths and fill them in, the outer path just completely fills in the inner one. Is there a way to specify winding direction or something that lets me mark a path as negative space? I couldn't figure out how to move the pen without creating a new path.

One way which I've found which helps is to not close paths early and treat the whole glyph as one path, because it looks like the rasteriser treats overlaps in the path as negative space:

image

But of course this breaks rendering glyphs which are actually made out of multiple overlapping paths:

image

Although I will admit this has the possibility of looking cool.

I can't see a way of rendering bitmaps either with the drawing API, so I can't get around the problem by just rendering to bitmap and drawing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions