public HeadsUpDisplayText(Vector2 pos, float depth, FontEnum font, int startValue)
 {
     pos_ = pos;
     depth_ = depth;
     font_ = font;
     newValue_ = startValue;
 }
示例#2
0
        public static Font GetFontDataAsMediaFont(FontEnum fontName = FontEnum.BNazanin)
        {
            if (_fonts != null)
            {
                var height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
                var width  = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

                FontEnum adaptableFont = fontName;

                if (width >= 1366 && height >= 768)
                {
                    adaptableFont = FontEnum.BYekan;
                }
                foreach (var item in _fonts.Families)
                {
                    if (item.Name.ToLower().Trim().Replace(" ", "").Equals(adaptableFont.ToString().ToLower().Trim().Replace(" ", "")))
                    {
                        return(new Font(
                                   new FontFamily(item.Name),
                                   13,
                                   FontStyle.Regular,
                                   GraphicsUnit.Pixel));
                    }
                }
            }
            return(new Font("Tahoma", 10));
        }
示例#3
0
 /// <summary>
 /// Gets the GameFont used for drawing text
 /// </summary>
 /// <param name="fontName">The font you want to draw</param>
 /// <returns>The GameFont used for actually drawing the text</returns>
 public GameFont getFont(FontEnum fontName)
 {
     if (!fonts_.ContainsKey(fontName))
     {
         return null;
     }
     return fonts_[fontName];
 }
示例#4
0
 /// <summary>
 /// Gets the GameFont used for drawing text
 /// </summary>
 /// <param name="fontName">The font you want to draw</param>
 /// <returns>The GameFont used for actually drawing the text</returns>
 public GameFont getFont(FontEnum fontName)
 {
     if (!m_fonts.ContainsKey(fontName))
     {
         return null;
     }
     return m_fonts[fontName];
 }
示例#5
0
 /// <summary>
 /// Get sprite font based on font enum
 /// </summary>
 /// <param name="font"></param>
 /// <returns></returns>
 public static SpriteFont GetFont(FontEnum font)
 {
     if (_fontDict.ContainsKey(font))
     {
         return(_fontDict[font]);
     }
     else
     {
         return(null);
     }
 }
示例#6
0
 /// <summary>
 /// Print lines to a set pos
 /// </summary>
 /// <param name="cornerpos"></param>
 /// <param name="sbatch"></param>
 /// <param name="font"></param>
 public void PrintLines(int[] cornerpos, SpriteBatch sbatch, FontEnum font = FontEnum.Font20)
 {
     for (int index = _page * _limit; index < (_page + 1) * _limit; index++)
     {
         CommonUtilities.DrawFont(
             _lines[index],
             font,
             new Vector2(cornerpos[0], cornerpos[1] + index * (int)font),
             Color.Black,
             sbatch);
     }
 }
示例#7
0
 public static System.Drawing.FontFamily GetFontData(FontEnum fontName = FontEnum.BNazanin)
 {
     if (_fonts != null)
     {
         foreach (var item in _fonts.Families)
         {
             if (item.Name.ToLower().Trim().Replace(" ", "").Equals(fontName.ToString().ToLower().Trim().Replace(" ", "")))
             {
                 return(item);
             }
         }
     }
     return(new System.Drawing.Font("Tahoma", 10).FontFamily);
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name               = binaryReader.ReadStringID();
     this.TextBounds         = binaryReader.ReadVector2();
     this.Justification      = ((JustificationEnum)(binaryReader.ReadInt16()));
     this.Font               = ((FontEnum)(binaryReader.ReadInt16()));
     this.TextColor          = binaryReader.ReadColourR1G1B1();
     this.ShadowColor        = binaryReader.ReadColourR1G1B1();
     this.FadeInTimeseconds  = binaryReader.ReadSingle();
     this.UpTimeseconds      = binaryReader.ReadSingle();
     this.FadeOutTimeseconds = binaryReader.ReadSingle();
     this.padding            = binaryReader.ReadBytes(2);
     return(pointerQueue);
 }
示例#9
0
 /// <summary>
 /// Draws a string at defined pos
 /// </summary>
 /// <param name="text"></param>
 /// <param name="font"></param>
 /// <param name="position"></param>
 /// <param name="color"></param>
 /// <param name="sbatch"></param>
 public static void DrawFont(string text, FontEnum font, Vector2 position, Color color, SpriteBatch sbatch)
 {
     sbatch.Begin();
     sbatch.DrawString(GameFonts.GetFont(font), text, position, color);
     sbatch.End();
 }
示例#10
0
        protected Font GetFont(FontEnum mtype)
        {
            Font mFont = null;
            switch (mtype)
            {
                case FontEnum.TitleCenter:
                    mFont = new Font(bfSun, 18);
                    mFont.SetStyle("normal");
                    break;
                case FontEnum.TitleLeft1:
                    mFont = new Font(bfSun, 16);
                    mFont.SetStyle("bold");
                    break;
                case FontEnum.TitleLeft2:
                    mFont = new Font(bfSun, 14);
                    mFont.SetStyle("normal");
                    break;
                case FontEnum.Title12Bold:
                    mFont = new Font(bfSun, 12);
                    mFont.SetStyle("bold");
                    break;
                case FontEnum.TableHeader:
                    mFont = new Font(bfSun, 12);
                    mFont.SetStyle("bold");
                    break;

                case FontEnum.TableIndex:
                    mFont = new Font(bfSun, 11);
                    mFont.SetStyle("bold");
                    break;

                case FontEnum.TableSM:
                    mFont = new Font(bfSun, 9);
                    mFont.SetStyle("normal");
                    break;
                default:
                    mFont = new Font(bfSun, 12);
                    mFont.SetStyle("normal");
                    break;

            }
            return mFont;
        }
示例#11
0
 public SpriteFont GetFont(FontEnum font)
 {
     return(_fonts[font]);
 }
示例#12
0
        public Main()
        {
            Plates           = new ObservableCollection <Plate>();
            SubtitleMinScore = 0.55;
            PreferenceToHashMatchedSubtitle = true;

            // ALPR
            //Observable.Interval(TimeSpan.FromSeconds(1.5)).Subscribe(i =>
            //{
            //    if (ShowPlate == true)
            //    {
            //        ShowPlate = false;
            //    }
            //});

            Equalizer         = new Equalizer();
            SubtitleColor     = Colors.White;
            AutoLoadSubtitles = true;
            SubtitleLanguages = new List <ITag>()
            {
                new Tag()
                {
                    Id = "eng", Name = "English"
                }
            };
            AllSubtitleServices = new List <ITag>()
            {
                new Tag()
                {
                    Id = "Podnapisi", Name = "Podnapisi"
                }, new Tag()
                {
                    Id = "OpenSubtitles", Name = "OpenSubtitles"
                }
            };
            SubtitleServices = new List <ITag>()
            {
                new Tag()
                {
                    Id = "Podnapisi", Name = "Podnapisi"
                }, new Tag()
                {
                    Id = "OpenSubtitles", Name = "OpenSubtitles"
                }
            };
            AllLanguages = new List <ITag> {
                new Tag("bos", "Bosnian"),
                new Tag("slv", "Slovenian"),
                new Tag("hrv", "Croatian"),
                new Tag("srp", "Serbian"),
                new Tag("eng", "English"),
                new Tag("spa", "Spanish"),
                new Tag("fre", "French"),
                new Tag("gre", "Greek"),
                new Tag("ger", "German"),
                new Tag("rus", "Russian"),
                new Tag("chi", "Chinese"),
                new Tag("por", "Portuguese"),
                new Tag("dut", "Dutch"),
                new Tag("ita", "Italian"),
                new Tag("rum", "Romanian"),
                new Tag("cze", "Czech"),
                new Tag("ara", "Arabic"),
                new Tag("pol", "Polish"),
                new Tag("tur", "Turkish"),
                new Tag("swe", "Swedish"),
                new Tag("fin", "Finnish"),
                new Tag("hun", "Hungarian"),
                new Tag("dan", "Danish"),
                new Tag("heb", "Hebrew"),
                new Tag("est", "Estonian"),
                new Tag("slo", "Slovak"),
                new Tag("ind", "Indonesian"),
                new Tag("per", "Persian"),
                new Tag("bul", "Bulgarian"),
                new Tag("jpn", "Japanese"),
                new Tag("alb", "Albanian"),
                new Tag("bel", "Belarusian"),
                new Tag("hin", "Hindi"),
                new Tag("gle", "Irish"),
                new Tag("ice", "Icelandic"),
                new Tag("cat", "Catalan"),
                new Tag("kor", "Korean"),
                new Tag("lav", "Latvian"),
                new Tag("lit", "Lithuanian"),
                new Tag("mac", "Macedonian"),
                new Tag("nor", "Norwegian"),
                new Tag("tha", "Thai"),
                new Tag("ukr", "Ukrainian"),
                new Tag("vie", "Vietnamese")
            };

            var ISO839_1 = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
            var l        = LanguageISOTranslator.ISO839_1[ISO839_1];

            if (l != null)
            {
                var l2 = AllLanguages.FirstOrDefault(o => o.Id == l.ISO639_2B);
                if (l2 != null)
                {
                    SubtitleLanguages.Insert(0, l2);
                }
            }

            _previousExecutionState = NativeMethods.SetThreadExecutionState(NativeMethods.ES_CONTINUOUS | NativeMethods.ES_SYSTEM_REQUIRED);
            _view = ServiceLocator.GetService <IMainView>();
            _dlg  = ServiceLocator.GetService <IDialogService>();
            var allEnc = new List <EncodingInfo>(Encoding.GetEncodings());
            var enc    = allEnc[allEnc.FindIndex(e => e.CodePage == Encoding.Default.CodePage)];

            allEnc.Remove(enc);
            allEnc.Insert(0, enc);
            var fonts = new List <System.Windows.Media.FontFamily>(System.Windows.Media.Fonts.SystemFontFamilies);

            _fontEnum = new FontEnum();
            _fontEnum.GetFonts();

            var uniqueNames = _fontEnum.FontFamilies.GroupBy(f => f.FontName).Select(g => g.First().FontName).OrderBy(f => f).ToArray();

            fonts = fonts.Where(f => uniqueNames.Contains(f.Source)).ToList();

            if (!fonts.Any(f => f.ToString().ToLowerInvariant().Contains("buxton sketch")))
            {
                fonts.Add(new System.Windows.Media.FontFamily(new Uri("pack://application:,,,/MediaPoint;component/Resources/BuxtonSketch.ttf", UriKind.RelativeOrAbsolute), "Buxton Sketch"));
            }

            string fontCacheFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            fontCacheFile = Path.Combine(fontCacheFile, Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location));
            fontCacheFile = Path.Combine(fontCacheFile, "font.cache");
            PreBuildFonts(fonts.ToArray(), fontCacheFile);
            SubtitleSize = 20;
            Encodings    = Enum.GetValues(typeof(FontCharSet)).Cast <FontCharSet>().ToArray();
            Player       = new Player(this);
            Playlist     = new Playlist(Player);
            SubEncoding  = Encodings[1];
            InitShortcuts();
            var updateThread = new Thread((() =>
            {
                while (!_exiting)
                {
                    try
                    {
                        // update time
                        Time = string.Format("{0:00}:{1:00}", DateTime.Now.Hour, DateTime.Now.Minute);
                        // periodically ping screensaver to not happen during playback
                        ScreenSaver.SetScreenSaverActive(ScreenSaver.GetScreenSaverActive());
                        Thread.Sleep(5000);
                    }
                    catch
                    {
                        Thread.Sleep(10000);
                    }
                }
            }))
            {
                IsBackground = true, Priority = ThreadPriority.BelowNormal
            };

            updateThread.Start();
        }
 /// <summary>
 /// You should use the other constructor
 /// </summary>
 public HeadsUpDisplayText()
 {
     font_ = FontEnum.Kootenay14;
     newValue_ = 0;
 }