From a10a03a4c9713b38c4cfcd07f0ba3c722778aae0 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 20 May 2020 11:23:18 +0100 Subject: Rejig plftable.h Rather than repeatedly including the same header to get multiple versions of the font table built in, build the font table just once with all the information in it. This should be smaller (fractionally), and stop lgtm.com complaining. --- pcl/pcl/pcfontpg.c | 6 +----- pcl/pcl/pcfsel.c | 23 +++++++---------------- 2 files changed, 8 insertions(+), 21 deletions(-) (limited to 'pcl/pcl') diff --git a/pcl/pcl/pcfontpg.c b/pcl/pcl/pcfontpg.c index 749bc3fe0..6542ae751 100644 --- a/pcl/pcl/pcfontpg.c +++ b/pcl/pcl/pcfontpg.c @@ -23,12 +23,8 @@ #include "pcstate.h" #include "pcursor.h" #include "pcommand.h" - -#define fontnames(agfascreenfontname, agfaname, urwname) urwname -#include "plftable.h" -#undef fontnames - #include "pllfont.h" +#include "plftable.h" /* utility procedure to print n blank lines */ static int diff --git a/pcl/pcl/pcfsel.c b/pcl/pcl/pcfsel.c index a17abbad1..88b16163c 100644 --- a/pcl/pcl/pcfsel.c +++ b/pcl/pcl/pcfsel.c @@ -23,6 +23,7 @@ #include "pcfont.h" #include "pcfsel.h" #include "pcsymbol.h" +#include "plftable.h" /* hack to avoid compiler message */ #ifndef abs @@ -86,19 +87,14 @@ dmprint_font_params_t(const gs_memory_t * mem, const pl_font_params_t * pfp) (0x07FF & pfp->typeface_family)); } -#include "plftable.h" - static void dmprint_ufst_font_name(const gs_memory_t * mem, const pl_font_t * pfont) { -#define fontnames(agfascreenfontname, agfaname, urwname) agfaname -#include "plftable.h" int i; bool found = false; - (void)pl_built_in_resident_font_table_count; - for (i = 0; strlen(resident_table[i].full_font_name); i++) { - if (!memcmp(&resident_table[i].params, + for (i = 0; *pl_built_in_resident_font_table[i].full_font_name[AGFANAME]; i++) { + if (!memcmp(&pl_built_in_resident_font_table[i].params, &pfont->params, sizeof(pfont->params))) { found = true; @@ -106,7 +102,7 @@ dmprint_ufst_font_name(const gs_memory_t * mem, const pl_font_t * pfont) } } if (found) { - dmprintf1(mem, "%s ", resident_table[i].full_font_name); + dmprintf1(mem, "%s ", pl_built_in_resident_font_table[i].full_font_name[AGFANAME]); } else { if (pfont->storage == pcds_internal) { dmprintf(mem, "internal font not found in resident table"); @@ -114,20 +110,16 @@ dmprint_ufst_font_name(const gs_memory_t * mem, const pl_font_t * pfont) } dmprintf(mem, "external font "); } -#undef fontnames } static void dmprint_font_name(const gs_memory_t * mem, const pl_font_t * pfont) { -#define fontnames(agfascreenfontname, agfaname, urwname) urwname -#include "plftable.h" int i; bool found = false; - (void)pl_built_in_resident_font_table_count; - for (i = 0; strlen(resident_table[i].full_font_name); i++) { - if (!memcmp(&resident_table[i].params, + for (i = 0; pl_built_in_resident_font_table[i].full_font_name[URWNAME]; i++) { + if (!memcmp(&pl_built_in_resident_font_table[i].params, &pfont->params, sizeof(pfont->params))) { found = true; @@ -135,7 +127,7 @@ dmprint_font_name(const gs_memory_t * mem, const pl_font_t * pfont) } } if (found) { - dmprintf1(mem, "%s ", resident_table[i].full_font_name); + dmprintf1(mem, "%s ", pl_built_in_resident_font_table[i].full_font_name[URWNAME]); } else { if (pfont->storage == pcds_internal) { dmprintf(mem, "internal font not found in resident table"); @@ -143,7 +135,6 @@ dmprint_font_name(const gs_memory_t * mem, const pl_font_t * pfont) } dmprintf(mem, "external font "); } -#undef fontnames } static void -- cgit v1.2.1