specification icon indicating copy to clipboard operation
specification copied to clipboard

[Proposal] Add Hinting

Open TUSF opened this issue 2 years ago • 1 comments

A feature that's been used in fonts for ages, but doesn't seem to have much presence in vector graphics is hinting. This is used in fonts so that letters can be easily legible even when significantly scaled down on devices that don't have a high pixel density. The web is full of vector graphics with a decent amount of detail, that are completely lost due to being scaled down—the legibility of shapes effectively blur together (just look at favicons). For graphics where it's important that some details are more visible even at smaller scales, (without manually retouching the bitmaps afterwards) hinting is the answer.

Seems someone at least proposed it for SVG, but that never went anywhere.

That said, there's a desire to reduce complexity when it comes to rendering tvg images, so maybe it's not a good fit, or maybe it just takes using a certain strategy to process the commands? I think that perhaps hinting commands should be treated as "modes" that tell the renderer how to process all future draws, with the ability to return to the default rendering mode.

Currently the only useful Hint that comes to mind is a "pixel hint" command, with a couple of possible styles to go with it.

Value Style Type Description
0 Smooth Default. Uses resampling techniques common in scaling down vector graphics.
1 Pixel Snap Aligns draw objects to the grid of pixels, without smoothing.

If Smooth, the command ends. Or possibly, there might be other smoothing options if something else is preferred?

If Pixel Snap, what follows is a Point which defines the center of a hypothetical pixel grid cell, for the vectors in this mode to snap to.

TUSF avatar May 05 '22 06:05 TUSF

Yes, this is a good idea and is in consideration. I need to do some tests on how that works first.

ikskuh avatar May 06 '22 08:05 ikskuh