gpforge
An advanced bitmap font editor
Loading...
Searching...
No Matches
canvas.h File Reference

The glyph canvas. More...

#include <widgets/gp_widgets.h>

Go to the source code of this file.

Functions

void gpf_canvas_draw (gp_widget *self)
 Paints the selected glyph, enlarged, into the canvas pixmap.
int gpf_canvas_input (gp_event *ev)
 Handles an input event on the canvas.

Detailed Description

The glyph canvas.

There is no bounding box to manage: the canvas is the line box and the glyph's own advance, and the ink box and the bearings are whatever the ink says they are.

The drawn region is derived from the metrics and the advance, never from the ink, so that setting a pixel at the edge of the glyph does not move the view out from under the next click.

Definition in file canvas.h.

Function Documentation

◆ gpf_canvas_draw()

void gpf_canvas_draw ( gp_widget * self)

Paints the selected glyph, enlarged, into the canvas pixmap.

Draws the pixel grid with its columns and rows numbered, the ink, the metric lines, the cursor and its position. With no font open it fills the background and returns. The background is the foreground color while the canvas is focused and the background color otherwise, so it is redrawn on a focus change.

Parameters
selfThe canvas pixmap widget.

Definition at line 297 of file canvas.c.

◆ gpf_canvas_input()

int gpf_canvas_input ( gp_event * ev)

Handles an input event on the canvas.

A press starts a stroke, or drags the advance or the origin when it lands on one of their lines, motion continues it and a release commits it as one undo entry. The arrows move the cursor, and so does the mouse, space toggles the pixel under it, shift and the arrows move the ink, alt makes a step five pixels, and the wheel zooms.

Parameters
evAn input event.
Returns
Non-zero when the event was handled.

Definition at line 579 of file canvas.c.