Index: rnd_inclib/font/font.h =================================================================== --- rnd_inclib/font/font.h (nonexistent) +++ rnd_inclib/font/font.h (revision 36461) @@ -0,0 +1,60 @@ +/* + * COPYRIGHT + * + * librnd, modular 2D CAD framework + * librnd Copyright (C) 2022 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/librnd + * lead developer: http://repo.hu/projects/librnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + * + */ + +#ifndef RND_FONT_H +#define RND_FONT_H + +#include +#include +#include +#include + +typedef struct rnd_font_s { /* complete set of symbols */ + rnd_coord_t MaxHeight, MaxWidth; /* maximum cell width and height */ + rnd_box_t DefaultSymbol; /* the default symbol is a filled box */ + pcb_symbol_t Symbol[PCB_MAX_FONTPOSITION + 1]; + char *name; + pcb_font_id_t id; +} rnd_font_t; + + +void rnd_font_set_info(rnd_font_t *dst); + +rnd_glyph_line_t *rnd_font_new_line_in_glyph(rnd_glyph_t *glyph, rnd_coord_t x1, rnd_coord_t y1, rnd_coord_t x2, rnd_coord_t y2, rnd_coord_t thickness); +rnd_glyph_arc_t *rnd_font_new_arc_in_glyph(rnd_glyph_t *glyph, rnd_coord_t cx, rnd_coord_t cy, rnd_coord_t r, rnd_angle_t start, rnd_angle_t delta, rnd_coord_t thickness); +rnd_glyph_poly_t *rnd_font_new_poly_in_glyph(rnd_glyph_t *glyph, int num_points); + +void rnd_font_free(rnd_font_t *f); + +/* Remove all content (atoms and geometry, except for ->height) of + the glyph and mark it invalid */ +void rnd_font_clear_glyph(rnd_glyph_t *g); + + + +#endif + Index: rnd_inclib/font/glyph.h =================================================================== --- rnd_inclib/font/glyph.h (nonexistent) +++ rnd_inclib/font/glyph.h (revision 36461) @@ -0,0 +1,79 @@ +/* + * COPYRIGHT + * + * librnd, modular 2D CAD framework + * librnd Copyright (C) 2022 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/librnd + * lead developer: http://repo.hu/projects/librnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + * + */ + +#ifndef RND_GLYPH_ATOM_H +#define RND_GLYPH_ATOM_H + +#include +#include +#include +#include + +typedef enum rnd_glyph_atom_type_e { + RND_GLYPH_LINE, + RND_GLYPH_ARC, + RND_GLYPH_POLY +} rnd_glyph_atom_type_t; + +typedef struct rnd_glyph_line_s { + rnd_glyph_atom_type_t type; + rnd_coord_t x1, y1, x2, y2; + rnd_coord_t thickness; +} rnd_glyph_line_t; + +typedef struct rnd_glyph_arc_s { + rnd_glyph_atom_type_t type; + rnd_coord_t cx, cy, r; + rnd_coord_t thickness; + rnd_angle_t start, delta; /* in deg */ +} rnd_glyph_arc_t; + +typedef struct rnd_glyph_poly_s { + rnd_glyph_atom_type_t type; + vtc0_t xy; /* odd: x, even: y */ +} rnd_glyph_poly_t; + +typedef union rnd_glyph_atom_s { + rnd_glyph_atom_type_t type; + rnd_glyph_line_t line; + rnd_glyph_arc_t arc; + rnd_glyph_poly_t poly; +} rnd_glyph_atom_t; + + +#include + +typedef struct rnd_glyph_s { + unsigned valid:1; + rnd_coord_t width, height; /* total size of glyph */ + rnd_coord_t xdelta; /* distance to next symbol */ + vtgla_t atoms; +} rnd_glyph_t; + + +#endif + Index: rnd_inclib/font/vtgla.c =================================================================== --- rnd_inclib/font/vtgla.c (nonexistent) +++ rnd_inclib/font/vtgla.c (revision 36461) @@ -0,0 +1,3 @@ +#define RND_VTGLA_C +#include +#include Index: rnd_inclib/font/vtgla.h =================================================================== --- rnd_inclib/font/vtgla.h (nonexistent) +++ rnd_inclib/font/vtgla.h (revision 36461) @@ -0,0 +1,13 @@ +#define GVT(x) vtgla_ ## x +#define GVT_ELEM_TYPE rnd_glyph_atom_t +#define GVT_SIZE_TYPE size_t +#define GVT_DOUBLING_THRS 128 +#define GVT_START_SIZE 8 +#define GVT_FUNC +#include +#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) +#define GVT_FREE(vect, ptr) free(ptr) + +#ifndef RND_VTGLA_C +#include +#endif