Beispiel #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);
        }
Beispiel #2
0
 public Class908(Interface34 text, Matrix4D transformation)
 {
     this.interface34_0 = text;
     this.matrix4D_0    = transformation;
 }