public void RegisterFont(EFonts _font, string _fileName, int _pointSize)
        {
            if (!File.Exists(_fileName))
            {
                throw new ApplicationException("Не найден файл " + Path.GetFullPath(_fileName));
            }
            var charSet = new List <char>();

            for (var c = ' '; c < '}'; ++c)
            {
                charSet.Add(c);
            }
            for (var c = 'А'; c <= 'я'; ++c)
            {
                charSet.Add(c);
            }
            var s   = new string(charSet.ToArray());
            var qfc = new QFontBuilderConfiguration
            {
                charSet = s,
                TextGenerationRenderHint = TextGenerationRenderHint.SizeDependent | TextGenerationRenderHint.AntiAlias,
                SuperSampleLevels        = 4,
            };
            var qFont = new QFont(_fileName, _pointSize, FontStyle.Bold, qfc);

            m_fonts[_font] = qFont;
        }
		public void RegisterFont(EFonts _font, string _fileName, int _pointSize)
		{
            if(!File.Exists(_fileName))
            {
                throw new ApplicationException("Не найден файл " + Path.GetFullPath(_fileName));
            }
			var charSet = new List<char>();
			for (var c = ' '; c < '}'; ++c)
			{
				charSet.Add(c);
			}
			for (var c = 'А'; c <= 'я'; ++c)
			{
				charSet.Add(c);
			}
			var s = new string(charSet.ToArray());
			var qfc = new QFontBuilderConfiguration
			              {
			          		charSet = s,
                            TextGenerationRenderHint = TextGenerationRenderHint.SizeDependent | TextGenerationRenderHint.AntiAlias,
							SuperSampleLevels = 4,
			          	};
			var qFont = new QFont(_fileName, _pointSize, FontStyle.Bold, qfc);

			m_fonts[_font] = qFont;
		}
Ejemplo n.º 3
0
	    public void DrawString(EFonts _font, string _string, float _x, float _y, FColor _color)
		{
			var qFont = m_resourceProvider[_font];
			QFont.Begin();
			qFont.Options.Colour = new Color4(_color.R, _color.G, _color.B, _color.A);
			qFont.Print(_string, new OpenTK.Vector2(_x, _y));
			QFont.End();
		}
Ejemplo n.º 4
0
        public void DrawString(EFonts _font, string _string, float _x, float _y, FColor _color)
        {
            var qFont = m_resourceProvider[_font];

            QFont.Begin();
            qFont.Options.Colour = new Color4(_color.R, _color.G, _color.B, _color.A);
            qFont.Print(_string, new OpenTK.Vector2(_x, _y));
            QFont.End();
        }
Ejemplo n.º 5
0
        public void SplitByLines(float _width, EFonts _font, float _newLineIndent, IDrawHelper _drawHelper)
        {
            var textLines = new List <TextLine>();

            var paragraphs = Text.Split(new[] { Environment.NewLine, "\t" }, StringSplitOptions.RemoveEmptyEntries);

            var sb = new StringBuilder();

            foreach (var paragraph in paragraphs)
            {
                sb.Clear();
                var x = _newLineIndent;

                var tl = new TextLine(x, Highlights);
                textLines.Add(tl);

                var part           = paragraph.Split(Punctuation);
                var processedChars = 0;
                for (var partIndex = 0; partIndex < part.Length; partIndex++)
                {
                    var addStr = part[partIndex];
                    processedChars += addStr.Length;
                    addStr         += (processedChars == 0 || processedChars >= paragraph.Length)
                                                        ? ""
                                                        : paragraph[processedChars].ToString(CultureInfo.InvariantCulture);
                    processedChars++;
                    var size = _drawHelper.MeasureString(_font, addStr);

                    if (size.Width > (_width - x))
                    {
                        tl.Text = sb.ToString();
                        sb.Clear();
                        x  = 0;
                        tl = new TextLine(x, Highlights);
                        textLines.Add(tl);
                    }
                    sb.Append(addStr);
                    x += size.Width;
                }

                if (sb.Length > 0)
                {
                    tl.Text = sb.ToString();
                }
            }
            m_textLines = textLines.ToArray();
        }
Ejemplo n.º 6
0
		public void SplitByLines(float _width, EFonts _font, float _newLineIndent, IDrawHelper _drawHelper)
		{
			var textLines = new List<TextLine>();

			var paragraphs = Text.Split(new[] {Environment.NewLine, "\t"}, StringSplitOptions.RemoveEmptyEntries);

			var sb = new StringBuilder();
			foreach (var paragraph in paragraphs)
			{
				sb.Clear();
				var x = _newLineIndent;

				var tl = new TextLine(x, Highlights);
				textLines.Add(tl);

				var part = paragraph.Split(Punctuation);
				var processedChars = 0;
				for (var partIndex = 0; partIndex < part.Length; partIndex++)
				{
					var addStr = part[partIndex];
					processedChars += addStr.Length;
					addStr += (processedChars == 0 || processedChars >= paragraph.Length)
					          	? ""
					          	: paragraph[processedChars].ToString(CultureInfo.InvariantCulture);
					processedChars++;
					var size = _drawHelper.MeasureString(_font, addStr);

					if (size.Width > (_width - x))
					{
						tl.Text = sb.ToString();
						sb.Clear();
						x = 0;
						tl = new TextLine(x, Highlights);
						textLines.Add(tl);
					}
					sb.Append(addStr);
					x += size.Width;
				}

				if (sb.Length > 0)
				{
					tl.Text = sb.ToString();
				}
			}
			m_textLines = textLines.ToArray();
		}
Ejemplo n.º 7
0
		public SizeF MeasureString(EFonts _font, string _string)
		{
			var qFont = m_resourceProvider[_font];
			return qFont.Measure(_string);
		}
		public QFont this[EFonts _font]
		{
			get { return m_fonts[_font]; }
		}
Ejemplo n.º 9
0
 protected UiBlockWithText(Rct _rct, Frame _frame, FColor _color, EFonts _font = EFonts.COMMON) : base(_rct, _frame, _color)
 {
     Font       = _font;
     LineHeight = DrawHelper.MeasureString(_font, "Ay").Height;
 }
Ejemplo n.º 10
0
 public QFont this[EFonts _font]
 {
     get { return(m_fonts[_font]); }
 }
Ejemplo n.º 11
0
		protected UiBlockWithText(Rct _rct, Frame _frame, FColor _color, EFonts _font = EFonts.COMMON) : base(_rct, _frame, _color)
		{
			Font = _font;
			LineHeight = DrawHelper.MeasureString(_font, "Ay").Height;
		}
Ejemplo n.º 12
0
        public SizeF MeasureString(EFonts _font, string _string)
        {
            var qFont = m_resourceProvider[_font];

            return(qFont.Measure(_string));
        }