//--------------------------------------------------------------------// // M e t h o d // // i s S y m S e t I n L i s t // //--------------------------------------------------------------------// // // // Return a value indicating whether or not the specified symbol set // // (Kind1) number is in the list of those (probably) supported by // // this font. // // // //--------------------------------------------------------------------// public Boolean isSymSetInList(UInt16 symSetNo) { Int32 symSetCt = _symSets.Length; Boolean symSetFound = false; //----------------------------------------------------------------// // // // Check whether or not symbol set is in the 'supported' list. // // // //----------------------------------------------------------------// for (Int32 i = 0; i < symSetCt; i++) { if (_symSets[i] == symSetNo) { symSetFound = true; i = symSetCt; // force end of loop } } //----------------------------------------------------------------// // // // If not in the list, allow it if it is an unbound font and the // // symbol set is Unicode. // // // //----------------------------------------------------------------// if ((!symSetFound) && (!_bound)) { if (PCLSymbolSets.getKind1(PCLSymbolSets.IndexUnicode) == symSetNo) { symSetFound = true; } } return(symSetFound); }
//--------------------------------------------------------------------// // M e t h o d // // r e p o r t B o d y M a i n // //--------------------------------------------------------------------// // // // Write report header. // // // //--------------------------------------------------------------------// private static void reportBodyMain( ReportCore.eRptFileFmt rptFileFmt, Object writer, // String symSetFilename, UInt16 symSetNo, UInt16 codeMin, UInt16 codeMax, UInt16 codeCt, UInt64 charCollReq, Boolean flagIgnoreC0, Boolean flagIgnoreC1, Boolean flagMapHex, PCLSymSetTypes.eIndex symSetType) { const Int32 maxLineLen = 80; // ***************** constant elsewhere ??????????????? //----------------------------------------------------------------// // // // Write out the title. // // // //----------------------------------------------------------------// ReportCore.hddrTitle(writer, rptFileFmt, true, "Symbol set details:"); //----------------------------------------------------------------// // // // Write out the symbol set basic details. // // // //----------------------------------------------------------------// ReportCore.tableHddrPair(writer, rptFileFmt); ReportCore.tableRowPair(writer, rptFileFmt, "SymSetNo", symSetNo.ToString(), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "SymSetId", PCLSymbolSets.translateKind1ToId(symSetNo).ToString(), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "IgnoreC0Codes", (flagIgnoreC0 ? "true" : "false"), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "IgnoreC1Codes", (flagIgnoreC1 ? "true" : "false"), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "FirstCode", (flagMapHex ? "0x" + codeMin.ToString("x4") : codeMin.ToString()), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "Lastcode", (flagMapHex ? "0x" + codeMax.ToString("x4") : codeMax.ToString()), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "CharCount", (flagMapHex ? "0x" + codeCt.ToString("x4") : codeCt.ToString()), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableRowPair(writer, rptFileFmt, "CharReqBits", "0x" + charCollReq.ToString("x16"), _colSpanNone, _colSpanNone, _maxSizeNameTag, maxLineLen, _flagNone, _flagNone, _flagNone); ReportCore.tableClose(writer, rptFileFmt); }
//--------------------------------------------------------------------// // M e t h o d // // r e a d A n d S t o r e S y m S e t M a p // //--------------------------------------------------------------------// // // // Read PCL symbol set map array and store in 'user-defined' symbol // // set item. // // Also set the symbol set type from analysis of the first and last // // code values. // // // //--------------------------------------------------------------------// private static Boolean readAndStoreSymSetMap(Int64 mapOffset, UInt16 symSetNo, UInt16 firstCode, UInt16 lastCode) { const Int32 rangeC1Min = 0x80; const Int32 rangeC1Max = 0x9f; Boolean OK = true; Boolean usesC1Range = false; PCLSymSetTypes.eIndex symSetType; UInt16 mapCode; Int32 codeCt, mapBytes, mapIndx, mapPos; codeCt = lastCode - firstCode + 1; mapBytes = codeCt * 2; Byte [] buf = new Byte [mapBytes]; UInt16 [] map = new UInt16 [lastCode + 1]; _ipStream.Seek(mapOffset, SeekOrigin.Begin); _binReader.Read(buf, 0, mapBytes); //----------------------------------------------------------------// for (Int32 i = 0; i <= lastCode; i++) { map [i] = 0xffff; } for (Int32 i = 0; i < codeCt; i++) { mapPos = i * 2; mapCode = (UInt16)((buf [mapPos] * 256) + buf [mapPos + 1]); mapIndx = firstCode + i; if (((mapIndx >= rangeC1Min) && (mapIndx <= rangeC1Max)) && (mapCode != 0xffff)) { usesC1Range = true; } map [mapIndx] = mapCode; } //----------------------------------------------------------------// if (lastCode > 0xff) { symSetType = PCLSymSetTypes.eIndex.Bound_16bit; } else if ((firstCode >= 0x20) && (lastCode <= 0x7f)) { symSetType = PCLSymSetTypes.eIndex.Bound_7bit; } else if ((firstCode >= 0x20) || (usesC1Range)) { symSetType = PCLSymSetTypes.eIndex.Bound_PC8; } else { symSetType = PCLSymSetTypes.eIndex.Bound_8bit; } //----------------------------------------------------------------// PCLSymbolSets.setDataUserSet(symSetNo, symSetType, map); return(OK); }
//--------------------------------------------------------------------// // M e t h o d // // p r o c e s s F o n t H e a d e r // //--------------------------------------------------------------------// // // // Provide an interpretation of the contents of the initial part of // // the font header. // // // //--------------------------------------------------------------------// private void processFontHeader(ref Int32 bufLen, ref Int32 bufOffset) { Char c; Int32 ix1, ix2, ix3; Int32 indxSymSet; String itemDesc; //----------------------------------------------------------------// // // // Show size and (optionally) data. // // // //----------------------------------------------------------------// PrnParseCommon.addDataRow( PrnParseRowTypes.eType.DataBinary, _table, PrnParseConstants.eOvlShow.None, _indxOffsetFormat, _fileOffset + bufOffset, _analysisLevel, "PCLXL Binary", "[ " + _cHddrDescLen.ToString() + " bytes ]", "Font header"); if (_showBinData) { PrnParseData.processBinary( _table, PrnParseConstants.eOvlShow.None, _buf, _fileOffset, bufOffset, _cHddrDescLen, "", _showBinData, false, true, _indxOffsetFormat, _analysisLevel); } //----------------------------------------------------------------// // // // Determine the Header Format, and from this determine the // // position and size of parts of the header following the // // Descriptor. // // // //----------------------------------------------------------------// _hddrFormat = (ePCLXLFontFormat)_buf[bufOffset]; if (_hddrFormat == ePCLXLFontFormat.Download) { //------------------------------------------------------------// // // // Format 0 - Only format supported (as at v3.0). // // // //------------------------------------------------------------// _hddrDataLen = _hddrLen - _cHddrDescLen; _hddrDataRem = _hddrDataLen; } else { //------------------------------------------------------------// // // // Unknown format. // // // //------------------------------------------------------------// _validHddr = false; PrnParseCommon.addTextRow( PrnParseRowTypes.eType.MsgWarning, _table, PrnParseConstants.eOvlShow.None, "", "*** Warning ***", "", "Header format (" + _hddrFormat + ") is not recognised"); } if (!_validHddr) { PrnParseCommon.addTextRow( PrnParseRowTypes.eType.MsgWarning, _table, PrnParseConstants.eOvlShow.None, "", "*** Warning ***", "", "Processing of Font Header abandoned"); } else { //------------------------------------------------------------// // // // Header format (byte 0). // // // //------------------------------------------------------------// switch (_hddrFormat) { case ePCLXLFontFormat.Download: itemDesc = "0: PCLXL Download"; break; default: itemDesc = _hddrFormat + ": Unknown"; break; } PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", "Header Format:", "", itemDesc); //------------------------------------------------------------// // // // Orientation (byte 1). // // // // 0 = Portrait // // 1 = Landscape // // 2 = Reverse Portrait // // 3 = Reverse Landscape // // // //------------------------------------------------------------// ix1 = _buf[bufOffset + 1]; switch (ix1) { case 0: itemDesc = "0: Portrait"; break; case 1: itemDesc = "1: Landscape"; break; case 2: itemDesc = "2: Reverse Portrait"; break; case 3: itemDesc = "3: Reverse Landscape"; break; default: itemDesc = ix1 + ": Unknown"; break; } PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", "Orientation:", "", itemDesc); //------------------------------------------------------------// // // // Mapping (bytes 2-3). // // // // Two part: 11-bit number (binary). // // 5-bit letter-code: add 64 to this to obtain the // // (ASCII) character-code of the letter. // // // // e.g. value of 0x000E --> 0N // // 0x0115 --> 8U // // 0x0155 --> 10U // // 0x01F1 --> 15Q // // // // Symbol sets where the letter part equates to 'Q' are // // reserved for 'Specials'. // // // //------------------------------------------------------------// ix1 = (_buf[bufOffset + 2] * 256) + _buf[bufOffset + 3]; ix2 = ix1 >> 5; ix3 = (ix1 & 0x1f) + 64; c = (Char)ix3; indxSymSet = PCLSymbolSets.getIndexForId((UInt16)ix1); PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", "Mapping:", "Kind1 value:", ix1.ToString() + " (0x" + ix1.ToString("x2") + ")"); if ((indxSymSet) == -1) { PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", " ---->", "Identifier:", ix2.ToString() + c); } else { PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", " ---->", "Identifier:", ix2.ToString() + c + " (" + PCLSymbolSets.getName(indxSymSet) + ")"); } //------------------------------------------------------------// // // // Scaling Technology (byte 4). // // Variety (byte 5). Expected to be zero. // // // //------------------------------------------------------------// ePCLXLFontTechnology scaling = (ePCLXLFontTechnology)_buf[bufOffset + 4]; ix2 = _buf[bufOffset + 5]; switch (scaling) { case ePCLXLFontTechnology.TrueType: itemDesc = "1: TrueType"; break; case ePCLXLFontTechnology.Bitmap: itemDesc = "254: Bitmap"; break; default: itemDesc = scaling.ToString() + ": Unknown"; break; } PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", "Scaling:", "Technology:", itemDesc); PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", "", "Variety:", ix2.ToString()); //----------------------------------------------------------------------// // // // Number of Characters (bytes 6-7). // // // //----------------------------------------------------------------------// ix1 = (_buf[bufOffset + 6] * 256) + _buf[bufOffset + 7]; PrnParseCommon.addTextRow( PrnParseRowTypes.eType.PCLXLFontHddr, _table, PrnParseConstants.eOvlShow.None, "", "Character Count:", "", ix1.ToString()); } }