diff options
author | Henry Stiles <henry.stiles@artifex.com> | 2010-06-28 06:13:11 +0000 |
---|---|---|
committer | Henry Stiles <henry.stiles@artifex.com> | 2010-06-28 06:13:11 +0000 |
commit | b672f953f1a42b32c5592817368180fce9c3c9c4 (patch) | |
tree | 4ec4b2978c58906e39cd20e944e2475dd34aa646 /pxl | |
parent | 5c6e66705c5d8be9be1d6cc5ab1921b9811c9f40 (diff) |
Finish up bug 691362, PXL PCLSelectFont attribute not handled. The
scaling was not correct, we want to use the exact same code used in
the pcl interpreter to scale fonts then that scaling value is
converted to PCL XL user units. The code has been refactored to share
the the PCL font scaling code and support for converting the pcl font
size in centipoints to the 3 user unit types in PCL XL has been added.
C706.BIN should print correctly now. A bit more warning cleanup is
needed in this new code.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11437 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'pxl')
-rw-r--r-- | pxl/pxl.mak | 2 | ||||
-rw-r--r-- | pxl/pxpthr.c | 48 |
2 files changed, 25 insertions, 25 deletions
diff --git a/pxl/pxl.mak b/pxl/pxl.mak index 7f718aef5..3f61145a9 100644 --- a/pxl/pxl.mak +++ b/pxl/pxl.mak @@ -110,7 +110,7 @@ $(PXLOBJ)pxpthr.$(OBJ): $(PXLSRC)pxpthr.c $(AK) \ $(gsstate_h) $(gscoord_h) $(gspath_h) $(gstypes_h) $(gsdevice_h)\ $(pcommand_h) $(pgmand_h) $(pcstate_h) $(pcparse_h) $(pctop_h)\ $(pcpage_h) $(pxstate_h) $(pxoper_h) $(stdio__h) $(pxpthr_h)\ - $(pxparse_h) $(pxgstate_h) $(pcdraw_h) $(gsicc_manage_h) + $(pxparse_h) $(pxgstate_h) $(pcdraw_h) $(pcfont_h) $(gsicc_manage_h) $(PXLCCC) $(PXLSRC)pxpthr.c $(PXLO_)pxpthr.$(OBJ) $(PXLOBJ)pxvalue.$(OBJ): $(PXLSRC)pxvalue.c $(AK) $(std_h) $(gsmemory_h) $(pxvalue_h) diff --git a/pxl/pxpthr.c b/pxl/pxpthr.c index 9a57395b6..9acc51f53 100644 --- a/pxl/pxpthr.c +++ b/pxl/pxpthr.c @@ -23,6 +23,7 @@ #include "pcommand.h" #include "pgmand.h" #include "pcstate.h" +#include "pcfont.h" #include "pcparse.h" #include "pctop.h" #include "pcpage.h" @@ -345,11 +346,7 @@ int pxpcl_selectfont(px_args_t *par, px_state_t *pxs) uint len = pstr->value.array.size; px_gstate_t *pxgs = pxs->pxgs; pcl_font_selection_t *pfp; - float ppi; - float scale; - /* NB move these to a header file */ - extern void set_symbol_map(px_state_t *pxs, bool wide16); - extern bool pcl_downloaded_and_bound(pl_font_t *plfont); + if ( !global_pcs ) pxPassthrough_init(pxs); @@ -373,25 +370,33 @@ int pxpcl_selectfont(px_args_t *par, px_state_t *pxs) if (code < 0) return code; pfp = &global_pcs->font_selection[global_pcs->font_selected]; - ppi = (pfp->font->scaling_technology == plfst_Intellifont) ? 72.307 : 72.0; - if (pfp->font->params.proportional_spacing) + { - scale = (pfp->params.height_4ths * 0.25) * pxs->units_per_measure.x / ppi; +#define CP_PER_INCH (7200.0) +#define CP_PER_MM (7200.0/25.4) +#define CP_PER_10ths_of_MM (CP_PER_MM/10.0) + + static const floatp centipoints_per_measure[4] = { + CP_PER_INCH, /* eInch */ + CP_PER_MM, /* eMillimeter */ + CP_PER_10ths_of_MM, /* eTenthsOfAMillimeter */ + 1 /* pxeMeasure_next, won't reach */ + }; + + gs_point sz; + pcl_font_scale(global_pcs, &sz); + pxgs->char_size = sz.x / + centipoints_per_measure[pxs->measure] * + pxs->units_per_measure.x; } - else - { - scale = 1200.0 / (pfp->params.pitch.per_inch_x100 / 100.0) * (72.0 / ppi); + pxgs->symbol_set = pfp->params.symbol_set; - /* hack for a scalable lineprinter font. If a real - lineprinter bitmap font is available it will be handled - by the bitmap scaling case above */ - if (pfp->font->params.typeface_family == 0) { - scale = 850.0; - } + if (pcl_downloaded_and_bound(global_pcs->font)) { + pxgs->symbol_map = 0; + } else { + set_symbol_map(pxs, global_pcs->font->font_type == plft_16bit); } - pxgs->char_size = scale; - pxgs->symbol_set = pfp->params.symbol_set; { pl_font_t *plf = global_pcs->font; @@ -409,11 +414,6 @@ int pxpcl_selectfont(px_args_t *par, px_state_t *pxs) pxgs->base_font = (px_font_t *)plf; } - if (pcl_downloaded_and_bound(global_pcs->font)) { - pxgs->symbol_map = 0; - } else { - set_symbol_map(pxs, global_pcs->font->font_type == plft_16bit); - } pxgs->char_matrix_set = false; return 0; } |