本文整理汇总了C#中UIFont类的典型用法代码示例。如果您正苦于以下问题:C# UIFont类的具体用法?C# UIFont怎么用?C# UIFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIFont类属于命名空间,在下文中一共展示了UIFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadMoreElement
public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("")
{
this.NormalCaption = normalCaption;
this.LoadingCaption = loadingCaption;
this.tapped = tapped;
this.font = font;
cell = new UITableViewCell (UITableViewCellStyle.Default, "loadMoreElement");
activityIndicator = new UIActivityIndicatorView () {
ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray,
Hidden = true
};
activityIndicator.StopAnimating ();
caption = new UILabel () {
Font = font,
Text = this.NormalCaption,
TextColor = textColor,
BackgroundColor = UIColor.Clear,
TextAlignment = UITextAlignment.Center,
AdjustsFontSizeToFitWidth = false,
};
Layout ();
cell.ContentView.AddSubview (caption);
cell.ContentView.AddSubview (activityIndicator);
}
示例2: InitFonts
private void InitFonts()
{
_font1 = UIFont.FromName ("HelveticaNeue", 18f);
_font2 = UIFont.FromName ("HelveticaNeue-Medium", 18f);
_font3 = UIFont.FromName ("HelveticaNeue-Bold", 18f);
_roubleFont = UIFont.FromName("Ruble", 18f);
}
示例3: AddText
public static UIImage AddText(this UIImage image, string text, PointF point, UIFont font, UIColor color, UITextAlignment alignment = UITextAlignment.Left)
{
//var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, image.Size.Height - point.Y));
var h = text.StringHeight(font, image.Size.Width);
var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, h));
var label = new UILabel(labelRect)
{
Font = font,
Text = text,
TextColor = color,
TextAlignment = alignment,
BackgroundColor = UIColor.Clear
};
var labelImage = label.ToNativeImage();
using (var context = image.Size.ToBitmapContext())
{
var rect = new RectangleF(new PointF(0, 0), image.Size);
context.DrawImage(rect, image.CGImage);
context.DrawImage(labelRect, labelImage.CGImage);
context.StrokePath();
return UIImage.FromImage(context.ToImage());
}
}
示例4: CreateFont
static void CreateFont(UIFont font, int create, Material mat)
{
if (create == 1)
{
// New dynamic font
font.atlas = null;
font.dynamicFont = NGUISettings.dynamicFont;
font.dynamicFontSize = NGUISettings.dynamicFontSize;
font.dynamicFontStyle = NGUISettings.dynamicFontStyle;
}
else
{
// New bitmap font
font.dynamicFont = null;
BMFontReader.Load(font.bmFont, NGUITools.GetHierarchy(font.gameObject), NGUISettings.fontData.bytes);
if (create == 2)
{
font.atlas = null;
font.material = mat;
}
else if (create == 3)
{
font.spriteName = NGUISettings.fontTexture.name;
font.atlas = NGUISettings.atlas;
}
}
}
示例5: ContentSize
public static float ContentSize(string text, float width, UIFont font)
{
var stringToSize = new NSString (text);
var size = stringToSize.StringSize (font, new SizeF (width, float.MaxValue), UILineBreakMode.WordWrap);
return size.Height;
}
示例6: Load
static void Load ()
{
mLoaded = true;
mPartial = EditorPrefs.GetString("NGUI Partial");
mFontName = EditorPrefs.GetString("NGUI Font Name");
mAtlasName = EditorPrefs.GetString("NGUI Atlas Name");
mFontData = GetObject("NGUI Font Asset") as TextAsset;
mFontTexture = GetObject("NGUI Font Texture") as Texture2D;
mFont = GetObject("NGUI Font") as UIFont;
mAtlas = GetObject("NGUI Atlas") as UIAtlas;
mAtlasPadding = EditorPrefs.GetInt("NGUI Atlas Padding", 1);
mAtlasTrimming = EditorPrefs.GetBool("NGUI Atlas Trimming", true);
mAtlasPMA = EditorPrefs.GetBool("NGUI Atlas PMA", true);
mUnityPacking = EditorPrefs.GetBool("NGUI Unity Packing", true);
mForceSquare = EditorPrefs.GetBool("NGUI Force Square Atlas", true);
mPivot = (UIWidget.Pivot)EditorPrefs.GetInt("NGUI Pivot", (int)mPivot);
mLayer = EditorPrefs.GetInt("NGUI Layer", -1);
mDynFont = GetObject("NGUI DynFont") as Font;
mDynFontSize = EditorPrefs.GetInt("NGUI DynFontSize", 16);
mDynFontStyle = (FontStyle)EditorPrefs.GetInt("NGUI DynFontStyle", (int)FontStyle.Normal);
if (mLayer < 0 || string.IsNullOrEmpty(LayerMask.LayerToName(mLayer))) mLayer = -1;
if (mLayer == -1) mLayer = LayerMask.NameToLayer("UI");
if (mLayer == -1) mLayer = LayerMask.NameToLayer("GUI");
if (mLayer == -1) mLayer = 5;
EditorPrefs.SetInt("UI Layer", mLayer);
LoadColor();
}
示例7: Font
UIFont font = null; //UIFont.SystemFontOfSize(20);
#endregion Fields
#region Constructors
public Font(string fontname,int fontsize)
{
font =UIFont.FromName(fontname,fontsize);
if(font==null)font=UIFont.SystemFontOfSize(fontsize);
maxcharheight =(int)font.LineHeight;
//if (gbmp == null)
{
// gdata = new byte[128 * 128 * 4];
// var colorSpace = CGColorSpace.CreateDeviceRGB();
// gbmp = new CGBitmapContext(gdata, 128, 128,
// 8, 128 * 4, colorSpace, CGBitmapFlags.PremultipliedLast);
//gbmp =new Bitmap(128,128);
//gfont = Graphics.FromImage(gbmp);
//gfont.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
//gfont.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
}
//GdiFont = new System.Drawing.Font(fontname, fontsize,GraphicsUnit.Pixel);
//maxcharheight = GdiFont.Height;
//设置文本输出质量
//g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
//g.SmoothingMode = SmoothingMode.AntiAlias;
//Font newFont = new Font("Times New Roman", 48);
}
示例8: Initialize
/// <summary>
/// Initializes the panel's controls.
/// </summary>
/// <param name="titleFont">The font to use for the settings panel title.</param>
/// <param name="labelTemplate">The template to use for all settings labels.</param>
public void Initialize(UIFont titleFont, UILabel labelTemplate) {
this.backgroundSprite = "MenuPanel";
this.isVisible = false;
this.canFocus = true;
this.isInteractive = true;
this.height = TitleBarHeight + 8f;
this.width = PanelWidth;
this.CreatePanelTitle(titleFont);
this.CreateDragHandle();
this.CreateCloseButton();
this.CreateControlPanel();
int zOrder = 1;
this.defaultVisibilityCheckBox = this.CreateSettingsControl(
CityVitalsWatch.Settings.DefaultPanelVisibility, "Default Visibility", true, labelTemplate, ref zOrder);
this.transparentUnhoveredCheckBox = this.CreateSettingsControl(
CityVitalsWatch.Settings.TransparentUnhovered, "Transparent Unhovered", true, labelTemplate, ref zOrder);
this.statControlMap = new Dictionary<CityVitalsWatchStat, UICheckBox>();
foreach (CityVitalsWatchStat stat in Enum.GetValues(typeof(CityVitalsWatchStat)).Cast<CityVitalsWatchStat>()) {
this.statControlMap[stat] = this.CreateSettingsControl(
CityVitalsWatch.Settings.StatDisplayed(stat), StatLocaleIdMap[stat], false, labelTemplate, ref zOrder);
}
}
示例9: RegisterFont
public static void RegisterFont(UIFont font)
{
if (font.UseDynamicFont && !_fontList.Contains(font.dynamicFont))
{
_fontList.Add(font.dynamicFont);
font.dynamicFont.textureRebuildCallback += OnFontRebuilt;
}
}
示例10: LoadMoreElement
public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("")
{
NormalCaption = normalCaption;
LoadingCaption = loadingCaption;
Tapped += tapped;
Font = font;
TextColor = textColor;
}
示例11: OnSelectFont
void OnSelectFont(Object obj) {
// Undo doesn't work correctly in this case... so I won't bother.
//NGUIEditorTools.RegisterUndo("Font Change");
//NGUIEditorTools.RegisterUndo("Font Change", mFont);
mFont.replacement = obj as UIFont;
mReplacement = mFont.replacement;
NGUITools.SetDirty(mFont);
}
示例12: CustomCell
static CustomCell()
{
if (font == null)
font = UIFont.BoldSystemFontOfSize(UIFont.SystemFontSize);
if (background == null)
background = UIImage.FromFile(@"Images/cell-background.png");
if (textColor == null)
textColor = UIColor.FromRGBA(255, 255, 255, 32);
}
示例13: LoadMoreElement
public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor)
: base (UITableViewCellStyle.Default, key.ToString())
{
NormalCaption = normalCaption;
LoadingCaption = loadingCaption;
Tapped += tapped;
Font = font;
TextColor = textColor;
}
示例14: GetLineHeight
protected virtual float GetLineHeight(UIFont font)
{
if (Math.Abs(font.PointSize - AppDelegate.Font16pt) < 0.5)
{
return 26;
}
return 15;
}
示例15: OnFontRebuilt
public static void OnFontRebuilt(UIFont font)
{
UILabel[] list = GameObject.FindObjectsOfType(typeof(UILabel)) as UILabel[];
foreach (UILabel label in list)
{
if (label.font == font)
label.MarkAsChanged();
}
}