本文整理汇总了C#中FontType类的典型用法代码示例。如果您正苦于以下问题:C# FontType类的具体用法?C# FontType怎么用?C# FontType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FontType类属于命名空间,在下文中一共展示了FontType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
public Rectangle this[FontType type]
{
get
{
return m_BiggestCharSize[(int)type];
}
}
示例2: ChangeFont
public void ChangeFont(FontType fontType)
{
TextEquation.FontType = fontType;
ActiveChild.FontSize = FontSize;
CalculateSize();
AdjustCarets();
}
示例3: FontSetup
public FontSetup(FontInfo fontInfo, FontType proxyFontType) {
this.fontInfo = fontInfo;
// Add the base 14 fonts
AddBase14Fonts();
AddSystemFonts(proxyFontType);
}
示例4: ThemeFontSettingsImpl
public ThemeFontSettingsImpl(string name, FontType fontType, DefaultFontInfo defaultFontInfo) {
if (name == null)
throw new ArgumentNullException(nameof(name));
Name = name;
FontType = fontType;
toSettings = new Dictionary<Guid, FontSettingsImpl>();
this.defaultFontInfo = defaultFontInfo;
}
示例5: StyleType
public StyleType()
{
_protection = new ProtectionType();
_numberFormat = new NumberFormatType();
_interior = new InteriorType();
_font = new FontType();
_borders = new List<BorderType>();
_alignment = new AlignmentType();
}
示例6: DrawText
/// <summary>
/// Drawn text using given font, position and color
/// </summary>
public void DrawText(FontType font, String text, Vector2 position, Color color, bool dropShadow)
{
if (mIsTextModeActive)
{
if (dropShadow)
mSpriteBatch.DrawString(Fonts[(int)font], text, position + mDropShadowOffset, new Color(color.ToVector4() * new Vector4(0, 0, 0, 1)));
mSpriteBatch.DrawString(Fonts[(int)font], text, position, color);
}
}
示例7: 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);
if (mReplacement == null) mType = FontType.Bitmap;
}
示例8: OnSelectFont
void OnSelectFont (MonoBehaviour 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;
UnityEditor.EditorUtility.SetDirty(mFont);
if (mReplacement == null) mType = FontType.Normal;
}
示例9: GetFontFamily
public static FontFamily GetFontFamily(FontType fontType)
{
if (fontFamilies.Keys.Contains(fontType))
{
return fontFamilies[fontType];
}
else
{
return new FontFamily("Segoe UI");
}
}
示例10: TextFormat
public TextFormat(double size, FontType ft, FontStyle fs, FontWeight fw, SolidColorBrush brush, bool useUnderline)
{
this.FontSize = Math.Round(size, 1);
this.FontType = ft;
this.FontFamily = FontFactory.GetFontFamily(ft);
this.FontStyle = fs;
this.UseUnderline = useUnderline;
this.FontWeight = fw;
this.TextBrush = brush;
this.TypeFace = new Typeface(FontFamily, fs, fw, FontStretches.Normal, FontFactory.GetFontFamily(FontType.STIXGeneral));
BrushConverter bc = new BrushConverter();
TextBrushString = bc.ConvertToString(brush);
}
示例11: MessureString
public static SizeF MessureString(int maxLength, FontType fontType, View3D view, float scale)
{
float width = 0, height = 0;
Rectangle charSize = Effect.TextFont[fontType];
height = (float)charSize.Height;
width = (float)charSize.Width * maxLength;
width *= scale;
height *= scale;
return new SizeF(width, height);
}
示例12: SubtitleFont
public SubtitleFont(FontType t, string fn)
{
type = t;
fontName = fn;
letters = new LinkedList<SubtitleLetter>();
if (type == FontType.ProgramFont)
fileName = Application.StartupPath + "\\" + fontName + ".font.txt";
else
fileName = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SupRip\\" + fontName + ".font.txt";
if (File.Exists(fileName))
{
StreamReader sr = new StreamReader(fileName);
string text;
// Skip past the version line
text = sr.ReadLine();
while ((text = sr.ReadLine()) != null)
{
string[] arraySize = sr.ReadLine().Trim().Split(' ');
if (arraySize.Length != 2)
throw new FontfileFormatException("arraySize is screwed up: " + arraySize);
int w = Int32.Parse(arraySize[0]);
int h = Int32.Parse(arraySize[1]);
byte[,] letterArray = new byte[h, w];
for (int j = 0; j < h; j++)
{
string[] arrayLine = sr.ReadLine().Trim().Split(' ');
if (arrayLine.Length != w)
throw new FontfileFormatException("arrayLine is " + arrayLine.Length + " instead of " + w);
for (int i = 0; i < w; i++)
letterArray[j, i] = Byte.Parse(arrayLine[i]);
}
letters.AddLast(new SubtitleLetter(letterArray, text));
// Skip the empty line between letters
sr.ReadLine();
}
sr.Close();
}
}
示例13: GetFontPicList
public static List<LoactedPic> GetFontPicList(string value, FontType fontType)
{
List<LoactedPic> result = null;
List<ImageWithName> source = null;
if (fontType == FontType.Lv)
source = Cache.Get("ListLv") as List<ImageWithName>;
if (fontType == FontType.HP || fontType == FontType.ATK)
source = Cache.Get("ListNormal") as List<ImageWithName>;
if (source == null)
return result;
result = new List<LoactedPic>();
foreach (char c in value)
{
Image word = source.Find(item => item.Name == c.ToString()).Img;
LoactedPic lp = new LoactedPic(word);
result.Add(lp);
}
int firstX = 0, topY = 0;
switch (fontType)
{
case FontType.Lv:
firstX = 72 - result.Sum(item => item.Img.Width) / 2;
topY = 825;
break;
case FontType.HP:
firstX = 610 - result.Sum(item => item.Img.Width);
topY = 781;
break;
case FontType.ATK:
firstX = 390 - result.Sum(item => item.Img.Width);
topY = 838;
break;
}
int startX;
for (int i = 0; i < result.Count; i++)
{
if (i > 0)
startX = result[i - 1].EndX + 1;
else
startX = firstX;
result[i].StartX = startX;
result[i].StartY = topY;
}
return result;
}
示例14: GetTextureIndex
// get opengl texture index
internal static int GetTextureIndex(FontType FontType, int Codepoint)
{
int Font = (int)FontType;
string t = char.ConvertFromUtf32(Codepoint);
int i = char.ConvertToUtf32(t, 0);
if (i >= Characters[Font].Length || Characters[Font][i].Texture == -1) {
if (Characters[Font].Length == 0) {
Characters[Font] = new Character[i + 1];
for (int j = 0; j <= i; j++) {
Characters[Font][j].Texture = -1;
}
}
while (i >= Characters[Font].Length) {
int n = Characters[Font].Length;
Array.Resize<Character>(ref Characters[Font], 2 * n);
for (int j = n; j < 2 * n; j++) {
Characters[Font][j].Texture = -1;
}
}
float s1;
switch (Font) {
case 0: s1 = ExtraSmallFontSize; break;
case 1: s1 = SmallFontSize; break;
case 2: s1 = MediumFontSize; break;
case 3: s1 = LargeFontSize; break;
case 4: s1 = ExtraLargeFontSize; break;
default: s1 = SmallFontSize; break;
}
int s0w = Interface.RoundToPowerOfTwo((int)Math.Ceiling((double)s1 * 1.25));
int s0h = s0w;
FontStyle fs = Font == 0 ? FontStyle.Regular : FontStyle.Regular;
Bitmap b = new Bitmap(s0w, s0h, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(b);
g.Clear(Color.Black);
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
Font f = new Font(FontFamily.GenericSansSerif, s1, fs, GraphicsUnit.Pixel);
SizeF s = g.MeasureString(t, f, s0w, StringFormat.GenericTypographic);
g.DrawString(t, f, Brushes.White, 0.0f, 0.0f);
g.Dispose();
Characters[Font][i].Texture = TextureManager.RegisterTexture(b, false);
Characters[Font][i].Width = s.Width <= 0.05f ? 4.0f : (float)Math.Ceiling((double)s.Width);
Characters[Font][i].Height = s.Height <= 0.05f ? 4.0f : (float)Math.Ceiling((double)s.Height);
b.Dispose();
}
return Characters[Font][i].Texture;
}
示例15: OnEnable
void OnEnable ()
{
SerializedProperty bit = serializedObject.FindProperty("bitmapFont");
mType = (bit.objectReferenceValue != null) ? FontType.Bitmap : FontType.Dynamic;
mList = target as UIPopupList;
if (mList.ambigiousFont == null)
{
mList.ambigiousFont = NGUISettings.ambigiousFont;
mList.fontSize = NGUISettings.fontSize;
mList.fontStyle = NGUISettings.fontStyle;
EditorUtility.SetDirty(mList);
}
if (mList.atlas == null)
{
mList.atlas = NGUISettings.atlas;
mList.backgroundSprite = NGUISettings.selectedSprite;
mList.highlightSprite = NGUISettings.selectedSprite;
EditorUtility.SetDirty(mList);
}
}