summaryrefslogtreecommitdiff
path: root/pxl
diff options
context:
space:
mode:
authorStefan Kemper <stefan.kemper@artifex.com>2002-03-05 01:06:00 +0000
committerStefan Kemper <stefan.kemper@artifex.com>2002-03-05 01:06:00 +0000
commit720f864507ca73cf7a3689948a5571c18290699e (patch)
tree32f64d021a6fd81ba5d668ce9ed6b5129427c36a /pxl
parentdf1defd2cb266f31fdde0b8f6682de354b91a21a (diff)
downloadghostpdl-720f864507ca73cf7a3689948a5571c18290699e.tar.gz
Invalidate the character cache whenever pxl algorithmic bolding is used.
This force is done to prevent false cache hits on bolding changed chars. git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@1613 06663e23-700e-0410-b217-a244a6096597
Diffstat (limited to 'pxl')
-rw-r--r--pxl/pxfont.c6
-rw-r--r--pxl/pxgstate.h3
-rw-r--r--pxl/pxsessio.c14
3 files changed, 19 insertions, 4 deletions
diff --git a/pxl/pxfont.c b/pxl/pxfont.c
index 369e464a1..82687f666 100644
--- a/pxl/pxfont.c
+++ b/pxl/pxfont.c
@@ -360,6 +360,12 @@ px_text(px_args_t *par, px_state_t *pxs, bool to_path)
{
pl_font_t *plfont = (pl_font_t *)pfont->client_data;
plfont->bold_fraction = pxgs->char_bold_value * 1.625;
+ /* we have to invalidate the cache for algorithmic bolding
+ or vertical substitutes. For the agfa scaler in
+ particular there is no way of determining if the
+ metrics are different resulting in false cache hits */
+ if ( plfont->bold_fraction != 0 || pfont->WMode != 0 )
+ px_purge_character_cache(pxs);
}
if ( to_path )
{ /* TextPath */
diff --git a/pxl/pxgstate.h b/pxl/pxgstate.h
index 3fbca150c..adbee3539 100644
--- a/pxl/pxgstate.h
+++ b/pxl/pxgstate.h
@@ -71,6 +71,9 @@ typedef struct px_pattern_s {
void px_free_pattern(P3(gs_memory_t *, void *, client_name_t));
/* Purge the pattern cache up to a given persistence level. */
void px_purge_pattern_cache(P2(px_state_t *, pxePatternPersistence_t));
+/* purge font cache - all characters */
+void px_purge_character_cache(px_state_t *pxs);
+
/* Define a structure for a brush or pen. These only exist */
/* within a px_gstate_t; they are never allocated separately. */
diff --git a/pxl/pxsessio.c b/pxl/pxsessio.c
index 9105c6e28..a39673449 100644
--- a/pxl/pxsessio.c
+++ b/pxl/pxsessio.c
@@ -175,12 +175,13 @@ purge_all(cached_char *cc, void *dummy)
return true;
}
+/* clears the entire cache */
/* Clean up at the end of a session. */
private void
px_end_session_cleanup(px_state_t *pxs)
{ if ( pxs->data_source_open )
pxCloseDataSource(NULL, pxs);
- gx_purge_selected_cached_chars(pxs->font_dir, purge_all, pxs);
+ px_purge_character_cache(pxs);
px_dict_release(&pxs->session_pattern_dict);
px_purge_pattern_cache(pxs, eSessionPattern);
/* We believe that streams do *not* persist across sessions.... */
@@ -190,8 +191,7 @@ px_end_session_cleanup(px_state_t *pxs)
/* ---------------- Non-operator procedures ---------------- */
/* Clean up after an error or UEL. */
-void
-px_state_cleanup(px_state_t *pxs)
+void px_state_cleanup(px_state_t *pxs)
{ px_end_page_cleanup(pxs);
px_end_session_cleanup(pxs);
pxs->have_page = false;
@@ -199,10 +199,16 @@ px_state_cleanup(px_state_t *pxs)
void px_font_cleanup(px_state_t *pxs)
{
- gx_purge_selected_cached_chars(pxs->font_dir, purge_all, pxs);
+ px_purge_character_cache(pxs);
px_dict_release(&pxs->font_dict);
}
+void px_purge_character_cache(px_state_t *pxs)
+{
+ gx_purge_selected_cached_chars(pxs->font_dir, purge_all, pxs);
+ return 0;
+}
+
/* ---------------- Operators ---------------- */
const byte apxBeginSession[] = {