Example #1
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // w r i t e H d d r                                                  //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Generate font header descriptor, segmented data and checksum byte. //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void writeHddr(Boolean glyphZeroExists,
                               Boolean symSetUnbound,
                               Boolean tabvmtxPresent,
                               Boolean flagVMetrics,
                               UInt16 numChars,
                               UInt16 symSet,
                               Byte[]  fontNameXL,
                               Byte[]  conversionText)
        {
            Byte mod256 = 0;

            Byte[] hddrDesc   = new Byte[cSizeHddrDesc];
            Byte[] panoseData = new Byte[ToolSoftFontGenTTF.cSizePanose];

            //----------------------------------------------------------------//
            //                                                                //
            // Write BeginFontHeader Operator and associated Attribute List.  //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.fontHddrBegin(_binWriter,
                                      false,
                                      cSizeFontname,
                                      fontNameXL,
                                      0);

            //----------------------------------------------------------------//
            //                                                                //
            // Write Format 0 font header.                                    //
            //                                                                //
            //----------------------------------------------------------------//

            hddrDesc[0] = 0;                    // Format
            hddrDesc[1] = (Byte)PCLXLAttrEnums.eVal.ePortraitOrientation;
            hddrDesc[2] = msByte(symSet);       // Symbol set MSB
            hddrDesc[3] = lsByte(symSet);       // Symbol Set LSB
            hddrDesc[4] = 1;                    // Scaling = TrueType
            hddrDesc[5] = 0;                    // Variety
            hddrDesc[6] = msByte(numChars);     // NumChars MSB
            hddrDesc[7] = lsByte(numChars);     // NumChars LSB

            _baseHandler.writeHddrFragment(true,
                                           cSizeHddrDesc,
                                           hddrDesc,
                                           ref mod256);

            //----------------------------------------------------------------//
            //                                                                //
            // Write segmented data.                                          //
            //                                                                //
            //----------------------------------------------------------------//

            mod256 = 0; // not actually required for PCL XL

            panoseData = _ttfHandler.PanoseData;

            _baseHandler.writeHddrSegments(true,
                                           true,
                                           false,
                                           glyphZeroExists,
                                           symSetUnbound,
                                           tabvmtxPresent,
                                           flagVMetrics,
                                           0,          // not used for PCL XL //
                                           conversionText,
                                           panoseData,
                                           ref mod256);

            //----------------------------------------------------------------//
            //                                                                //
            // Write BeginFontHeader Operator and associated Attribute List.  //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.fontHddrEnd(_binWriter,
                                    false);
        }