Exemple #1
0
        public static WoutWareFont CreateWWF(
            string fontFileName,
            IEnumerable <char> characters)
        {
            ns4.Class26 textMetrics = new ns4.Class26(fontFileName, false, false);
            if (textMetrics.IsFallback)
            {
                throw new Exception("Font with filename " + fontFileName + " could not be found or read, a fall back font was used, and therefore the font conversion is aborted.");
            }
            Class593 class593 = new Class593(textMetrics);
            ICollection <Typeface> typefaces    = new FontFamily(class593.SystemFont.FontFamily.Name).GetTypefaces();
            WoutWareFont           woutWareFont = new WoutWareFont();

            woutWareFont.Ascent  = textMetrics.Ascent;
            woutWareFont.Descent = textMetrics.Descent;
            Matrix2D transformation = new Matrix2D(1.0, 0.0, 0.0, -1.0);

            foreach (char character in characters)
            {
                bool flag   = false;
                int  uint16 = (int)Convert.ToUInt16(character);
                foreach (Typeface typeface in (IEnumerable <Typeface>)typefaces)
                {
                    GlyphTypeface glyphTypeface;
                    ushort        num;
                    if (typeface.TryGetGlyphTypeface(out glyphTypeface) && glyphTypeface != null && glyphTypeface.CharacterToGlyphMap.TryGetValue(uint16, out num))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    Interface34 text = class593.GetText(character.ToString(), WW.Cad.Model.Colors.White, (short)0, false);
                    if (text.Advance != Vector2D.Zero)
                    {
                        IShape2D      outline = (IShape2D) new GeneralShape2D(text.TransformedPath, transformation, true);
                        WoutWareGlyph glyph   = new WoutWareGlyph(character, outline, text.CanonicalAdvance);
                        woutWareFont.AddGlyph(glyph);
                    }
                }
            }
            return(woutWareFont);
        }
Exemple #2
0
        public void Draw(Class385 context)
        {
            Font     systemFont = this.class908_0.Font.SystemFont;
            Graphics graphics   = context.Graphics;
            Matrix4D transform1 = context.Transform;

            if (systemFont != null)
            {
                double      fontHeight = this.class908_0.Font.Metrics.FontHeight;
                ns4.Class26 metrics    = (ns4.Class26) this.class908_0.Font.Metrics;
                double      num        = metrics.CanonicalScaling * fontHeight;
                Matrix4D    matrix4D   = transform1 * this.class908_0.Transformation * Transformation4D.Scaling(num, -num, num);
                Matrix      transform2 = graphics.Transform;
                using (Matrix matrix = new Matrix((float)matrix4D.M00, (float)matrix4D.M10, (float)matrix4D.M01, (float)matrix4D.M11, (float)matrix4D.M03, (float)matrix4D.M13))
                {
                    graphics.Transform         = matrix;
                    context.solidBrush_0.Color = this.color_0;
                    graphics.DrawString(this.class908_0.Text.Text, systemFont, (Brush)context.solidBrush_0, metrics.BaseLineOffset.X, metrics.BaseLineOffset.Y, StringFormat.GenericTypographic);
                }
                graphics.Transform = transform2;
                if (this.class908_0.Linings.Length <= 0)
                {
                    return;
                }
                context.pen_0.Color = this.color_0;
                context.method_3(this.short_0);
                this.class908_0.method_1((IPathDrawer) new Class1036.Class1037(graphics, context.pen_0), transform1, 0.0);
            }
            else
            {
                context.pen_0.Color = this.color_0;
                context.method_3(this.short_0);
                IPathDrawer drawer = (IPathDrawer) new Class1036.Class1037(graphics, context.pen_0);
                this.class908_0.method_0(drawer, transform1, 0.0);
                if (this.class908_0.Linings.Length <= 0)
                {
                    return;
                }
                this.class908_0.method_1(drawer, transform1, 0.0);
            }
        }
Exemple #3
0
 internal Class26(string fontFileName, Class596 settings)
     : base(settings)
 {
     this.class1060_0 = Class26.smethod_0(fontFileName, settings.Bold, settings.Italic);
 }
Exemple #4
0
 internal Class26(string fontFileName, bool bold, bool italic)
     : base(1.0)
 {
     this.class1060_0 = Class26.smethod_0(fontFileName, bold, italic);
 }
Exemple #5
0
 public Class26(Class596 settings, bool useBigfont)
     : base(settings)
 {
     this.class1060_0 = Class26.smethod_0(useBigfont ? settings.BigFontFilename : settings.FontFileName, settings.Bold, settings.Italic);
 }
Exemple #6
0
 public Class593(Class26 textMetrics)
 {
     this.class26_0 = textMetrics;
 }