summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/emf-inout.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/extension/internal/emf-inout.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index e88cf3d42..13520c40b 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -1174,10 +1174,7 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
if (!d->dc[d->level].style.stroke_dasharray.values.empty() && (d->level==0 || (d->level>0 && d->dc[d->level].style.stroke_dasharray.values!=d->dc[d->level-1].style.stroke_dasharray.values)))
d->dc[d->level].style.stroke_dasharray.values.clear();
for (unsigned int i=0; i<pEmr->elp.elpNumEntries; i++) {
-// Doing it this way typically results in a pattern that is tiny, better to assume the array
-// is the same scale as for dot/dash below, that is, no scaling should be applied
-// double dash_length = pix_to_abs_size( d, pEmr->elp.elpStyleEntry[i] );
- double dash_length = pEmr->elp.elpStyleEntry[i];
+ double dash_length = pix_to_abs_size( d, pEmr->elp.elpStyleEntry[i] );
d->dc[d->level].style.stroke_dasharray.values.push_back(dash_length);
}
d->dc[d->level].style.stroke_dasharray.set = 1;
@@ -1620,6 +1617,17 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA
uint32_t tbkMode = U_TRANSPARENT; // holds proposed change to bkMode, if text is involved saving these to the DC must wait until the text is written
U_COLORREF tbkColor = U_RGB(255, 255, 255); // holds proposed change to bkColor
+ // code for end user debugging
+ int eDbgRecord=0;
+ int eDbgComment=0;
+ int eDbgFinal=0;
+ char const* eDbgString = getenv( "INKSCAPE_DBG_EMF" );
+ if ( eDbgString != NULL ) {
+ if(strstr(eDbgString,"RECORD")){ eDbgRecord = 1; }
+ if(strstr(eDbgString,"COMMENT")){ eDbgComment = 1; }
+ if(strstr(eDbgString,"FINAL")){ eDbgFinal = 1; }
+ }
+
/* initialize the tsp for text reassembly */
tsp.string = NULL;
tsp.ori = 0.0; /* degrees */
@@ -1662,8 +1670,11 @@ int Emf::myEnhMetaFileProc(char *contents, unsigned int length, PEMF_CALLBACK_DA
lpEMFR = (PU_ENHMETARECORD)(contents + off);
-// Uncomment the following to track down toxic records
-// std::cout << "record type: " << iType << " name " << U_emr_names(iType) << " length: " << nSize << " offset: " << off <<std::endl;
+// At run time define environment variable INKSCAPE_DBG_EMF to include string RECORD.
+// Users may employ this to track down toxic records
+ if(eDbgRecord){
+ std::cout << "record type: " << iType << " name " << U_emr_names(iType) << " length: " << nSize << " offset: " << off <<std::endl;
+ }
off += nSize;
SVGOStringStream tmp_outsvg;
@@ -3478,14 +3489,20 @@ std::cout << "BEFORE DRAW"
dbg_str << "<!-- U_EMR_??? -->\n";
break;
} //end of switch
-// When testing, uncomment the following to place a comment for each processed EMR record in the SVG
-// d->outsvg += dbg_str.str().c_str();
+// At run time define environment variable INKSCAPE_DBG_EMF to include string COMMENT.
+// Users may employ this to to place a comment for each processed EMR record in the SVG
+ if(eDbgComment){
+ d->outsvg += dbg_str.str().c_str();
+ }
d->outsvg += tmp_outsvg.str().c_str();
d->path += tmp_path.str().c_str();
} //end of while
-// When testing, uncomment the following to show the final SVG derived from the EMF
-// std::cout << d->outsvg << std::endl;
+// At run time define environment variable INKSCAPE_DBG_EMF to include string FINAL
+// Users may employ this to to show the final SVG derived from the EMF
+ if(eDbgFinal){
+ std::cout << d->outsvg << std::endl;
+ }
(void) emr_properties(U_EMR_INVALID); // force the release of the lookup table memory, returned value is irrelevant
return(file_status);