Esempio n. 1
0
        private static GlyphRun CreateGlyphRun(Point origin, double fontSize, string unicodeString)
        {
            Uri           fontUri       = new Uri(EnvironmentWrapper.ExpandEnvironmentVariables(@"%windir%\fonts\cour.ttf"));
            GlyphTypeface glyphTypeface = new GlyphTypeface(fontUri);

            IList <ushort> glyphIndices = new List <ushort>();

            for (int i = 0; i < unicodeString.Length; ++i)
            {
                glyphIndices.Add(glyphTypeface.CharacterToGlyphMap[unicodeString[i]]);
            }

            IList <double> advanceWidths = new List <double>();

            for (int i = 0; i < glyphIndices.Count; ++i)
            {
                advanceWidths.Add(glyphTypeface.AdvanceWidths[glyphIndices[i]] * fontSize);
            }
            GlyphRun glyphRun = new GlyphRun(glyphTypeface,               //glyph typeface
                                             0,                           //bidi level
                                             false,                       //sideways
                                             fontSize,                    //font size
                                             glyphIndices,                //glyph indices
                                             origin,                      //baseline origin
                                             advanceWidths,               //advance widths
                                             null,                        //glyph offsets
                                             unicodeString.ToCharArray(), //test string
                                             null,                        //device font name
                                             null,                        //cmap
                                             null,                        //caret stop
                                             null                         //culture info
                                             );

            return(glyphRun);
        }
Esempio n. 2
0
        private static void SetDefaults()
        {
            if (FileSystem == null)
            {
                FileSystem = new FileSystem();
            }

            if (Environment == null)
            {
                Environment = new EnvironmentWrapper();
            }

            if (WebClientFactory == null)
            {
                WebClientFactory = new WebClientFactory();
            }
        }
Esempio n. 3
0
 public void Initialize()
 {
     environment = Substitute.For <EnvironmentWrapper>();
 }
 public MyClass(EnvironmentWrapper wrapper)
 {
     this.Environment = wrapper ?? new EnvironmentWrapper();
 }
Esempio n. 5
0
 public ExitCommand(EnvironmentWrapper manager)
 {
     this.manager = manager;
     Description = "Exits from client.";
 }
 public void Initialize()
 {
     environment = Substitute.For<EnvironmentWrapper>();
 }
Esempio n. 7
0
 /// <summary>
 /// Applications the exit.
 /// </summary>
 protected void AppExit()
 {
     EnvironmentWrapper.Exit(0);
 }
Esempio n. 8
0
 public ExitCommand(EnvironmentWrapper manager)
 {
     this.manager = manager;
     Description  = "Exits from client.";
 }