summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2010-01-15 20:19:22 +0000
committerHenry Stiles <henry.stiles@artifex.com>2010-01-15 20:19:22 +0000
commit29e03e575f93d1222ee56d229b920ad77c0c6399 (patch)
tree9055f3f967c63507e93a56ad0979afa2932c9688
parent79cec314a296c9a48049366596f83a0811428130 (diff)
Add support to select fonts and exclude downloaded fonts from the
candidate fonts. This will be used to support pcl unstyled characters, internal font characters that can be substituted for missing characters in a downloaded font. git-svn-id: http://svn.ghostscript.com/ghostscript/branches/pcl_font_mods@10613 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r--pcl/pcfont.c6
-rw-r--r--pcl/pcfont.h4
-rw-r--r--pcl/pcfsel.c11
-rw-r--r--pcl/pcfsel.h2
-rw-r--r--pcl/pcsfont.c2
-rw-r--r--pcl/pctext.c2
-rw-r--r--pcl/pcursor.c2
-rw-r--r--pcl/pglabel.c2
8 files changed, 18 insertions, 13 deletions
diff --git a/pcl/pcfont.c b/pcl/pcfont.c
index 93802e2d5..9510d52d4 100644
--- a/pcl/pcfont.c
+++ b/pcl/pcfont.c
@@ -85,9 +85,9 @@ pcl_set_font(pcl_state_t *pcs, pcl_font_selection_t *pfs)
/* Recompute the current font from the descriptive parameters. */
/* This is exported for resetting HMI. */
int
-pcl_recompute_font(pcl_state_t *pcs)
+pcl_recompute_font(pcl_state_t *pcs, bool internal_only)
{ pcl_font_selection_t *pfs = &pcs->font_selection[pcs->font_selected];
- int code = pcl_reselect_font(pfs, pcs);
+ int code = pcl_reselect_font(pfs, pcs, internal_only);
if ( code < 0 )
return code;
@@ -315,7 +315,7 @@ pcl_select_default_font(pcl_args_t *pargs, pcl_state_t *pcs, int set)
pcs->font_selection[set].params.typeface_family = 3; /* courier */
pcs->font_selection[set].font = 0; /* not looked up yet */
pcl_decache_font(pcs, set);
- return e_Unimplemented;
+ return 0;
}
static int /* ESC ( 3 @ */
pcl_select_default_font_primary(pcl_args_t *pargs, pcl_state_t *pcs)
diff --git a/pcl/pcfont.h b/pcl/pcfont.h
index ae436354b..e0c12b7e9 100644
--- a/pcl/pcfont.h
+++ b/pcl/pcfont.h
@@ -27,9 +27,9 @@
void pcl_decache_font(pcl_state_t * pcs, int set);
/*
- * Recompute the font if necessary. This is exported for resetting HMI.
+ * Recompute the font if necessary.
*/
-int pcl_recompute_font(pcl_state_t * pcs);
+int pcl_recompute_font(pcl_state_t * pcs, bool internal_only);
/*
* Do any underlining just before a break in motion (vertical motion or
diff --git a/pcl/pcfsel.c b/pcl/pcfsel.c
index f275adf3d..879720c9a 100644
--- a/pcl/pcfsel.c
+++ b/pcl/pcfsel.c
@@ -145,8 +145,10 @@ check_support(const pcl_state_t *pcs, uint symbol_set, const pl_font_t *fp,
gv = pl_complement_to_vocab(fp->character_complement);
*mapp = pcl_find_symbol_map(pcs, id, gv);
if ( *mapp == 0 ) {
- /* Default to Roman 8: 277 0x115 not the default symbol set!
- * Basically roman8
+ /*
+ * Interestingly, if we look up a symbol set that does not
+ * exist the default symbol set is replaced with roman-8.
+ * This is certainly a bug in HP printers.
*/
id[0] = 0x01;
id[1] = 0x15;
@@ -339,7 +341,7 @@ score_match(const pcl_state_t *pcs, const pcl_font_selection_t *pfs,
/* Recompute the current font from the descriptive parameters. */
/* This is used by both PCL and HP-GL/2. */
int
-pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs)
+pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs, bool internal_only)
{ if ( pfs->font == 0 )
{ pl_dict_enum_t dictp;
gs_const_string key;
@@ -393,6 +395,9 @@ pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs)
while ( pl_dict_enum_next(&dictp, &key, &value) )
{ pl_font_t *fp = (pl_font_t *)value;
match_score_t match;
+ if ((internal_only) && fp->storage != pcds_internal)
+ continue;
+
score_match(pcs, pfs, fp, &mapp, match);
#ifdef DEBUG
if ( gs_debug_c('=') ) {
diff --git a/pcl/pcfsel.h b/pcl/pcfsel.h
index 20617facc..605f74a4f 100644
--- a/pcl/pcfsel.h
+++ b/pcl/pcfsel.h
@@ -22,7 +22,7 @@
/* Recompute the font from the parameters if necessary. */
/* This is used by both PCL and HP-GL/2. */
-int pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs);
+int pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs, bool intenal_only);
/*
* Select a font by ID, updating the selection parameters. Return 0
diff --git a/pcl/pcsfont.c b/pcl/pcsfont.c
index 81721510a..adb166e66 100644
--- a/pcl/pcsfont.c
+++ b/pcl/pcsfont.c
@@ -187,7 +187,7 @@ pcl_font_control(pcl_args_t *pargs, pcl_state_t *pcs)
{
int code;
if ( pcs->font == 0 ) {
- code = pcl_recompute_font(pcs);
+ code = pcl_recompute_font(pcs, false);
if ( code < 0 )
return code;
}
diff --git a/pcl/pctext.c b/pcl/pctext.c
index 91ed3aff3..3ccf9b95e 100644
--- a/pcl/pctext.c
+++ b/pcl/pctext.c
@@ -615,7 +615,7 @@ pcl_text(
if (pcs->personality == rtl)
return 0;
/* set up the current font and HMI */
- if ((pcs->font == 0) && ((code = pcl_recompute_font(pcs)) < 0))
+ if ((pcs->font == 0) && ((code = pcl_recompute_font(pcs, false)) < 0))
return code;
/* set up the graphic state */
diff --git a/pcl/pcursor.c b/pcl/pcursor.c
index 052bdedaa..3aa50ddc0 100644
--- a/pcl/pcursor.c
+++ b/pcl/pcursor.c
@@ -392,7 +392,7 @@ pcl_updated_hmi(
coord hmi;
const pcl_font_selection_t * pfs =
&(pcs->font_selection[pcs->font_selected]);
- int code = pcl_recompute_font(pcs);
+ int code = pcl_recompute_font(pcs, false);
const pl_font_t * plfont = pcs->font;
if (code < 0)
diff --git a/pcl/pglabel.c b/pcl/pglabel.c
index a3eebcba5..7b7d93a74 100644
--- a/pcl/pglabel.c
+++ b/pcl/pglabel.c
@@ -239,7 +239,7 @@ hpgl_recompute_font(hpgl_state_t *pgls)
)
hpgl_call(hpgl_select_stick_font(pgls));
else
- { int code = pcl_reselect_font(pfs, pgls);
+ { int code = pcl_reselect_font(pfs, pgls, false);
if ( code < 0 )
return code;