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

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

protected ReadFDSelect ( int Font ) : void
Font int
Результат void
        protected void ReadFDSelect(int Font)
        {
            // Restore the number of glyphs
            int NumOfGlyphs = fonts[Font].nglyphs;
            int[] FDSelect = new int[NumOfGlyphs];
            // Go to the beginning of the FDSelect
            Seek(fonts[Font].fdselectOffset);
            // Read the FDSelect's format
            fonts[Font].FDSelectFormat = GetCard8();

            switch (fonts[Font].FDSelectFormat){
                // Format==0 means each glyph has an entry that indicated
                // its FD.
                case 0:
                    for (int i=0;i<NumOfGlyphs;i++)
                    {
                        FDSelect[i] = GetCard8();
                    }
                    // The FDSelect's Length is one for each glyph + the format
                    // for later use
                    fonts[Font].FDSelectLength = fonts[Font].nglyphs+1;
                    break;
                case 3:
                    // Format==3 means the ranges version
                    // The number of ranges
                    int nRanges = GetCard16();
                    int l=0;
                    // Read the first in the first range
                    int first = GetCard16();
                    for (int i=0;i<nRanges;i++)
                    {
                        // Read the FD index
                        int fd = GetCard8();
                        // Read the first of the next range
                        int last = GetCard16();
                        // Calc the steps and write to the array
                        int steps = last-first;
                        for (int k=0;k<steps;k++)
                        {
                            FDSelect[l] = fd;
                            l++;
                        }
                        // The last from this iteration is the first of the next
                        first = last;
                    }
                    // Store the length for later use
                    fonts[Font].FDSelectLength = 1+2+nRanges*3+2;
                    break;
                default:
                    break;
            }
            // Save the FDSelect of the font
            fonts[Font].FDSelect = FDSelect;
        }