//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e O v e r l a y // //--------------------------------------------------------------------// // // // Write background data sequences to output file. // // Optionally top and tail these with macro (user-defined stream) // // definition sequences. // // // //--------------------------------------------------------------------// private static void generateOverlay(BinaryWriter prnWriter, Boolean formAsMacro, UInt16 logXOffset, Int32 indxPaperSize, Int32 indxOrientation) { Int16 posX, posY; Int16 ptSize; Int16 boxX, boxY, boxHeight, boxWidth; Byte stroke = 1; //----------------------------------------------------------------// // // // Header // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.StartDef); } //----------------------------------------------------------------// // // // Box. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.Shading, 60); boxX = (Int16)((_unitsPerInch / 2) - logXOffset); boxY = (Int16)(_unitsPerInch / 2); boxWidth = (Int16)(_paperWidth - _unitsPerInch); boxHeight = (Int16)(_paperHeight - _unitsPerInch); PCLWriter.rectangleOutline(prnWriter, boxX, boxY, boxHeight, boxWidth, stroke, false, false); //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); ptSize = 15; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Bold, ptSize, 0)); posX = (Int16)(_posXDesc - logXOffset); posY = _posYHddr; PCLWriter.text(prnWriter, posX, posY, 0, "PCL cross-hatch patterns:"); //----------------------------------------------------------------// ptSize = 12; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); //----------------------------------------------------------------// posY = _posYDesc1; for (Int32 i = 0; i < _patternsCt; i++) { PCLWriter.text(prnWriter, posX, posY, 0, "#" + _patternIds[i].ToString() + ": "); posY += _lineInc; } //----------------------------------------------------------------// ptSize = 10; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); //----------------------------------------------------------------// posY = _posYDesc1 + (_lineInc / 4); for (Int32 i = 0; i < _patternsCt; i++) { PCLWriter.text(prnWriter, posX, posY, 0, _patternDescs[i] + ":"); posY += _lineInc; } //----------------------------------------------------------------// ptSize = 8; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); //----------------------------------------------------------------// posY = _posYDesc2; posX = (Int16)(_posXData1 - logXOffset); PCLWriter.text(prnWriter, posX, posY, 0, "Predefined"); posX = (Int16)(_posXData2 - logXOffset); PCLWriter.text(prnWriter, posX, posY, 0, "User-defined 300 dpi"); posX = (Int16)(_posXData3 - logXOffset); PCLWriter.text(prnWriter, posX, posY, 0, "User-defined 600 dpi"); //----------------------------------------------------------------// // // // Overlay end. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); if (formAsMacro) { PCLWriter.macroControl(prnWriter, 0, PCLWriter.eMacroControl.StopDef); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e O v e r l a y // //--------------------------------------------------------------------// // // // Write background data sequences to output file. // // Optionally top and tail these with macro (user-defined stream) // // definition sequences. // // // //--------------------------------------------------------------------// private static void generateOverlay(BinaryWriter prnWriter, Boolean formAsMacro, UInt16 logXOffset, Int32 indxPaperSize, Int32 indxOrientation) { Int16 posX, posY; Int16 ptSize; Int16 boxX, boxY, boxHeight, boxWidth; Int16 rectX, rectY, rectHeight, rectWidth; Byte stroke = 1; //----------------------------------------------------------------// // // // Header // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.StartDef); } //----------------------------------------------------------------// // // // Box. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.Shading, 60); boxX = (Int16)((_unitsPerInch / 2) - logXOffset); boxY = (Int16)(_unitsPerInch / 2); boxWidth = (Int16)(_paperWidth - _unitsPerInch); boxHeight = (Int16)(_paperHeight - _unitsPerInch); PCLWriter.rectangleOutline(prnWriter, boxX, boxY, boxHeight, boxWidth, stroke, false, false); //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); ptSize = 15; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Bold, ptSize, 0)); posX = (Int16)(_posXDesc - logXOffset); posY = _posYHddr; PCLWriter.text(prnWriter, posX, posY, 0, "PCL imaging colour mode:"); //----------------------------------------------------------------// ptSize = 12; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); posY += _incInch / 2; PCLWriter.text(prnWriter, posX, posY, 0, "Sample 4-colour palette:"); //----------------------------------------------------------------// posX = (Int16)(_posXDesc1 - logXOffset); posY = _posYDesc1; PCLWriter.text(prnWriter, posX, posY, 0, "Colour space"); //----------------------------------------------------------------// posX = (Int16)(_posXDesc2 - logXOffset); posY = _posYDesc2; posX = (Int16)(_posXDesc2 - logXOffset); PCLWriter.text(prnWriter, posX, posY, 0, "RGB"); posX += _colInc; PCLWriter.text(prnWriter, posX, posY, 0, "CMY"); posX += _colInc; PCLWriter.text(prnWriter, posX, posY, 0, "SRGB"); //----------------------------------------------------------------// posX = (Int16)(_posXDesc3 - logXOffset); posY = _posYDesc3; PCLWriter.text(prnWriter, posX, posY, 0, "index"); posX += _incInch; PCLWriter.text(prnWriter, posX, posY, 0, "value"); //----------------------------------------------------------------// posX = (Int16)(_posXDesc4 - logXOffset); posY = _posYDesc4; PCLWriter.text(prnWriter, posX, posY, 0, "0"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "1"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "2"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "3"); //----------------------------------------------------------------// // // // Background shade. // // // //----------------------------------------------------------------// rectX = (Int16)(_posXDesc2 - (_incInch / 4) - logXOffset); rectY = _posYDesc2 + (_incInch / 4); rectWidth = (_incInch * 17) / 4; rectHeight = (_incInch * 7) / 2; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, 5, false, false); //----------------------------------------------------------------// // // // Overlay end. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); if (formAsMacro) { PCLWriter.macroControl(prnWriter, 0, PCLWriter.eMacroControl.StopDef); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Int32[] sampleDef, Boolean formAsMacro, UInt16 logXOffset) { Int16 posX, posY, rectX, rectY, rectHeight, rectWidth; Int16 ptSize; Int32 temp; Byte [] palette_0 = new Byte[3], palette_1 = new Byte[3], palette_2 = new Byte[3], palette_3 = new Byte[3]; //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.Call); } else { generateOverlay(prnWriter, false, logXOffset, indxPaperSize, indxOrientation); } rectHeight = (Int16)(_lineInc / 2); rectWidth = _lineInc; //----------------------------------------------------------------// // // // Set pattern transparency to Opaque so that white samples show // // on the shaded background. // // // //----------------------------------------------------------------// PCLWriter.patternTransparency(prnWriter, true); //----------------------------------------------------------------// // // // Colour definitions. // // // //----------------------------------------------------------------// temp = sampleDef [0]; palette_0 [2] = (Byte)(temp & 0xff); temp = temp >> 8; palette_0 [1] = (Byte)(temp & 0xff); temp = temp >> 8; palette_0 [0] = (Byte)(temp & 0xff); temp = sampleDef [1]; palette_1 [2] = (Byte)(temp & 0xff); temp = temp >> 8; palette_1 [1] = (Byte)(temp & 0xff); temp = temp >> 8; palette_1 [0] = (Byte)(temp & 0xff); temp = sampleDef [2]; palette_2 [2] = (Byte)(temp & 0xff); temp = temp >> 8; palette_2 [1] = (Byte)(temp & 0xff); temp = temp >> 8; palette_2 [0] = (Byte)(temp & 0xff); temp = sampleDef [3]; palette_3 [2] = (Byte)(temp & 0xff); temp = temp >> 8; palette_3 [1] = (Byte)(temp & 0xff); temp = temp >> 8; palette_3 [0] = (Byte)(temp & 0xff); //----------------------------------------------------------------// // // // Write details. // // // //----------------------------------------------------------------// ptSize = 12; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); //----------------------------------------------------------------// posX = (Int16)(_posXDesc4 - logXOffset); posY = _posYDesc4; posX += _incInch; PCLWriter.text(prnWriter, posX, posY, 0, "0x" + palette_0 [0].ToString("x2") + palette_0 [1].ToString("x2") + palette_0 [2].ToString("x2")); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "0x" + palette_1 [0].ToString("x2") + palette_1 [1].ToString("x2") + palette_1 [2].ToString("x2")); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "0x" + palette_2 [0].ToString("x2") + palette_2 [1].ToString("x2") + palette_2 [2].ToString("x2")); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "0x" + palette_3 [0].ToString("x2") + palette_3 [1].ToString("x2") + palette_3 [2].ToString("x2")); //----------------------------------------------------------------// // // // RGB colour space. // // // //----------------------------------------------------------------// PCLWriter.configureImageData(prnWriter, 0, // colour space = RGB 1, // PEM = Direct-by-pixel 2, // 2 bitsPerindex -> 4 colours 8, // bits per component - ignored 8, // bits per component - ignored 8); // bits per component - ignored PCLWriter.paletteEntry(prnWriter, 0, palette_0 [0], palette_0 [1], palette_0 [2]); PCLWriter.paletteEntry(prnWriter, 1, palette_1 [0], palette_1 [1], palette_1 [2]); PCLWriter.paletteEntry(prnWriter, 2, palette_2 [0], palette_2 [1], palette_2 [2]); PCLWriter.paletteEntry(prnWriter, 3, palette_3 [0], palette_3 [1], palette_3 [2]); posX = (Int16)(_posXData - logXOffset); posY = _posYData; rectX = posX; rectY = posY; PCLWriter.setForegroundColour(prnWriter, 0); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 1); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 2); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 3); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); //----------------------------------------------------------------// // // // CMY colour space. // // // //----------------------------------------------------------------// PCLWriter.configureImageData(prnWriter, 1, // colour space = CMY 1, // PEM = Direct-by-pixel 2, // 2 bitsPerindex -> 4 colours 8, // bits per component - ignored 8, // bits per component - ignored 8); // bits per component - ignored PCLWriter.paletteEntry(prnWriter, 0, palette_0[0], palette_0[1], palette_0[2]); PCLWriter.paletteEntry(prnWriter, 1, palette_1[0], palette_1[1], palette_1[2]); PCLWriter.paletteEntry(prnWriter, 2, palette_2[0], palette_2[1], palette_2[2]); PCLWriter.paletteEntry(prnWriter, 3, palette_3[0], palette_3[1], palette_3[2]); posX += _colInc; rectX = posX; rectY = posY; PCLWriter.setForegroundColour(prnWriter, 0); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 1); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 2); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 3); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); //----------------------------------------------------------------// // // // SRGB colour space. // // // //----------------------------------------------------------------// PCLWriter.configureImageData(prnWriter, 2, // colour space = SRGB 1, // PEM = Direct-by-pixel 2, // 2 bitsPerindex -> 4 colours 8, // bits per component - ignored 8, // bits per component - ignored 8); // bits per component - ignored PCLWriter.paletteEntry(prnWriter, 0, palette_0[0], palette_0[1], palette_0[2]); PCLWriter.paletteEntry(prnWriter, 1, palette_1[0], palette_1[1], palette_1[2]); PCLWriter.paletteEntry(prnWriter, 2, palette_2[0], palette_2[1], palette_2[2]); PCLWriter.paletteEntry(prnWriter, 3, palette_3[0], palette_3[1], palette_3[2]); posX += _colInc; rectX = posX; rectY = posY; PCLWriter.setForegroundColour(prnWriter, 0); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 1); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 2); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectY += _lineInc; PCLWriter.setForegroundColour(prnWriter, 3); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); //----------------------------------------------------------------// PCLWriter.formFeed(prnWriter); }
//--------------------------------------------------------------------// // M e t h o d // // i n i t i a l i s e D a t a U n i c o d e // //--------------------------------------------------------------------// // // // Initialise 'Unicode chars' data. // // // //--------------------------------------------------------------------// private void initialiseDataUnicode() { Int32 index, ctr; _initialised = false; lbOrientation.Visibility = Visibility.Hidden; cbOrientation.Visibility = Visibility.Hidden; //----------------------------------------------------------------// cbUnicodeFont.Items.Clear(); ctr = PCLFonts.getCount(); index = 0; for (Int32 i = 0; i < ctr; i++) { if ((PCLFonts.isBoundFont(i) == false) && ((PCLFonts.getType(i) == PCLFonts.eFontType.PresetTypeface) || (PCLFonts.getType(i) == PCLFonts.eFontType.PresetFamilyMember))) { _subsetUnicodeFonts[index++] = (Int32)i; cbUnicodeFont.Items.Add(PCLFonts.getName(i)); } } //----------------------------------------------------------------// cbUnicodeCp01.Items.Clear(); for (Int32 i = 0; i < 0x0100; i++) { cbUnicodeCp01.Items.Add(i.ToString("x2")); } cbUnicodeCp02.Items.Clear(); for (Int32 i = 0; i < 0x0100; i++) { cbUnicodeCp02.Items.Add(i.ToString("x2")); } //----------------------------------------------------------------// if (_crntPDL == ToolCommonData.ePrintLang.PCL) { if ((_indxUnicodeFontPCL < 0) || (_indxUnicodeFontPCL >= _ctUnicodeFonts)) { _indxUnicodeFontPCL = 0; } cbUnicodeFont.SelectedIndex = _indxUnicodeFontPCL; setFontOptionsVariants(_indxUnicodeFontPCL, true, ref _unicodeFontVarPCL); cbUnicodeCp01.SelectedIndex = (Int32)(_unicodeUCS2PCL / 256); cbUnicodeCp02.SelectedIndex = (Int32)(_unicodeUCS2PCL % 256); if (_flagUnicodeFormAsMacroPCL) { chkOptFormAsMacro.IsChecked = true; } else { chkOptFormAsMacro.IsChecked = false; } } else { if ((_indxUnicodeFontPCLXL < 0) || (_indxUnicodeFontPCLXL >= _ctUnicodeFonts)) { _indxUnicodeFontPCLXL = 0; } cbUnicodeFont.SelectedIndex = _indxUnicodeFontPCLXL; setFontOptionsVariants(_indxUnicodeFontPCLXL, true, ref _unicodeFontVarPCLXL); cbUnicodeCp01.SelectedIndex = (Int32)(_unicodeUCS2PCLXL / 256); cbUnicodeCp02.SelectedIndex = (Int32)(_unicodeUCS2PCLXL % 256); if (_flagUnicodeFormAsMacroPCLXL) { chkOptFormAsMacro.IsChecked = true; } else { chkOptFormAsMacro.IsChecked = false; } } _initialised = true; initialiseDescUnicode(); cbUnicodeCp_SelectionChanged(this, null); }
//--------------------------------------------------------------------// // M e t h o d // // s e t F o n t O p t i o n s V a r i a n t s // //--------------------------------------------------------------------// // // // Set variant options relevant to selected font. // // Assume that this is a PresetTypeface or PresetFamilyMember type, // // because this is all that we've added to the font selection subset. // // // //--------------------------------------------------------------------// private void setFontOptionsVariants(Int32 indxFont, Boolean samePreset, ref PCLFonts.eVariant fontVar) { Boolean varB, varBI, varI, varR, varSet; Int32 fontIndx; fontIndx = _subsetUnicodeFonts[indxFont]; varSet = false; //----------------------------------------------------------------// rbUnicodeFontVarB.Visibility = Visibility.Hidden; rbUnicodeFontVarBI.Visibility = Visibility.Hidden; rbUnicodeFontVarI.Visibility = Visibility.Hidden; rbUnicodeFontVarR.Visibility = Visibility.Hidden; rbUnicodeFontVarB.IsChecked = false; rbUnicodeFontVarBI.IsChecked = false; rbUnicodeFontVarI.IsChecked = false; rbUnicodeFontVarR.IsChecked = false; //----------------------------------------------------------------// varR = PCLFonts.variantExists(fontIndx, PCLFonts.eVariant.Regular); varI = PCLFonts.variantExists(fontIndx, PCLFonts.eVariant.Italic); varB = PCLFonts.variantExists(fontIndx, PCLFonts.eVariant.Bold); varBI = PCLFonts.variantExists(fontIndx, PCLFonts.eVariant.BoldItalic); //----------------------------------------------------------------// if (varR) { rbUnicodeFontVarR.Visibility = Visibility.Visible; } if (varI) { rbUnicodeFontVarI.Visibility = Visibility.Visible; } if (varB) { rbUnicodeFontVarB.Visibility = Visibility.Visible; } if (varBI) { rbUnicodeFontVarBI.Visibility = Visibility.Visible; } //----------------------------------------------------------------// if (samePreset) { if ((varR) && (fontVar == PCLFonts.eVariant.Regular)) { rbUnicodeFontVarR.IsChecked = true; varSet = true; } if ((varI) && (fontVar == PCLFonts.eVariant.Italic)) { rbUnicodeFontVarI.IsChecked = true; varSet = true; } if ((varB) && (fontVar == PCLFonts.eVariant.Bold)) { rbUnicodeFontVarB.IsChecked = true; varSet = true; } if ((varBI) && (fontVar == PCLFonts.eVariant.BoldItalic)) { rbUnicodeFontVarBI.IsChecked = true; varSet = true; } } //----------------------------------------------------------------// if (!varSet) { if (varR) { rbUnicodeFontVarR.IsChecked = true; fontVar = PCLFonts.eVariant.Regular; } else if (varI) { rbUnicodeFontVarI.IsChecked = true; fontVar = PCLFonts.eVariant.Italic; } else if (varB) { rbUnicodeFontVarB.IsChecked = true; fontVar = PCLFonts.eVariant.Bold; } else if (varBI) { rbUnicodeFontVarBI.IsChecked = true; fontVar = PCLFonts.eVariant.BoldItalic; } } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e O v e r l a y // //--------------------------------------------------------------------// // // // Write background data sequences to output file. // // Optionally top and tail these with macro (user-defined stream) // // definition sequences. // // // //--------------------------------------------------------------------// private static void generateOverlay(BinaryWriter prnWriter, Boolean formAsMacro, UInt16 logXOffset, Int32 indxPaperSize, Int32 indxOrientation) { Int16 posX, posY; Int16 ptSize; Int16 boxX, boxY, boxHeight, boxWidth, rectX, rectY, rectHeight, rectWidth; Byte stroke = 1; //----------------------------------------------------------------// // // // Header // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.StartDef); } //----------------------------------------------------------------// // // // Box. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.Shading, 60); boxX = (Int16)((_unitsPerInch / 2) - logXOffset); boxY = (Int16)(_unitsPerInch / 2); boxWidth = (Int16)(_paperWidth - _unitsPerInch); boxHeight = (Int16)(_paperHeight - _unitsPerInch); PCLWriter.rectangleOutline(prnWriter, boxX, boxY, boxHeight, boxWidth, stroke, false, false); //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); ptSize = 15; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Bold, ptSize, 0)); posX = (Int16)(_posXDesc - logXOffset); posY = _posYHddr; PCLWriter.text(prnWriter, posX, posY, 0, "PCL text & background:"); ptSize = 12; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); posY = _posYDesc; PCLWriter.text(prnWriter, posX, posY, 0, "Black:"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Shade " + _shade_1 + "%:"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Shade " + _shade_2 + "%:"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "White:"); //----------------------------------------------------------------// // // // Background shading. // // // //----------------------------------------------------------------// posX = (Int16)(_posXData - logXOffset); posY = _posYData - (_lineInc / 2); rectX = posX; rectY = posY; rectHeight = (Int16)((_lineInc * 3) / 5); rectWidth = (Int16)((_unitsPerInch * 9) / 10); PCLWriter.patternTransparency(prnWriter, false); PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_1, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_2, false, false); rectX = posX; rectY += _lineInc; PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_1, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_2, false, false); rectX = posX; rectY += _lineInc; PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_1, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_2, false, false); rectX = posX; rectY += _lineInc; PCLWriter.rectangleSolid(prnWriter, rectX, rectY, rectHeight, rectWidth, false, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_1, false, false); rectX += rectWidth; PCLWriter.rectangleShaded(prnWriter, rectX, rectY, rectHeight, rectWidth, _shade_2, false, false); //----------------------------------------------------------------// // // // Overlay end. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); if (formAsMacro) { PCLWriter.macroControl(prnWriter, 0, PCLWriter.eMacroControl.StopDef); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt16 logXOffset) { String sampleText = "000000000000000"; Int16 posX, posY; Int16 ptSize; //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.Call); } else { generateOverlay(prnWriter, false, logXOffset, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// ptSize = 36; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontArial, PCLFonts.eVariant.Regular, ptSize, 0)); //----------------------------------------------------------------// // Black // //----------------------------------------------------------------// posX = (Int16)(_posXData - logXOffset); posY = _posYData; PCLWriter.patternTransparency(prnWriter, false); PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); PCLWriter.text(prnWriter, posX, posY, 0, sampleText); //----------------------------------------------------------------// // Shade 1 // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.patternTransparency(prnWriter, true); PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.Shading, _shade_1); PCLWriter.text(prnWriter, posX, posY, 0, sampleText); //----------------------------------------------------------------// // Shade 2 // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.patternTransparency(prnWriter, true); PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.Shading, _shade_2); PCLWriter.text(prnWriter, posX, posY, 0, sampleText); //----------------------------------------------------------------// // White // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.patternTransparency(prnWriter, true); PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidWhite, 0); PCLWriter.text(prnWriter, posX, posY, 0, sampleText); //----------------------------------------------------------------// PCLWriter.formFeed(prnWriter); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt32 codePoint, Int32 indxFont, PCLFonts.eVariant fontVar) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; UInt16[] textArray = { 0x00 }; Int16 posX, posY; Int32 indStd; Int16 ptSize; Byte[] utf8Seq = new Byte[4]; Int32 utf8Len = 0; String utf8HexVal = ""; //----------------------------------------------------------------// indStd = 0; //----------------------------------------------------------------// if (indxOrientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(indxOrientation)); } if (indxPaperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(indxPaperSize)); } if ((indxPaperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(indxPaperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(indxPaperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// if (formAsMacro) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.StreamName, _formName); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.ExecStream); prnWriter.Write(bufStd, 0, indStd); indStd = 0; } else { generateOverlay(prnWriter, false, indxPaperSize, indxOrientation); } prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// // // // Code-point data. // // // //----------------------------------------------------------------// ptSize = 18; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameArial); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); posX = _posXData; posY = _posYData; if (codePoint < 0x010000) { PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, "U+" + codePoint.ToString("x4")); } else { // should not happen 'cos XL only supports 16-bit values ! PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, "U+" + codePoint.ToString("x6")); } PrnParseDataUTF8.convertUTF32ToUTF8Bytes(codePoint, ref utf8Len, ref utf8Seq); PrnParseDataUTF8.convertUTF32ToUTF8HexString(codePoint, true, ref utf8HexVal); posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, utf8HexVal); //----------------------------------------------------------------// // // // Font data. // // // //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, PCLFonts.getName(indxFont) + " " + Enum.GetName(typeof(PCLFonts.eVariant), fontVar)); posY += _lineInc; ptSize = 36; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_18N, PCLFonts.getPCLXLName(indxFont, fontVar)); textArray[0] = (UInt16)codePoint; PCLXLWriter.textChar(prnWriter, false, 0, // ***** dummy value ***** ptSize, posX, posY, (UInt16)codePoint); //----------------------------------------------------------------// PCLXLWriter.addAttrUint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageCopies, 1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.EndPage); prnWriter.Write(bufStd, 0, indStd); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt16 logXOffset) { String lbCRTerm = "\x0d" + "~"; Int16 posX, posY; Int16 ptSize, degrees; Int16 boxX, boxY, boxHeight, boxWidth; Double scaleX, scaleY; Double angle, sinAngle, cosAngle; //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.Call); } else { generateOverlay(prnWriter, false, logXOffset, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // HP-GL/2 picture frame and initialisation. // // // // Plotter units are always absolute at 0.025mm (1/1016 inch), // // but many HP-GL/2 commands use (definable) user units. // // It makes the code clearer if we use the same units in HP-GL/2 // // as we do in PCL, so the SC (scale) command is used to set // // user-units to 600 units-per-inch. // // // // Note that the default HP-GL/2 Y-axis has its origin at // // lower-left of the picture frame, and Y-coordinate values // // increase UP the page, whilst the PCL Y-axis has its origin at // // the top margin and Y-coordinate values increase DOWN the page. // // // // It is possible to use the same (600 upi) coordinates as PCL by // // using: // // SC0,1.6933,0,-1.6933,2 // // IR0,100,100,0 // // Note that the IR coordinates shown in the example in the "PCL // // Technical Reference" manual are different and are incorrect! // // One drawback to using the same origin and axis direction is // // that some commands (such as SR) then have to use negative // // Y-values to avoid mirroring. // // // //----------------------------------------------------------------// scaleX = (Double)_plotUnitsPerInch / _unitsPerInch; scaleY = (Double)_plotUnitsPerInch / _unitsPerInch; boxX = 0; boxY = 0; boxWidth = (Int16)(_logPageWidth); boxHeight = (Int16)(_logPageHeight); PCLWriter.pictureFrame(prnWriter, boxX, boxY, boxHeight, boxWidth); PCLWriter.modeHPGL2(prnWriter, false, false); PCLWriter.cmdHPGL2(prnWriter, "IN", "", false); PCLWriter.cmdHPGL2(prnWriter, "SP", "1", true); PCLWriter.cmdHPGL2(prnWriter, "DT", "~", false); PCLWriter.cmdHPGL2(prnWriter, "SC", "0," + scaleX.ToString("F4") + ",0," + (-scaleY).ToString("F4") + ",2", false); PCLWriter.cmdHPGL2(prnWriter, "IR", "0,100,100,0", false); PCLWriter.cmdHPGL2(prnWriter, "PU", "0,0", true); PCLWriter.modePCL(prnWriter, true); //----------------------------------------------------------------// // // // Rotated text. // // // //----------------------------------------------------------------// ptSize = 36; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontArial, PCLFonts.eVariant.Regular, ptSize, 0)); //----------------------------------------------------------------// // Orthogonal text // //----------------------------------------------------------------// posX = (Int16)(_posXData1 - logXOffset); posY = _posYData1; posX += _lineInc / 4; PCLWriter.printDirection(prnWriter, 0); PCLWriter.textRotated(prnWriter, posX, posY, 0, 0, true, "angle 0"); posX -= _lineInc / 2; PCLWriter.textRotated(prnWriter, posX, posY, 0, 180, true, "ccw 180"); posX += _lineInc / 4; posY -= _lineInc / 4; PCLWriter.textRotated(prnWriter, posX, posY, 0, 90, true, "ccw 90"); posY += _lineInc / 2; PCLWriter.textRotated(prnWriter, posX, posY, 0, 270, true, "ccw 270"); //----------------------------------------------------------------// // direction quadrants I and III // //----------------------------------------------------------------// posX = (Int16)(_posXData2 - logXOffset); posY = _posYData2; PCLWriter.modeHPGL2(prnWriter, false, false); PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); degrees = 30; angle = Math.PI * degrees / 180.0; sinAngle = Math.Sin(angle); cosAngle = Math.Cos(angle); PCLWriter.cmdHPGL2(prnWriter, "DI", cosAngle.ToString() + "," + sinAngle.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", "angle +30" + lbCRTerm, true); PCLWriter.cmdHPGL2(prnWriter, "DI", "-" + cosAngle.ToString() + "," + "-" + sinAngle.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", "angle +210" + lbCRTerm, true); //----------------------------------------------------------------// // direction quadrants II and IV // //----------------------------------------------------------------// posX = (Int16)(_posXData2 - logXOffset - ((1 * _incInch) / 4)); PCLWriter.modeHPGL2(prnWriter, false, false); PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); degrees = 45; angle = Math.PI * degrees / 180.0; sinAngle = Math.Sin(angle); cosAngle = Math.Cos(angle); PCLWriter.cmdHPGL2(prnWriter, "DI", "-" + cosAngle.ToString() + "," + sinAngle.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", "angle +135" + lbCRTerm, true); posX += ((1 * _incInch) / 2); posY += ((_lineInc * 1) / 6); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "DI", cosAngle.ToString() + "," + "-" + sinAngle.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", "angle +315" + lbCRTerm, true); //----------------------------------------------------------------// // resets // //----------------------------------------------------------------// posX = (Int16)(_posXData2 - logXOffset); posY += ((_lineInc * 1) / 2); PCLWriter.cmdHPGL2(prnWriter, "DI", "1,0", false); //----------------------------------------------------------------// PCLWriter.formFeed(prnWriter); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e O v e r l a y // //--------------------------------------------------------------------// // // // Write background data sequences to output file. // // Optionally top and tail these with macro (user-defined stream) // // definition sequences. // // // //--------------------------------------------------------------------// private static void generateOverlay(BinaryWriter prnWriter, Boolean formAsMacro, UInt16 logXOffset, Int32 indxPaperSize, Int32 indxOrientation) { Int16 posX, posY; Int16 ptSize; Int16 boxX, boxY, boxHeight, boxWidth; Byte stroke = 1; //----------------------------------------------------------------// // // // Header // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.StartDef); } //----------------------------------------------------------------// // // // Box. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.Shading, 60); boxX = (Int16)((_unitsPerInch / 2) - logXOffset); boxY = (Int16)(_unitsPerInch / 2); boxWidth = (Int16)(_paperWidth - _unitsPerInch); boxHeight = (Int16)(_paperHeight - _unitsPerInch); PCLWriter.rectangleOutline(prnWriter, boxX, boxY, boxHeight, boxWidth, stroke, false, false); //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); ptSize = 15; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Bold, ptSize, 0)); posX = (Int16)(_posXDesc - logXOffset); posY = _posYHddr; PCLWriter.text(prnWriter, posX, posY, 0, "PCL & HP-GL/2 Text Rotation:"); ptSize = 12; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); posY = _posYDesc1; PCLWriter.text(prnWriter, posX, posY, 0, "Orthogonal:"); posY = _posYDesc2; PCLWriter.text(prnWriter, posX, posY, 0, "Non-orthogonal:"); //----------------------------------------------------------------// // // // Overlay end. // // // //----------------------------------------------------------------// PCLWriter.patternSet(prnWriter, PCLWriter.ePatternType.SolidBlack, 0); if (formAsMacro) { PCLWriter.macroControl(prnWriter, 0, PCLWriter.eMacroControl.StopDef); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt16 logXOffset, UInt32 codePoint, Int32 indxFont, PCLFonts.eVariant fontVar) { Int16 posX, posY; Int16 ptSize; Byte[] utf8Seq = new Byte[4]; Int32 utf8Len = 0; String utf8HexVal = ""; //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.Call); } else { generateOverlay(prnWriter, false, logXOffset, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // Code-point data. // // // //----------------------------------------------------------------// ptSize = 18; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontArial, PCLFonts.eVariant.Regular, ptSize, 0)); posX = (Int16)(_posXData - logXOffset); posY = _posYData; if (codePoint < 0x010000) { PCLWriter.text(prnWriter, posX, posY, 0, "U+" + codePoint.ToString("x4")); } else { PCLWriter.text(prnWriter, posX, posY, 0, "U+" + codePoint.ToString("x6")); } PrnParseDataUTF8.convertUTF32ToUTF8Bytes(codePoint, ref utf8Len, ref utf8Seq); PrnParseDataUTF8.convertUTF32ToUTF8HexString(codePoint, true, ref utf8HexVal); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, utf8HexVal); //----------------------------------------------------------------// // // // Font data. // // // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, PCLFonts.getName(indxFont) + " " + Enum.GetName(typeof(PCLFonts.eVariant), fontVar)); posY += _lineInc; ptSize = 36; PCLWriter.font(prnWriter, true, "18N", PCLFonts.getPCLFontSelect(indxFont, fontVar, ptSize, 0)); PCLWriter.textParsingMethod( prnWriter, PCLTextParsingMethods.eIndex.m83_UTF8); PCLWriter.cursorPosition(prnWriter, posX, posY); prnWriter.Write(utf8Seq, 0, utf8Len); PCLWriter.formFeed(prnWriter); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt16 logXOffset) { String sampleText = "0123456789"; String lbTerm = "~"; Int16 posX, posY; Int16 ptSize, degrees; Int16 boxX, boxY, boxHeight, boxWidth; Double scaleX, scaleY; Double angle, tanAngle; //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.Call); } else { generateOverlay(prnWriter, false, logXOffset, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // HP-GL/2 picture frame and initialisation. // // // // Plotter units are always absolute at 0.025mm (1/1016 inch), // // but many HP-GL/2 commands use (definable) user units. // // It makes the code clearer if we use the same units in HP-GL/2 // // as we do in PCL, so the SC (scale) command is used to set // // user-units to 600 units-per-inch. // // // // Note that the default HP-GL/2 Y-axis has its origin at // // lower-left of the picture frame, and Y-coordinate values // // increase UP the page, whilst the PCL Y-axis has its origin at // // the top margin and Y-coordinate values increase DOWN the page. // // // // It is possible to use the same (600 upi) coordinates as PCL by // // using: // // SC0,1.6933,0,-1.6933,2 // // IR0,100,100,0 // // Note that the IR coordinates shown in the example in the "PCL // // Technical Reference" manual are different and are incorrect! // // One drawback to using the same origin and axis direction is // // that some commands (such as SR) then have to use negative // // Y-values to avoid mirroring. // // // //----------------------------------------------------------------// scaleX = (Double)_plotUnitsPerInch / _unitsPerInch; scaleY = (Double)_plotUnitsPerInch / _unitsPerInch; boxX = 0; boxY = 0; boxWidth = (Int16)(_logPageWidth); boxHeight = (Int16)(_logPageHeight); PCLWriter.pictureFrame(prnWriter, boxX, boxY, boxHeight, boxWidth); PCLWriter.modeHPGL2(prnWriter, false, false); PCLWriter.cmdHPGL2(prnWriter, "IN", "", false); PCLWriter.cmdHPGL2(prnWriter, "SP", "1", true); PCLWriter.cmdHPGL2(prnWriter, "DT", "~", false); PCLWriter.cmdHPGL2(prnWriter, "SC", "0," + scaleX.ToString("F4") + ",0," + (-scaleY).ToString("F4") + ",2", false); PCLWriter.cmdHPGL2(prnWriter, "IR", "0,100,100,0", false); PCLWriter.cmdHPGL2(prnWriter, "PU", "0,0", true); PCLWriter.modePCL(prnWriter, true); //----------------------------------------------------------------// // // // Descriptive text. // // // //----------------------------------------------------------------// ptSize = 18; PCLWriter.font(prnWriter, true, "19U", PCLFonts.getPCLFontSelect(_indxFontCourier, PCLFonts.eVariant.Regular, ptSize, 0)); posX = (Int16)(_posXData1 - logXOffset); posY = _posYDesc; posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Arial"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, ""); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, ""); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "+30"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "-45"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "+ve"); posY += _lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "-ve"); //----------------------------------------------------------------// // // // Embellished text. // // // //----------------------------------------------------------------// ptSize = 36; posX = (Int16)(_posXData2 - logXOffset); posY = _posYData; //----------------------------------------------------------------// // standard // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.modeHPGL2(prnWriter, false, false); PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); //----------------------------------------------------------------// // size X // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "SR", "4,-3", true); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); PCLWriter.cmdHPGL2(prnWriter, "SR", "", true); //----------------------------------------------------------------// // size Y // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "SR", "3.2,-6", true); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); PCLWriter.cmdHPGL2(prnWriter, "SI", "", true); //----------------------------------------------------------------// // slant X positive // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); degrees = 30; angle = Math.PI * degrees / 180.0; tanAngle = Math.Tan(angle); PCLWriter.cmdHPGL2(prnWriter, "SL", tanAngle.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); //----------------------------------------------------------------// // slant X negative // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); degrees = 45; angle = Math.PI * degrees / 180.0; tanAngle = Math.Tan(angle); PCLWriter.cmdHPGL2(prnWriter, "SL", "-" + tanAngle.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); PCLWriter.cmdHPGL2(prnWriter, "SL", "0", false); //----------------------------------------------------------------// // extra space X positive // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "ES", ".2,0", false); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); //----------------------------------------------------------------// // extra space X negative // //----------------------------------------------------------------// posY += _lineInc; PCLWriter.cmdHPGL2(prnWriter, "SD", PCLFonts.getHPGL2FontDef(_indxFontArial, PCLFonts.eVariant.Regular, 14, ptSize, 0), true); PCLWriter.cmdHPGL2(prnWriter, "PA", posX.ToString() + "," + posY.ToString(), false); PCLWriter.cmdHPGL2(prnWriter, "ES", "-.1,0", false); PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true); //----------------------------------------------------------------// PCLWriter.modePCL(prnWriter, true); PCLWriter.formFeed(prnWriter); }