|
gpforge
An advanced bitmap font editor
|
A glyph cell rendering. More...
Go to the source code of this file.
Data Structures | |
| struct | gpf_cell |
| A glyph cell geometry. More... | |
Functions | |
| void | gpf_cell_init (struct gpf_cell *self, const gp_widget_render_ctx *ctx, unsigned int max_h) |
| Sizes a cell for the current font and zoom. | |
| void | gpf_cell_center (struct gpf_cell *self, const gp_pixmap *p, unsigned int cols, unsigned int rows) |
| Centres a grid of cells in a pixmap. | |
| int | gpf_cell_at (const struct gpf_cell *self, unsigned int cols, unsigned int rows, gp_coord x, gp_coord y) |
| Finds the cell under a point. | |
| void | gpf_cell_draw (gp_pixmap *p, const gp_widget_render_ctx *ctx, const struct gpf_cell *self, int x, int y, uint32_t code) |
| Draws a glyph cell. | |
| void | gpf_cell_draw_glyph (gp_pixmap *p, const gp_widget_render_ctx *ctx, const struct gpf_cell *self, int x, int y, uint32_t code, const struct gpf_glyph *glyph) |
| Draws a glyph cell with the ink handed to it. | |
| void | gpf_cell_grid (gp_pixmap *p, const gp_widget_render_ctx *ctx, const struct gpf_cell *self, unsigned int cols, unsigned int rows) |
| Draws the lines between the cells of a grid. | |
A glyph cell rendering.
One glyph cell: the codepoint, then the character as the widget font draws it, then the glyph itself. The glyph table is a grid of these and so is the strip of accented letters, and they are the same thing on the screen because they are the same thing to read.
The middle line is a reference: what the letter is supposed to look like, from a font that is not the one being edited, right above the one that is.
Definition in file cell.h.
| int gpf_cell_at | ( | const struct gpf_cell * | self, |
| unsigned int | cols, | ||
| unsigned int | rows, | ||
| gp_coord | x, | ||
| gp_coord | y ) |
Finds the cell under a point.
| self | A cell. |
| cols | The grid width in cells. |
| rows | The grid height in cells. |
| x | A pixmap x coordinate. |
| y | A pixmap y coordinate. |
Definition at line 69 of file cell.c.
References gpf_cell::w, and gpf_cell::x0.
| void gpf_cell_center | ( | struct gpf_cell * | self, |
| const gp_pixmap * | p, | ||
| unsigned int | cols, | ||
| unsigned int | rows ) |
Centres a grid of cells in a pixmap.
A pixmap is sized by the layout and a cell by the font, so the one is rarely a whole number of the other, and the slack is split on both sides rather than left as a strip on the right and at the bottom. The positions the cells are drawn at stay relative to the grid; the drawing adds the origin.
| self | A cell, its origin is set. |
| p | The pixmap the grid is drawn into. |
| cols | The grid width in cells. |
| rows | The grid height in cells. |
Definition at line 61 of file cell.c.
References GPF_MAX, gpf_cell::w, and gpf_cell::x0.
| void gpf_cell_draw | ( | gp_pixmap * | p, |
| const gp_widget_render_ctx * | ctx, | ||
| const struct gpf_cell * | self, | ||
| int | x, | ||
| int | y, | ||
| uint32_t | code ) |
Draws a glyph cell.
The codepoint, dimmed when the font has not got the glyph, inverted when the variant has an entry of its own and red when that entry is modified; then the character as the widget font draws it, then the glyph as the variant being edited resolves it, centred on its advance.
| p | The pixmap to draw into. |
| ctx | The widget render context. |
| self | A cell. |
| x | The cell x offset relative to the grid origin. |
| y | The cell y offset relative to the grid origin. |
| code | The glyph codepoint. |
Definition at line 215 of file cell.c.
References gpf_resolved::glyph, gpf_resolve(), gpf_resolved_clear(), and gpf_cell::x0.
| void gpf_cell_draw_glyph | ( | gp_pixmap * | p, |
| const gp_widget_render_ctx * | ctx, | ||
| const struct gpf_cell * | self, | ||
| int | x, | ||
| int | y, | ||
| uint32_t | code, | ||
| const struct gpf_glyph * | glyph ) |
Draws a glyph cell with the ink handed to it.
The same cell with the ink handed to it instead of resolved: the compose view draws a letter that is not in the font, as it would come out with the accent that is being edited on it. The codepoint above it still says what the font holds, which is not the same question.
| p | The pixmap to draw into. |
| ctx | The widget render context. |
| self | A cell. |
| x | The cell x offset relative to the grid origin. |
| y | The cell y offset relative to the grid origin. |
| code | The codepoint the label is drawn for. |
| glyph | The ink to draw. |
Definition at line 228 of file cell.c.
References gpf_resolved::glyph, gpf_resolve(), gpf_resolved_clear(), and gpf_cell::x0.
| void gpf_cell_grid | ( | gp_pixmap * | p, |
| const gp_widget_render_ctx * | ctx, | ||
| const struct gpf_cell * | self, | ||
| unsigned int | cols, | ||
| unsigned int | rows ) |
Draws the lines between the cells of a grid.
| p | The pixmap to draw into. |
| ctx | The widget render context. |
| self | A cell. |
| cols | The grid width in cells. |
| rows | The grid height in cells. |
Definition at line 241 of file cell.c.
References gpf_cell::w, and gpf_cell::x0.
| void gpf_cell_init | ( | struct gpf_cell * | self, |
| const gp_widget_render_ctx * | ctx, | ||
| unsigned int | max_h ) |
Sizes a cell for the current font and zoom.
The glyph box comes from the ink extent of the whole font plus the theme's padding, not from the ascent and the descent, so that an accent over a capital is not cut off.
| self | A cell to fill in. |
| ctx | The widget render context. |
| max_h | Zero means "as much as you like", anything else caps the zoom so that the cell fits it. |
Definition at line 13 of file cell.c.
References gpf_cell::bg, gpf_family_meta::em, gpf_font_ink_extent(), GPF_MAX, GPF_MIN, gpf_cell::label_h, gpf_font::meta, gpf_cell::pad, gpf_cell::ref_h, gpf_cell::top, gpf_cell::w, gpf_cell::x0, and gpf_cell::zoom.