Ooui-tws-port/Ooui.Forms/Extensions/FontExtensions.cs

39 lines
949 B
C#
Raw Normal View History

2017-11-10 00:09:48 +00:00
using System;
using Xamarin.Forms;
namespace Ooui.Forms.Extensions
{
public static class FontExtensions
{
public static void SetStyleFont (this View view, Style style)
{
}
public static string ToOouiTextAlign (this TextAlignment align)
{
switch (align) {
case TextAlignment.Start:
default:
return "start";
case TextAlignment.Center:
return "center";
case TextAlignment.End:
return "end";
}
}
2017-11-10 01:23:41 +00:00
public static Size MeasureSize (this string text, Style style)
{
if (string.IsNullOrEmpty (text))
return Size.Zero;
var fontHeight = 16.0;
var charWidth = 8.0;
var width = text.Length * charWidth;
return new Size (width, fontHeight);
}
2017-11-10 00:09:48 +00:00
}
}