Index: fontmode.c =================================================================== --- fontmode.c (revision 38522) +++ fontmode.c (revision 38523) @@ -176,13 +176,11 @@ } } -#ifdef PCB_WANT_FONT2 if ((s == 'i') || (s == 'q')) rnd_trace("delta1: %c w=%ld + %ld + %ld=%ld | adv: %d %ld + %ld = %ld\n", s, g->width, g->xdelta, ox, g->width + g->xdelta + ox, g->advance_valid, g->advance, ox, g->advance + ox); if (g->advance_valid) w = g->advance + ox; else -#endif w = g->width + g->xdelta + ox; pcb_line_new_merge(lwidth, w, miny + oy, w, maxy + oy, RND_MIL_TO_COORD(1), RND_MIL_TO_COORD(1), pcb_no_flags()); } @@ -286,7 +284,6 @@ ox = (s % 16 + 1) * CELL_SIZE; g = &font->glyph[s]; -#ifdef PCB_WANT_FONT2 g->advance = x1 - ox; g->advance_valid = 1; if (g->advance > 10) @@ -293,7 +290,7 @@ g->valid = 1; if ((s == 'i') || (s == 'q')) rnd_trace("delta2: %c w=%ld - %ld - %ld=%ld | adv: %ld - %ld = %ld\n", s, x1, ox, g->width, x1-ox-g->width, x1, ox, x1-ox); -#endif + x1 -= ox; g->xdelta = x1 - g->width; @@ -302,7 +299,6 @@ g->valid = 1; } -#ifdef PCB_WANT_FONT2 /* copy metadata */ if (orig_font != NULL) { rnd_font_copy_tables(font, orig_font); @@ -318,7 +314,6 @@ rnd_message(RND_MSG_ERROR, "Original font data not available, some metadata is lost\n(kerning, entities, baseline, tab/line size)\n"); rnd_message(RND_MSG_INFO, "Note: this typically happens if you save to board format\nfrom the font editor and load that board later\nPlease don't do that, it can't retain metadata.\n"); } -#endif rnd_font_normalize(font); } @@ -387,10 +382,8 @@ lwidth = make_layer(pcb, grp[2], "Width"); lgrid = make_layer(pcb, grp[3], "Grid"); -#ifdef PCB_WANT_FONT2 if (font->baseline > 0) lbaslin = make_layer(pcb, grp[3], "Baseline"); -#endif assert(pcb_layergrp_list(pcb, PCB_LYT_SILK, grp, 2) == 2); make_layer(pcb, grp[0], "Silk"); @@ -413,8 +406,6 @@ pcb_line_new_merge(lgrid, 0, y, pcb->hidlib.dwg.X2, y, RND_MIL_TO_COORD(1), RND_MIL_TO_COORD(1), pcb_no_flags()); } - -#ifdef PCB_WANT_FONT2 if (font->baseline > 0) { for (l = 0; l <= PCB_MAX_FONTPOSITION / 16 + 1; l++) { int y = (l + 1) * CELL_SIZE + font->baseline; @@ -421,7 +412,6 @@ pcb_line_new_merge(lbaslin, 0, y, pcb->hidlib.dwg.X2, y, RND_MIL_TO_COORD(0.25), RND_MIL_TO_COORD(1), pcb_no_flags()); } } -#endif RND_ACT_IRES(0); return 0; @@ -713,7 +703,6 @@ static const char pcb_acth_FontBaseline[] = "Change the baseline value and redraw. If there is no baseline, add baseline first."; static fgw_error_t pcb_act_FontBaseline(fgw_arg_t *res, int argc, fgw_arg_t *argv) { -#ifdef PCB_WANT_FONT2 pcb_board_t *pcb = PCB_ACT_BOARD; rnd_font_t *font = pcb_font(pcb, 0, 1); rnd_coord_t delta = 0; @@ -726,11 +715,6 @@ font->baseline = RND_MIL_TO_COORD(50); /* default value that works with the default font */ font->baseline += delta; return pcb_act_FontEdit(res, argc, argv); -#else - rnd_message(RND_MSG_ERROR, "FontBaseline() is not implemented until librnd 4.1.0 (font v2 support)\n"); - RND_ACT_IRES(-1); - return 0; -#endif } rnd_action_t fontmode_action_list[] = { Index: preview.c =================================================================== --- preview.c (revision 38522) +++ preview.c (revision 38523) @@ -33,20 +33,16 @@ #include "font.h" #define RND_TIMED_CHG_TIMEOUT 1000 -#ifdef PCB_WANT_FONT2 #include -#endif typedef struct{ RND_DAD_DECL_NOINIT(dlg) int wprev, wpend; -#ifdef PCB_WANT_FONT2 int wbaseline, wtab_width, wline_height, wentt, wkernt; unsigned geo_changed:1; unsigned ent_changed:1; unsigned kern_changed:1; rnd_timed_chg_t timed_refresh; -#endif int active; /* already open - allow only one instance */ unsigned char *sample; rnd_font_t font; @@ -63,9 +59,7 @@ { fmprv_ctx_t *ctx = caller_data; -#ifdef PCB_WANT_FONT2 rnd_timed_chg_cancel(&ctx->timed_refresh); -#endif rnd_font_free(&ctx->font); RND_DAD_FREE(ctx->dlg); @@ -77,16 +71,13 @@ rnd_font_free(&ctx->font); memset(&ctx->font, 0, sizeof(ctx->font)); /* clear any cache */ editor2font(PCB, &ctx->font, fontedit_src); -#ifdef PCB_WANT_FONT2 + ctx->font.baseline = fontedit_src->baseline; ctx->font.line_height = fontedit_src->line_height; ctx->font.tab_width = fontedit_src->tab_width; rnd_font_copy_tables(&ctx->font, fontedit_src); -#endif - } -#ifdef PCB_WANT_FONT2 static void fmprv_pcb2preview_geo(fmprv_ctx_t *ctx) { rnd_hid_attr_val_t hv; @@ -197,9 +188,7 @@ rnd_gui->attr_dlg_set_value(ctx->dlg_hid_ctx, ctx->wkernt, &hv); free(cursor_path); } - } -#endif static void fmprv_pcb2preview(fmprv_ctx_t *ctx) @@ -211,7 +200,6 @@ fmprv_pcb2preview_sample(ctx); -#ifdef PCB_WANT_FONT2 if (ctx->geo_changed) fmprv_pcb2preview_geo(ctx); if (ctx->ent_changed) @@ -219,8 +207,6 @@ if (ctx->kern_changed) fmprv_pcb2preview_kerning(ctx); -#endif - rnd_gui->attr_dlg_widget_hide(ctx->dlg_hid_ctx, ctx->wpend, 1); rnd_dad_preview_zoomto(&ctx->dlg[ctx->wprev], NULL); /* redraw */ } @@ -236,11 +222,7 @@ fmprv_ctx_t *ctx = prv->user_ctx; rnd_xform_t xform = {0}; pcb_draw_info_t info = {0}; -#ifdef PCB_WANT_FONT2 rnd_font_render_opts_t opts = RND_FONT_HTAB | RND_FONT_ENTITY | RND_FONT_MULTI_LINE; -#else - int opts = 0; -#endif info.xform = &xform; pcb_draw_setup_default_gui_xform(&xform); @@ -248,28 +230,19 @@ rnd_render->set_color(pcb_draw_out.fgGC, rnd_color_black); -#ifdef PCB_WANT_FONT2 rnd_font_draw_string(&ctx->font, ctx->sample, 0, 0, 1.0, 1.0, 0.0, opts, 0, 0, RND_FONT_TINY_ACCURATE, pcb_font_draw_atom, &info); -#else - rnd_font_draw_string(&ctx->font, ctx->sample, 0, 0, - 1.0, 1.0, 0.0, - opts, 0, 0, 0, RND_FONT_TINY_ACCURATE, pcb_font_draw_atom, &info); -#endif } static void timed_refresh(fmprv_ctx_t *ctx) { -#ifdef PCB_WANT_FONT2 rnd_gui->attr_dlg_widget_hide(ctx->dlg_hid_ctx, ctx->wpend, 0); rnd_timed_chg_schedule(&ctx->timed_refresh); -#endif } static void refresh_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *attr) { -#ifdef PCB_WANT_FONT2 fmprv_ctx_t *ctx = caller_data; int widx = attr - ctx->dlg; @@ -289,10 +262,8 @@ return; timed_refresh(ctx); -#endif } -#ifdef PCB_WANT_FONT2 typedef struct { char *name; rnd_coord_t val; @@ -523,9 +494,7 @@ edit2_kern(ctx, ed2, r->cell[0]); } -#endif - static void sample_text_changed_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *atxt) { fmprv_ctx_t *ctx = caller_data; @@ -579,9 +548,7 @@ if (fmprv_ctx.sample == NULL) fmprv_ctx.sample = (unsigned char *)rnd_strdup("Sample string\nin multiple\nlines."); -#ifdef PCB_WANT_FONT2 rnd_timed_chg_init(&fmprv_ctx.timed_refresh, fmprv_pcb2preview_timed, &fmprv_ctx); -#endif RND_DAD_BEGIN_VPANE(fmprv_ctx.dlg, "vert_main"); RND_DAD_BEGIN_VBOX(fmprv_ctx.dlg); @@ -602,9 +569,6 @@ RND_DAD_BEGIN_TABLE(fmprv_ctx.dlg, 2); /* geometry */ RND_DAD_COMPFLAG(fmprv_ctx.dlg, RND_HATF_EXPFILL); -#ifndef PCB_WANT_FONT2 - RND_DAD_LABEL(fmprv_ctx.dlg, "Not supported in font v1"); -#else RND_DAD_LABEL(fmprv_ctx.dlg, "Baseline:"); RND_DAD_COORD(fmprv_ctx.dlg); fmprv_ctx.wbaseline = RND_DAD_CURRENT(fmprv_ctx.dlg); @@ -617,14 +581,10 @@ RND_DAD_COORD(fmprv_ctx.dlg); fmprv_ctx.wtab_width = RND_DAD_CURRENT(fmprv_ctx.dlg); RND_DAD_CHANGE_CB(fmprv_ctx.dlg, refresh_cb); -#endif RND_DAD_END(fmprv_ctx.dlg); RND_DAD_BEGIN_VBOX(fmprv_ctx.dlg); /* entities */ RND_DAD_COMPFLAG(fmprv_ctx.dlg, RND_HATF_EXPFILL); -#ifndef PCB_WANT_FONT2 - RND_DAD_LABEL(fmprv_ctx.dlg, "Not supported in font v1"); -#else RND_DAD_TREE(fmprv_ctx.dlg, 2, 0, ent_hdr); RND_DAD_COMPFLAG(fmprv_ctx.dlg, RND_HATF_EXPFILL | RND_HATF_SCROLL); fmprv_ctx.wentt = RND_DAD_CURRENT(fmprv_ctx.dlg); @@ -637,14 +597,10 @@ RND_DAD_END(fmprv_ctx.dlg); RND_DAD_LABEL(fmprv_ctx.dlg, "(Key format: case sensitive entity name without the &; wrapping)"); -#endif RND_DAD_END(fmprv_ctx.dlg); RND_DAD_BEGIN_VBOX(fmprv_ctx.dlg); /* kerning */ RND_DAD_COMPFLAG(fmprv_ctx.dlg, RND_HATF_EXPFILL); -#ifndef PCB_WANT_FONT2 - RND_DAD_LABEL(fmprv_ctx.dlg, "Not supported in font v1"); -#else RND_DAD_TREE(fmprv_ctx.dlg, 2, 0, kern_hdr); RND_DAD_COMPFLAG(fmprv_ctx.dlg, RND_HATF_EXPFILL | RND_HATF_SCROLL); fmprv_ctx.wkernt = RND_DAD_CURRENT(fmprv_ctx.dlg); @@ -655,7 +611,6 @@ RND_DAD_CHANGE_CB(fmprv_ctx.dlg, kern_edit_cb); RND_DAD_LABEL(fmprv_ctx.dlg, "(Key format: char1-char2, e.g. A-V or &6b-V or &6b-&a1 in &hh hex glyph\nindex form; multiple keys: space separated list like a-b c-d e-f)"); RND_DAD_END(fmprv_ctx.dlg); -#endif RND_DAD_END(fmprv_ctx.dlg); RND_DAD_END(fmprv_ctx.dlg); @@ -667,9 +622,7 @@ RND_DAD_NEW("font_mode_preview", fmprv_ctx.dlg, "Font editor: preview", &fmprv_ctx, rnd_false, fmprv_close_cb); -#ifdef PCB_WANT_FONT2 fmprv_ctx.geo_changed = fmprv_ctx.ent_changed = fmprv_ctx.kern_changed = 1; -#endif fmprv_pcb2preview(&fmprv_ctx); }