Пример #1
0
        private void AddWidthsArrayObject(
            PDF pdf,
            Font font,
            OTF otf,
            int codePage)
        {
            pdf.Newobj();
            pdf.Append("[ ");
            int n = 1;

            for (int c = otf.firstChar; c < 256; c++)
            {
                if (c < 127)
                {
                    pdf.Append((int)
                               ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[c]));
                }
                else
                {
                    if (codePage == 0)
                    {
                        pdf.Append((int)((1000.0f / otf.unitsPerEm)
                                         * otf.glyphWidth[CP1250.codes[c - 127]]));
                    }
                    else if (codePage == 1)
                    {
                        pdf.Append((int)((1000.0f / otf.unitsPerEm)
                                         * otf.glyphWidth[CP1251.codes[c - 127]]));
                    }
                    else if (codePage == 2)
                    {
                        pdf.Append((int)((1000.0f / otf.unitsPerEm)
                                         * otf.glyphWidth[CP1252.codes[c - 127]]));
                    }
                    else if (codePage == 3)
                    {
                        pdf.Append((int)((1000.0f / otf.unitsPerEm)
                                         * otf.glyphWidth[CP1253.codes[c - 127]]));
                    }
                    else if (codePage == 4)
                    {
                        pdf.Append((int)((1000.0f / otf.unitsPerEm)
                                         * otf.glyphWidth[CP1254.codes[c - 127]]));
                    }
                    else if (codePage == 7)
                    {
                        pdf.Append((int)((1000.0f / otf.unitsPerEm)
                                         * otf.glyphWidth[CP1257.codes[c - 127]]));
                    }
                }
                if (n < 10)
                {
                    pdf.Append(' ');
                    ++n;
                }
                else
                {
                    pdf.Append('\n');
                    n = 1;
                }
            }
            pdf.Append("]\n");
            pdf.Endobj();

            font.SetWidthsArrayObjNumber(pdf.objNumber);
        }
Пример #2
0
        private void AddWidthsArrayObject(
            PDF pdf,
            Font font,
            OTF otf,
            int codePage)
        {
            pdf.Newobj();
            pdf.Append("[ ");
            int n = 1;
            for (int c = otf.firstChar; c < 256; c++) {
            if (c < 127) {
                pdf.Append((int)
                        ((1000.0f / otf.unitsPerEm) * otf.glyphWidth[c]));
            } else {
                if (codePage == 0) {
                    pdf.Append((int) ((1000.0f / otf.unitsPerEm)
                            * otf.glyphWidth[CP1250.codes[c - 127]]));
                } else if (codePage == 1) {
                    pdf.Append((int) ((1000.0f / otf.unitsPerEm)
                            * otf.glyphWidth[CP1251.codes[c - 127]]));
                } else if (codePage == 2) {
                    pdf.Append((int) ((1000.0f / otf.unitsPerEm)
                            * otf.glyphWidth[CP1252.codes[c - 127]]));
                } else if (codePage == 3) {
                    pdf.Append((int) ((1000.0f / otf.unitsPerEm)
                            * otf.glyphWidth[CP1253.codes[c - 127]]));
                } else if (codePage == 4) {
                    pdf.Append((int) ((1000.0f / otf.unitsPerEm)
                            * otf.glyphWidth[CP1254.codes[c - 127]]));
                } else if (codePage == 7) {
                    pdf.Append((int) ((1000.0f / otf.unitsPerEm)
                            * otf.glyphWidth[CP1257.codes[c - 127]]));
                }
            }
            if (n < 10) {
                pdf.Append(' ');
                ++n;
            }
            else {
                pdf.Append('\n');
                n = 1;
            }
            }
            pdf.Append("]\n");
            pdf.Endobj();

            font.SetWidthsArrayObjNumber(pdf.objNumber);
        }