Ejemplo n.º 1
0
        internal override System.Drawing.Rectangle getBounds(DrawContext context, System.Drawing.Drawing2D.Matrix transform)
        {
#if PENDING
            System.Drawing.Rectangle r = System.Drawing.Rectangle.Empty;

            //UPGRADE_TODO: Class 'java.awt.font.FontRenderContext' was converted to 'System.Windows.Forms.Control' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_3"'
            //UPGRADE_ISSUE: Constructor 'java.awt.font.FontRenderContext.FontRenderContext' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtfontFontRenderContextFontRenderContext_javaawtgeomAffineTransform_boolean_boolean_3"'
            System.Drawing.Text.TextRenderingHint frc = new FontRenderContext(transform, false, true);
            for (int i = 0; i < glyphCodes.Length; i++)
            {
                //UPGRADE_ISSUE: Class 'java.awt.font.GlyphVector' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javaawtfontGlyphVector_3"'
                //UPGRADE_TODO: Method 'java.awt.Font.createGlyphVector' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095_3"'
                GlyphVector gv = font.createGlyphVector(frc, new int[] { glyphCodes[i] });
                System.Drawing.Rectangle gr = gv.getPixelBounds(frc, positions[i * 2], positions[i * 2 + 1]);

                if (r.IsEmpty)
                {
                    r = gr;
                }
                else
                {
                    r = System.Drawing.Rectangle.Union(r, gr);
                }
            }
            if (r.IsEmpty)
            {
                return(new System.Drawing.Rectangle());
            }

            Filter filter = context.AAFilter;

            // Compensate for the antialiasing filter
            if (filter != null)
            {
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042_3"'
                //UPGRADE_NOTE: ref keyword was added to struct-type parameters. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1303_3"'
                r = addMargin(ref r, (int)System.Math.Ceiling(filter.Width), (int)System.Math.Ceiling(filter.Height));
            }
            return(r);
#endif
            return(new System.Drawing.Rectangle());
        }