From feac3d94dd564930ba090c8bcdeb7554092a1335 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 16 Jul 2019 10:32:36 -0400 Subject: [PATCH 1/3] Added missing handling of text in GDS input with PRESENTATION followed by WIDTH (previously it assumed that PRESENTATION and WIDTH were mutually exclusive). --- calma/CalmaRdpt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index aee5c4b2..60b6ffc4 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -772,6 +772,11 @@ calmaElementText() else if (nbytes > 0 && rtype != CALMA_STRANS) calmaSkipSet(ignore); + /* NOTE: Record may contain both PRESENTATION and WIDTH */ + PEEKRH(nbytes, rtype); + if (nbytes > 0 && rtype != CALMA_STRANS) + calmaSkipSet(ignore); + READRH(nbytes, rtype); if (nbytes > 0 && rtype == CALMA_STRANS) { From 70927709c7c20d975c4521e0787f3cf741626ca2 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 16 Jul 2019 11:45:10 -0400 Subject: [PATCH 2/3] Added the capability to read a value from a WIDTH entry for text. Still not sure how it is supposed to be used, exactly. Used it to set a default text size in case a MAG value is missing. --- calma/CalmaRdpt.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 60b6ffc4..9745e0d2 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -774,7 +774,21 @@ calmaElementText() /* NOTE: Record may contain both PRESENTATION and WIDTH */ PEEKRH(nbytes, rtype); - if (nbytes > 0 && rtype != CALMA_STRANS) + if (nbytes > 0 && rtype == CALMA_WIDTH) + { + /* Use WIDTH value to set the font size */ + if (!calmaReadI4Record(CALMA_WIDTH, &size)) + { + calmaReadError("Error in reading WIDTH in calmaElementText()\n") ; + return; + } + size *= calmaReadScale1; + if (size % calmaReadScale2 != 0) + calmaReadError("Text width snapped to nearest integer boundary.\n"); + + size /= calmaReadScale2; + } + else if (nbytes > 0 && rtype != CALMA_STRANS) calmaSkipSet(ignore); READRH(nbytes, rtype); From cd32e39d58079ae383219a8de390f184e0c09b93 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 16 Jul 2019 16:26:56 -0400 Subject: [PATCH 3/3] Modified the GDS read routine to account for use of WIDTH in a text record without a MAG in the PRESENTATION record to override it. --- calma/CalmaRdpt.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/calma/CalmaRdpt.c b/calma/CalmaRdpt.c index 9745e0d2..c6e4c6d1 100644 --- a/calma/CalmaRdpt.c +++ b/calma/CalmaRdpt.c @@ -725,7 +725,7 @@ calmaElementText() angle = 0; /* Default size is 1um */ - size = (int)((800 * cifCurReadStyle->crs_multiplier) + size = (int)((1000 * cifCurReadStyle->crs_multiplier) / cifCurReadStyle->crs_scaleFactor); /* Default position is bottom-right (but what the spec calls "top-left"!) */ pos = GEO_SOUTHEAST; @@ -776,17 +776,23 @@ calmaElementText() PEEKRH(nbytes, rtype); if (nbytes > 0 && rtype == CALMA_WIDTH) { + int width; + /* Use WIDTH value to set the font size */ - if (!calmaReadI4Record(CALMA_WIDTH, &size)) + if (!calmaReadI4Record(CALMA_WIDTH, &width)) { calmaReadError("Error in reading WIDTH in calmaElementText()\n") ; return; } - size *= calmaReadScale1; - if (size % calmaReadScale2 != 0) - calmaReadError("Text width snapped to nearest integer boundary.\n"); + width *= calmaReadScale1; + if (width % calmaReadScale2 != 0) + calmaReadError("Text width snapped to nearest integer boundary.\n"); - size /= calmaReadScale2; + width /= calmaReadScale2; + + /* Convert to database units, because dimension goes to PutLabel */ + /* and is not converted through CIFPaintCurrent(). */ + size = CIFScaleCoord(width, COORD_ANY); } else if (nbytes > 0 && rtype != CALMA_STRANS) calmaSkipSet(ignore); @@ -801,9 +807,10 @@ calmaElementText() if (nbytes > 0 && rtype == CALMA_MAG) { calmaReadR8(&dval); + /* Assume that MAG is the label size in microns */ - /* "size" is the label size in 8 * (database units) */ - size = (int)((dval * 800 * cifCurReadStyle->crs_multiplier) + /* "size" is the label size in 10 * (database units) */ + size = (int)((dval * 1000 * cifCurReadStyle->crs_multiplier) / cifCurReadStyle->crs_scaleFactor); } else