Beispiel #1
0
            static public glyph_composite GetCompositeGlyphLogicalData(header h)
            {
                glyph_composite gc = null;

                CompositeGlyph cg = h.GetCompositeGlyph();

                if (cg != null)
                {
                    // glyph is a composite glyph

                    gc = new glyph_composite(h.xMin, h.yMin, h.xMax, h.yMax);

                    // copy any hinting instructions
                    if (cg.AnyComponentsHaveInstructions())
                    {
                        ushort nInstructions = cg.GetNumInstructions();
                        gc.m_arrInstructions = new byte[nInstructions];
                        for (uint i = 0; i < nInstructions; i++)
                        {
                            gc.m_arrInstructions[i] = cg.GetInstruction(i);
                        }
                    }

                    while (cg != null)
                    {
                        glyph_composite.component cc = new glyph_composite.component();
                        cc.flags   = cg.flags;
                        cc.glyphid = cg.glyphIndex;
                        cc.arg1    = cg.arg1;
                        cc.arg2    = cg.arg2;
                        if ((cg.flags & (ushort)CompositeGlyph.Flags.WE_HAVE_A_SCALE) != 0)
                        {
                            cc.scale = cg.scale;
                        }
                        else if ((cg.flags & (ushort)CompositeGlyph.Flags.WE_HAVE_AN_X_AND_Y_SCALE) != 0)
                        {
                            cc.xscale = cg.xscale;
                            cc.yscale = cg.yscale;
                        }
                        else if ((cg.flags & (ushort)CompositeGlyph.Flags.WE_HAVE_A_TWO_BY_TWO) != 0)
                        {
                            cc.xscale_2x2  = cg.xscale_2x2;
                            cc.scale01_2x2 = cg.scale01_2x2;
                            cc.scale10_2x2 = cg.scale10_2x2;
                            cc.yscale_2x2  = cg.yscale_2x2;
                        }

                        gc.m_arrComponents.Add(cc);

                        cg = cg.GetNextCompositeGlyph();
                    }
                }

                return(gc);
            }
Beispiel #2
0
            static public glyph_composite GetCompositeGlyphLogicalData(header h)
            {
                glyph_composite gc = null;

                CompositeGlyph cg = h.GetCompositeGlyph();
                if (cg != null)
                {
                    // glyph is a composite glyph

                    gc = new glyph_composite(h.xMin, h.yMin, h.xMax, h.yMax);

                    // copy any hinting instructions
                    if (cg.AnyComponentsHaveInstructions())
                    {
                        ushort nInstructions = cg.GetNumInstructions();
                        gc.m_arrInstructions = new byte[nInstructions];
                        for (uint i=0; i<nInstructions; i++)
                        {
                            gc.m_arrInstructions[i] = cg.GetInstruction(i);
                        }
                    }

                    while (cg != null)
                    {
                        glyph_composite.component cc = new glyph_composite.component();
                        cc.flags   = cg.flags;
                        cc.glyphid = cg.glyphIndex;
                        cc.arg1    = cg.arg1;
                        cc.arg2    = cg.arg2;
                        if ((cg.flags & (ushort)CompositeGlyph.Flags.WE_HAVE_A_SCALE) != 0)
                        {
                            cc.scale = cg.scale;
                        }
                        else if ((cg.flags & (ushort)CompositeGlyph.Flags.WE_HAVE_AN_X_AND_Y_SCALE) != 0)
                        {
                            cc.xscale = cg.xscale;
                            cc.yscale = cg.yscale;
                        }
                        else if ((cg.flags & (ushort)CompositeGlyph.Flags.WE_HAVE_A_TWO_BY_TWO) != 0)
                        {
                            cc.xscale_2x2  = cg.xscale_2x2;
                            cc.scale01_2x2 = cg.scale01_2x2;
                            cc.scale10_2x2 = cg.scale10_2x2;
                            cc.yscale_2x2  = cg.yscale_2x2;
                        }

                        gc.m_arrComponents.Add(cc);

                        cg = cg.GetNextCompositeGlyph();
                    }
                }

                return gc;
            }