Bug 690589 - difference in fontmetrics AFS/UFST on certain fonts
Summary: difference in fontmetrics AFS/UFST on certain fonts
Status: NOTIFIED FIXED
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PCL fonts (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-02 03:37 UTC by norbert.janssen
Modified: 2011-09-18 21:46 UTC (History)
0 users

See Also:
Customer: 661
Word Size: ---


Attachments
metrictest.pcl (113 bytes, application/octet-stream)
2009-07-02 03:38 UTC, norbert.janssen
Details
metrictest.pcl (9.26 KB, application/octet-stream)
2009-07-02 08:33 UTC, norbert.janssen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description norbert.janssen 2009-07-02 03:37:30 UTC
When printing attached testfile (metricstest.pcl) with PL_SCALER afs/ufst
you see a difference in the metrics.
AFS has the same metrics as HP LJ.
UFST is too large.

The problem is probably that the font used (Arial in UFST is not recognized as
being a scaling_technology == plfst_TrueType in pctext.c::pcl_get_width()

The fix is to add a check on a few specific typefaces, to be compatible with the
HP LJ.
 static floatp
pcl_get_width(pcl_state_t *pcs, gs_point *advance_vector, const gs_point
*pscale, gs_char chr, bool is_space)
{
    pcl_font_selection_t *  pfp = &(pcs->font_selection[pcs->font_selected]);
    floatp width;
    if (chr != 0xffff) { 
	if (!pfp->params.proportional_spacing || is_space)
	    width = pcl_hmi(pcs);
	else {
	    if ( pcs->font->scaling_technology == plfst_TrueType
#ifdef HP_COMPATIBLE
		    ||
		((pfp->params.typeface_family & 0x0fff) == 218  || /* Arial */
		 (pfp->params.typeface_family & 0x0fff) == 517  || /* Times New Roman */
		 (pfp->params.typeface_family & 0x0fff) == 302  || /* Symbol */
		 (pfp->params.typeface_family & 0x0fff) == 2730    /* Wingdings */
		)
#endif
	       )
	    {
		floatp tmp;
		tmp = pscale->x / (floatp)pcs->uom_cp + 0.5;
		tmp -= fmod(tmp, (floatp)1.0);
		tmp *= (floatp)pcs->uom_cp;
		width = advance_vector->x * tmp;

	    } else
		width = advance_vector->x * pscale->x;
	    width += (floatp)pcs->uom_cp / 2.0;
	    width -= fmod(width, (floatp)pcs->uom_cp);
	}
    } else if (is_space)
	width = pcl_hmi(pcs);
    else
	width = 0.0;
    /* round to nearest integral pcl units */
    return width;
}
Comment 1 norbert.janssen 2009-07-02 03:38:51 UTC
Created attachment 5175 [details]
metrictest.pcl

testfile to show difference in fontmetrics when printing with AFS or UFST
Comment 2 Henry Stiles 2009-07-02 06:30:55 UTC
Was your test file extracted from a larger file that was a more complete metrics
test, if so could you post the complete file?
Comment 3 norbert.janssen 2009-07-02 08:33:49 UTC
Created attachment 5177 [details]
metrictest.pcl

all 79 PCL5 typefaces (no lineprinter).
Note when printing with AFS that the Wingdings seems to be the same as the
Dingbats.
Comment 4 Henry Stiles 2009-07-02 08:45:41 UTC
Yes AFS does not include wingdings for legal reasons.  Dingbats are substituted,
I haven't looked at your complete metrics file yet but I suspect the fix should
be as follows:

Index: pctext.c
===================================================================
--- pctext.c	(revision 9827)
+++ pctext.c	(working copy)
@@ -366,7 +366,8 @@
 	if (!pfp->params.proportional_spacing || is_space)
 	    width = pcl_hmi(pcs);
 	else {
-	    if ( pcs->font->scaling_technology == plfst_TrueType ) {
+	    if (pcs->font->scaling_technology == plfst_TrueType ||
+                pcs->font->scaling_technology == plfst_MicroType) {
 		floatp tmp;
 		tmp = pscale->x / (floatp)pcs->uom_cp + 0.5;
 		tmp -= fmod(tmp, (floatp)1.0);


Your change is more restrictive, I wonder if you have a counterexample to this
patch.
Comment 5 Henry Stiles 2009-07-02 12:23:38 UTC
Fixed in revision 9833.  Please reopen if this doesn't address the issue.
Comment 6 norbert.janssen 2009-07-03 01:20:18 UTC
Not for comparing AFS against UFST. This patch indeed makes the charactermetrics
identical.
However, for some of the typefaces/fonts there is a difference when comparing
with an HP LJ4345 output.
Comment 7 Henry Stiles 2009-07-03 07:02:48 UTC
HP devices differ, there is some discussion in the UFST documentation about
advance width for different printers.  Does Zoran match the LJ4345?  If you
could post a scan of the HP printer output, I'd be interested to see it.
Comment 8 norbert.janssen 2009-07-03 07:56:14 UTC
As it is too large to post here, I sent it by email to Henry
Comment 9 Marcos H. Woehrmann 2011-09-18 21:46:03 UTC
Changing customer bugs that have been resolved more than a year ago to closed.