iTextSharp.text.pdf.CFFFontSubset.BuildNewLGSubrs C# (CSharp) Метод

BuildNewLGSubrs() защищенный Метод

protected BuildNewLGSubrs ( int Font ) : void
Font int
Результат void
        protected void BuildNewLGSubrs(int Font)
        {
            // If the font is CID then the lsubrs are divided into FontDicts.
            // for each FD array the lsubrs will be subsetted.
            if (fonts[Font].isCID)
            {
                // Init the hasmap-array and the arraylist-array to hold the subrs used
                // in each private dict.
                hSubrsUsed = new Dictionary<int,int[]>[fonts[Font].fdprivateOffsets.Length];
                lSubrsUsed = new List<int>[fonts[Font].fdprivateOffsets.Length];
                // A [][] which will store the byte array for each new FD Array lsubs index
                NewLSubrsIndex = new byte[fonts[Font].fdprivateOffsets.Length][];
                // An array to hold the offset for each Lsubr index
                fonts[Font].PrivateSubrsOffset = new int[fonts[Font].fdprivateOffsets.Length];
                // A [][] which will store the offset array for each lsubr index
                fonts[Font].PrivateSubrsOffsetsArray = new int[fonts[Font].fdprivateOffsets.Length][];

                // Put the FDarrayUsed into a list
                List<int> FDInList = new List<int>(FDArrayUsed.Keys);
                // For each FD array which is used subset the lsubr
                for (int j=0;j<FDInList.Count;j++)
                {
                    // The FDArray index, Hash Map, Arrat List to work on
                    int FD = FDInList[j];
                    hSubrsUsed[FD] = new Dictionary<int,int[]>();
                    lSubrsUsed[FD] = new List<int>();
                    //Reads the private dicts looking for the subr operator and
                    // store both the offest for the index and its offset array
                    BuildFDSubrsOffsets(Font,FD);
                    // Verify that FDPrivate has a LSubrs index
                    if (fonts[Font].PrivateSubrsOffset[FD]>=0)
                    {
                        //Scans the Charsting data storing the used Local and Global subroutines
                        // by the glyphs. Scans the Subrs recursivley.
                        BuildSubrUsed(Font,FD,fonts[Font].PrivateSubrsOffset[FD],fonts[Font].PrivateSubrsOffsetsArray[FD],hSubrsUsed[FD],lSubrsUsed[FD]);
                        // Builds the New Local Subrs index
                        NewLSubrsIndex[FD] = BuildNewIndex(fonts[Font].PrivateSubrsOffsetsArray[FD],hSubrsUsed[FD],RETURN_OP);
                    }
                }
            }
            // If the font is not CID && the Private Subr exists then subset:
            else if (fonts[Font].privateSubrs>=0)
            {
                // Build the subrs offsets;
                fonts[Font].SubrsOffsets = GetIndex(fonts[Font].privateSubrs);
                //Scans the Charsting data storing the used Local and Global subroutines
                // by the glyphs. Scans the Subrs recursivley.
                BuildSubrUsed(Font,-1,fonts[Font].privateSubrs,fonts[Font].SubrsOffsets,hSubrsUsedNonCID,lSubrsUsedNonCID);
            }
            // For all fonts susbset the Global Subroutines
            // Scan the Global Subr Hashmap recursivly on the Gsubrs
            BuildGSubrsUsed(Font);
            if (fonts[Font].privateSubrs>=0)
                // Builds the New Local Subrs index
                NewSubrsIndexNonCID = BuildNewIndex(fonts[Font].SubrsOffsets,hSubrsUsedNonCID,RETURN_OP);
            //Builds the New Global Subrs index
            NewGSubrsIndex = BuildNewIndex(gsubrOffsets,hGSubrsUsed,RETURN_OP);
        }