|
gpforge
An advanced bitmap font editor
|
The editor state and the functions everything in the GUI goes through. More...
#include <widgets/gp_widgets.h>#include "font.h"#include "resolve.h"#include "face.h"#include "undo.h"#include "unicode_blocks.h"Go to the source code of this file.
Data Structures | |
| struct | gpf_block_sel |
| The glyph selected last in a block, to go back to when the block is switched to again. More... | |
| struct | gpf_gui |
| The editor state. More... | |
Functions | |
| const gp_font_face * | gpf_gui_face (enum gpf_variant_id id) |
| The resolved variant compiled into a gfxprim face. | |
| void | gpf_gui_invalidate (void) |
| Throws the compiled faces away. | |
| void | gpf_gui_select (uint32_t code) |
| Selects a glyph and turns the table to it. | |
| void | gpf_gui_select_keep (uint32_t code) |
| Selects a glyph without moving the table to it. | |
| void | gpf_gui_create_glyph (uint32_t code) |
| Creates a glyph the font has not got. | |
| void | gpf_gui_pixel_set (int col, int height, int set) |
| Sets or clears a pixel of the glyph being edited. | |
| unsigned int | gpf_gui_accented (uint32_t *codes, unsigned int max) |
| The accented letters that follow the glyph being edited. | |
| void | gpf_gui_set_block (unsigned int block) |
| Selects a block and turns the table to its first page. | |
| gp_pixel | gpf_gui_back_color (gp_widget *self) |
| The color a widget is drawn on. | |
| void | gpf_gui_set_canvas_zoom (unsigned int zoom) |
| Sets the canvas zoom and the spinner that shows it. | |
| void | gpf_gui_sync_block (unsigned int block) |
| Makes the block selector follow the table. | |
| void | gpf_gui_set_variant (enum gpf_variant_id id) |
| Switches the variant being edited. | |
| void | gpf_gui_move_variant (int offset) |
| Moves the current variant in the variant ordering. | |
| void | gpf_gui_redraw (void) |
| Repaints everything that shows the font. | |
| const struct gpf_ucode_block * | gpf_gui_blocks (void) |
| The block list, built on demand. | |
| const struct gpf_ucode_block * | gpf_gui_block (void) |
| The block being browsed. | |
| void | gpf_gui_set_dirty (int dirty) |
| Marks the font as changed or as written. | |
| int | gpf_gui_modified (uint32_t code) |
| Whether the glyph has changed since the font was written. | |
| struct gpf_glyph * | gpf_gui_edit_glyph (void) |
| The glyph entry to edit in the current variant. | |
| struct gpf_glyph * | gpf_gui_edit_code (uint32_t code) |
| The glyph entry to edit, for any glyph. | |
| void | gpf_gui_shift (int dx, int dy) |
| Moves the ink of the glyph being edited. | |
| void | gpf_gui_edit_begin (void) |
| Starts an edit, one undo entry. | |
| void | gpf_gui_edit_commit (void) |
| Commits the edit started by gpf_gui_edit_begin() and repaints. | |
| void | gpf_gui_edited (void) |
| The font changed. | |
| void | gpf_pixmap_resize (gp_widget_event *ev) |
| Allocates the backing pixmap on a resize. | |
Variables | |
| struct gpf_gui | gui |
| The editor state. | |
The editor state and the functions everything in the GUI goes through.
The state is one global, gui, and the functions here, implemented in gpforge.c, are the funnels the widgets change it through: selecting, editing and redrawing. The widgets themselves have headers of their own, see browser.h, canvas.h, preview.h and cell.h, and so do the dialogs.
The editor runs with no font open, gpf_gui::font is NULL then, and it is the GUI that checks for it, never the model.
Definition in file gui.h.
| unsigned int gpf_gui_accented | ( | uint32_t * | codes, |
| unsigned int | max ) |
The accented letters that follow the glyph being edited.
The ones the font has, when the update box is ticked; editing Á does not drag À along, only the letter they are both accented forms of does.
| codes | An array to fill in. |
| max | The size of the array. |
Definition at line 458 of file gpforge.c.
References gpf_resolve(), and gpf_resolved_clear().
| gp_pixel gpf_gui_back_color | ( | gp_widget * | self | ) |
| const struct gpf_ucode_block * gpf_gui_block | ( | void | ) |
The block being browsed.
Definition at line 78 of file gpforge.c.
References gpf_gui_blocks().
| const struct gpf_ucode_block * gpf_gui_blocks | ( | void | ) |
The block list, built on demand.
Definition at line 67 of file gpforge.c.
References gpf_blocks_build().
Referenced by gpf_browser_show_sel(), and gpf_gui_block().
| void gpf_gui_create_glyph | ( | uint32_t | code | ) |
Creates a glyph the font has not got.
Draws it once, as ink: its base with the accent this font draws on it. From then on it is an ordinary glyph. Clicking an empty slot of the accented letters strip is what asks for it.
| code | A codepoint of an accented letter. |
Definition at line 641 of file gpforge.c.
References gpf_decomposition::code, gpf_decompose(), gpf_gui_edit_begin(), gpf_gui_edit_commit(), gpf_gui_edited(), and GPF_VARIANTS.
| void gpf_gui_edit_begin | ( | void | ) |
Starts an edit, one undo entry.
Journals nothing with no font open.
Definition at line 664 of file gpforge.c.
Referenced by gpf_gui_create_glyph(), and gpf_gui_shift().
| struct gpf_glyph * gpf_gui_edit_code | ( | uint32_t | code | ) |
The glyph entry to edit, for any glyph.
The same as gpf_gui_edit_glyph(), and it retargets the pending journal entry, so that an edit that lands on another glyph is undoable and marked as modified.
| code | A codepoint. |
Definition at line 443 of file gpforge.c.
References gpf_glyph::code.
| struct gpf_glyph * gpf_gui_edit_glyph | ( | void | ) |
The glyph entry to edit in the current variant.
An inherited or derived glyph is materialized here, which is what creating an overlay is, and a glyph the font does not have yet starts empty.
Definition at line 448 of file gpforge.c.
Referenced by gpf_gui_pixel_set(), and gpf_gui_shift().
| void gpf_gui_edited | ( | void | ) |
The font changed.
The faces are stale, the display is stale, the file is dirty.
Definition at line 732 of file gpforge.c.
References gpf_gui_invalidate(), and gpf_gui_redraw().
Referenced by gpf_gui_create_glyph(), gpf_gui_pixel_set(), and gpf_gui_shift().
| const gp_font_face * gpf_gui_face | ( | enum gpf_variant_id | id | ) |
The resolved variant compiled into a gfxprim face.
Built on demand and kept until gpf_gui_invalidate().
| id | A variant. |
Definition at line 46 of file gpforge.c.
References gpf_gui::faces, and GPF_VARIANTS.
| void gpf_gui_invalidate | ( | void | ) |
Throws the compiled faces away.
Called when the font changes. The block list is kept, it only changes with the set of glyphs the font has.
Definition at line 57 of file gpforge.c.
References GPF_VARIANTS.
Referenced by gpf_gui_edited().
| int gpf_gui_modified | ( | uint32_t | code | ) |
Whether the glyph has changed since the font was written.
The entry that says so is the one the ink comes from, which in a variant that inherits it is the parent's.
| code | A codepoint. |
Definition at line 712 of file gpforge.c.
References gpf_glyph::code, gpf_variant_glyph(), and gpf_resolved::ink_from.
| void gpf_gui_move_variant | ( | int | offset | ) |
Moves the current variant in the variant ordering.
| offset | How much the variant should be moved. |
Definition at line 967 of file gpforge.c.
References GPF_VARIANTS.
| void gpf_gui_pixel_set | ( | int | col, |
| int | height, | ||
| int | set ) |
Sets or clears a pixel of the glyph being edited.
The same pixel of the accented letters that follow it is set too, a carbon copy, see gpf_gui_accented(). This is what every pixel edit goes through.
| col | A column counted from the glyph origin. |
| height | A height from the baseline, positive up. |
| set | A value to set the pixel to, 0 or 1. |
Definition at line 488 of file gpforge.c.
References gpf_gui_edit_glyph(), gpf_gui_edited(), and gpf_glyph::height.
| void gpf_gui_redraw | ( | void | ) |
Repaints everything that shows the font.
During a stroke only the canvas and the accented letters strip are repainted, the rest waits for the commit.
Definition at line 762 of file gpforge.c.
Referenced by gpf_gui_edit_commit(), gpf_gui_edited(), gpf_gui_set_block(), and gpf_gui_set_variant().
| void gpf_gui_select | ( | uint32_t | code | ) |
Selects a glyph and turns the table to it.
| code | A codepoint. |
Definition at line 872 of file gpforge.c.
References gpf_block_sel::code.
| void gpf_gui_select_keep | ( | uint32_t | code | ) |
Selects a glyph without moving the table to it.
Picking one out of the accented letters strip must not throw away the page you were working on.
| code | A codepoint. |
Definition at line 877 of file gpforge.c.
References gpf_block_sel::code.
| void gpf_gui_set_block | ( | unsigned int | block | ) |
Selects a block and turns the table to its first page.
| block | An index into the block list. |
Definition at line 882 of file gpforge.c.
References gpf_gui_redraw().
| void gpf_gui_set_canvas_zoom | ( | unsigned int | zoom | ) |
| void gpf_gui_set_dirty | ( | int | dirty | ) |
| void gpf_gui_set_variant | ( | enum gpf_variant_id | id | ) |
Switches the variant being edited.
| id | A variant. |
Definition at line 957 of file gpforge.c.
References gpf_gui_redraw(), and gpf_variant::id.
| void gpf_gui_shift | ( | int | dx, |
| int | dy ) |
Moves the ink of the glyph being edited.
The accented letters that follow it move along with it.
| dx | An x offset, positive right. |
| dy | An y offset, positive up. |
Definition at line 1996 of file gpforge.c.
References gpf_glyph::dx, gpf_gui_edit_begin(), gpf_gui_edit_commit(), gpf_gui_edit_glyph(), and gpf_gui_edited().
| void gpf_gui_sync_block | ( | unsigned int | block | ) |
Makes the block selector follow the table.
Unlike gpf_gui_set_block() it leaves the page alone, it is called when the selection moved into another block.
| block | An index into the block list. |