本文整理汇总了C#中FontType类的典型用法代码示例。如果您正苦于以下问题:C# FontType类的具体用法?C# FontType怎么用?C# FontType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FontType类属于命名空间,在下文中一共展示了FontType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1:
public Rectangle this[FontType type]
{
get
{
return m_BiggestCharSize[(int)type];
}
}
开发者ID:RugCode,项目名称:drg-pt,代码行数:7,代码来源:FontMatrix.cs
示例2: ChangeFont
public void ChangeFont(FontType fontType)
{
TextEquation.FontType = fontType;
ActiveChild.FontSize = FontSize;
CalculateSize();
AdjustCarets();
}
开发者ID:JackWangCUMT,项目名称:math-editor,代码行数:7,代码来源:EquationRoot.cs
示例3: FontSetup
public FontSetup(FontInfo fontInfo, FontType proxyFontType) {
this.fontInfo = fontInfo;
// Add the base 14 fonts
AddBase14Fonts();
AddSystemFonts(proxyFontType);
}
开发者ID:nholik,项目名称:Fo.Net,代码行数:7,代码来源:FontSetup.cs
示例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;
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:ThemeFontSettingsImpl.cs
示例5: StyleType
public StyleType()
{
_protection = new ProtectionType();
_numberFormat = new NumberFormatType();
_interior = new InteriorType();
_font = new FontType();
_borders = new List<BorderType>();
_alignment = new AlignmentType();
}
开发者ID:junshao,项目名称:Medidata.MsExcel2003.Xml,代码行数:9,代码来源:StyleType.cs
示例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);
}
}
开发者ID:Tengato,项目名称:Mechadrone1,代码行数:13,代码来源:FontManager.cs
示例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;
}
开发者ID:CryptArc,项目名称:UnitySlots,代码行数:11,代码来源:UIFontInspector.cs
示例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;
}
开发者ID:frizac-b,项目名称:gladiawar,代码行数:11,代码来源:UIFontInspector.cs
示例9: GetFontFamily
public static FontFamily GetFontFamily(FontType fontType)
{
if (fontFamilies.Keys.Contains(fontType))
{
return fontFamilies[fontType];
}
else
{
return new FontFamily("Segoe UI");
}
}
开发者ID:JackWangCUMT,项目名称:math-editor,代码行数:11,代码来源:FontFactory.cs
示例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);
}
开发者ID:JackWangCUMT,项目名称:math-editor,代码行数:13,代码来源:TextFormat.cs
示例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);
}
开发者ID:RugCode,项目名称:drg-pt,代码行数:14,代码来源:TextRenderHelper.cs
示例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();
}
}
开发者ID:peterdk,项目名称:SupRip,代码行数:50,代码来源:SubtitleFont.cs
示例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;
}
开发者ID:pxhpjx,项目名称:MACardFiller,代码行数:50,代码来源:ImageTools.cs
示例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;
}
开发者ID:sladen,项目名称:openbve-objectviewer,代码行数:47,代码来源:Fonts.cs
示例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);
}
}
开发者ID:ivanchan2,项目名称:SRW_Project,代码行数:22,代码来源:UIPopupListInspector.cs
示例16: AddSystemFonts
/// <summary>
/// Adds all the system fonts to the FontInfo object.
/// </summary>
/// <remarks>
/// Adds metrics for basic fonts and useful family-style-weight
/// triplets for lookup.
/// </remarks>
/// <param name="fontType">Determines what type of font to instantiate.</param>
private void AddSystemFonts(FontType fontType) {
GdiFontEnumerator enumerator = new GdiFontEnumerator(new GdiDeviceContent());
foreach (string familyName in enumerator.FamilyNames) {
if (IsBase14FontName(familyName)) {
FonetDriver.ActiveDriver.FireFonetWarning(
"Will ignore TrueType font '" + familyName + "' because a base 14 font with the same name already exists.");
}
else {
FontStyles styles = enumerator.GetStyles(familyName);
string name = GetNextAvailableName();
fontInfo.AddMetrics(name, new ProxyFont(new FontProperties(familyName, false, false), fontType));
fontInfo.AddFontProperties(name, familyName, "normal", "normal");
name = GetNextAvailableName();
fontInfo.AddMetrics(name, new ProxyFont(new FontProperties(familyName, true, false), fontType));
fontInfo.AddFontProperties(name, familyName, "normal", "bold");
name = GetNextAvailableName();
fontInfo.AddMetrics(name, new ProxyFont(new FontProperties(familyName, false, true), fontType));
fontInfo.AddFontProperties(name, familyName, "italic", "normal");
name = GetNextAvailableName();
fontInfo.AddMetrics(name, new ProxyFont(new FontProperties(familyName, true, true), fontType));
fontInfo.AddFontProperties(name, familyName, "italic", "bold");
}
}
// Cursive - Monotype Corsiva
fontInfo.AddMetrics("F15", new ProxyFont(new FontProperties("Monotype Corsiva", false, false), fontType));
fontInfo.AddFontProperties("F15", "cursive", "normal", "normal");
// Fantasy - Zapf Dingbats
fontInfo.AddMetrics("F16", Base14Font.ZapfDingbats);
fontInfo.AddFontProperties("F16", "fantasy", "normal", "normal");
}
开发者ID:nholik,项目名称:Fo.Net,代码行数:45,代码来源:FontSetup.cs
示例17: GetFormattedText
public static FormattedText GetFormattedText(string textToFormat, FontType fontType, double fontSize, FontStyle fontStyle, FontWeight fontWeight, Brush brush)
{
Typeface typeface = GetTypeface(fontType, fontStyle, fontWeight);
return new FormattedText(textToFormat, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, typeface, fontSize, brush);
}
开发者ID:JackWangCUMT,项目名称:math-editor,代码行数:5,代码来源:FontFactory.cs
示例18: DrawFont
void DrawFont ()
{
if (NGUIEditorTools.DrawHeader("Font"))
{
NGUIEditorTools.BeginContents();
SerializedProperty ttf = null;
GUILayout.BeginHorizontal();
{
if (NGUIEditorTools.DrawPrefixButton("Font"))
{
if (mType == FontType.Bitmap)
{
ComponentSelector.Show<UIFont>(OnBitmapFont);
}
else
{
ComponentSelector.Show<Font>(OnDynamicFont, new string[] { ".ttf", ".otf"});
}
}
#if DYNAMIC_FONT
GUI.changed = false;
mType = (FontType)EditorGUILayout.EnumPopup(mType, GUILayout.Width(62f));
if (GUI.changed)
{
GUI.changed = false;
if (mType == FontType.Bitmap)
{
serializedObject.FindProperty("trueTypeFont").objectReferenceValue = null;
}
else
{
serializedObject.FindProperty("bitmapFont").objectReferenceValue = null;
}
}
#else
mType = FontType.Bitmap;
#endif
if (mType == FontType.Bitmap)
{
NGUIEditorTools.DrawProperty("", serializedObject, "bitmapFont", GUILayout.MinWidth(40f));
}
else
{
ttf = NGUIEditorTools.DrawProperty("", serializedObject, "trueTypeFont", GUILayout.MinWidth(40f));
}
}
GUILayout.EndHorizontal();
if (ttf != null && ttf.objectReferenceValue != null)
{
GUILayout.BeginHorizontal();
{
EditorGUI.BeginDisabledGroup(ttf.hasMultipleDifferentValues);
NGUIEditorTools.DrawProperty("Font Size", serializedObject, "fontSize", GUILayout.Width(142f));
NGUIEditorTools.DrawProperty("", serializedObject, "fontStyle", GUILayout.MinWidth(40f));
NGUIEditorTools.DrawPadding();
EditorGUI.EndDisabledGroup();
}
GUILayout.EndHorizontal();
}
else NGUIEditorTools.DrawProperty("Font Size", serializedObject, "fontSize", GUILayout.Width(142f));
NGUIEditorTools.DrawProperty("Text Color", serializedObject, "textColor");
GUILayout.BeginHorizontal();
NGUIEditorTools.SetLabelWidth(66f);
EditorGUILayout.PrefixLabel("Padding");
NGUIEditorTools.SetLabelWidth(14f);
NGUIEditorTools.DrawProperty("X", serializedObject, "padding.x", GUILayout.MinWidth(30f));
NGUIEditorTools.DrawProperty("Y", serializedObject, "padding.y", GUILayout.MinWidth(30f));
NGUIEditorTools.DrawPadding();
NGUIEditorTools.SetLabelWidth(80f);
GUILayout.EndHorizontal();
NGUIEditorTools.EndContents();
}
}
开发者ID:ivanchan2,项目名称:SRW_Project,代码行数:83,代码来源:UIPopupListInspector.cs
示例19: ShouldDrawProperties
/// <summary>
/// Draw the label's properties.
/// </summary>
protected override bool ShouldDrawProperties ()
{
mLabel = mWidget as UILabel;
GUILayout.BeginHorizontal();
if (NGUIEditorTools.DrawPrefixButton("Font"))
{
if (mFontType == FontType.NGUI)
{
ComponentSelector.Show<UIFont>(OnNGUIFont);
}
else
{
ComponentSelector.Show<Font>(OnUnityFont, new string[] { ".ttf", ".otf" });
}
}
#if DYNAMIC_FONT
mFontType = (FontType)EditorGUILayout.EnumPopup(mFontType, GUILayout.Width(62f));
#else
mFontType = FontType.NGUI;
#endif
bool isValid = false;
SerializedProperty fnt = null;
SerializedProperty ttf = null;
if (mFontType == FontType.NGUI)
{
fnt = NGUIEditorTools.DrawProperty("", serializedObject, "mFont", GUILayout.MinWidth(40f));
if (fnt.objectReferenceValue != null)
{
NGUISettings.ambigiousFont = fnt.objectReferenceValue;
isValid = true;
}
}
else
{
ttf = NGUIEditorTools.DrawProperty("", serializedObject, "mTrueTypeFont", GUILayout.MinWidth(40f));
if (ttf.objectReferenceValue != null)
{
NGUISettings.ambigiousFont = ttf.objectReferenceValue;
isValid = true;
}
}
GUILayout.EndHorizontal();
EditorGUI.BeginDisabledGroup(!isValid);
{
UIFont uiFont = (fnt != null) ? fnt.objectReferenceValue as UIFont : null;
Font dynFont = (ttf != null) ? ttf.objectReferenceValue as Font : null;
if (uiFont != null && uiFont.isDynamic)
{
dynFont = uiFont.dynamicFont;
uiFont = null;
}
if (dynFont != null)
{
GUILayout.BeginHorizontal();
{
EditorGUI.BeginDisabledGroup((ttf != null) ? ttf.hasMultipleDifferentValues : fnt.hasMultipleDifferentValues);
SerializedProperty prop = NGUIEditorTools.DrawProperty("Font Size", serializedObject, "mFontSize", GUILayout.Width(142f));
NGUISettings.fontSize = prop.intValue;
prop = NGUIEditorTools.DrawProperty("", serializedObject, "mFontStyle", GUILayout.MinWidth(40f));
NGUISettings.fontStyle = (FontStyle)prop.intValue;
GUILayout.Space(18f);
EditorGUI.EndDisabledGroup();
}
GUILayout.EndHorizontal();
NGUIEditorTools.DrawProperty("Material", serializedObject, "mMaterial");
}
else if (uiFont != null)
{
GUILayout.BeginHorizontal();
SerializedProperty prop = NGUIEditorTools.DrawProperty("Font Size", serializedObject, "mFontSize", GUILayout.Width(142f));
EditorGUI.BeginDisabledGroup(true);
if (!serializedObject.isEditingMultipleObjects)
GUILayout.Label(" Default: " + mLabel.defaultFontSize);
EditorGUI.EndDisabledGroup();
NGUISettings.fontSize = prop.intValue;
GUILayout.EndHorizontal();
}
bool ww = GUI.skin.textField.wordWrap;
GUI.skin.textField.wordWrap = true;
//.........这里部分代码省略.........
开发者ID:CryptArc,项目名称:UnitySlots,代码行数:101,代码来源:UILabelInspector.cs
示例20: OnInspectorGUI
public override void OnInspectorGUI ()
{
mFont = target as UIFont;
NGUIEditorTools.SetLabelWidth(80f);
GUILayout.Space(6f);
if (mFont.replacement != null)
{
mType = FontType.Reference;
mReplacement = mFont.replacement;
}
else if (mFont.dynamicFont != null)
{
mType = FontType.Dynamic;
}
GUI.changed = false;
GUILayout.BeginHorizontal();
mType = (FontType)EditorGUILayout.EnumPopup("Font Type", mType);
NGUIEditorTools.DrawPadding();
GUILayout.EndHorizontal();
if (GUI.changed)
{
if (mType == FontType.Bitmap)
OnSelectFont(null);
if (mType != FontType.Dynamic && mFont.dynamicFont != null)
mFont.dynamicFont = null;
}
if (mType == FontType.Reference)
{
ComponentSelector.Draw<UIFont>(mFont.replacement, OnSelectFont, true);
GUILayout.Space(6f);
EditorGUILayout.HelpBox("You can have one font simply point to " +
"another one. This is useful if you want to be " +
"able to quickly replace the contents of one " +
"font with another one, for example for " +
"swapping an SD font with an HD one, or " +
"replacing an English font with a Chinese " +
"one. All the labels referencing this font " +
"will update their references to the new one.", MessageType.Info);
if (mReplacement != mFont && mFont.replacement != mReplacement)
{
NGUIEditorTools.RegisterUndo("Font Change", mFont);
mFont.replacement = mReplacement;
NGUITools.SetDirty(mFont);
}
return;
}
else if (mType == FontType.Dynamic)
{
#if UNITY_3_5
EditorGUILayout.HelpBox("Dynamic fonts require Unity 4.0 or higher.", MessageType.Error);
#else
Font fnt = EditorGUILayout.ObjectField("TTF Font", mFont.dynamicFont, typeof(Font), false) as Font;
if (fnt != mFont.dynamicFont)
{
NGUIEditorTools.RegisterUndo("Font change", mFont);
mFont.dynamicFont = fnt;
}
Material mat = EditorGUILayout.ObjectField("Material", mFont.material, typeof(Material), false) as Material;
if (mFont.material != mat)
{
NGUIEditorTools.RegisterUndo("Font Material", mFont);
mFont.material = mat;
}
GUILayout.BeginHorizontal();
int size = EditorGUILayout.IntField("Default Size", mFont.defaultSize, GUILayout.Width(120f));
FontStyle style = (FontStyle)EditorGUILayout.EnumPopup(mFont.dynamicFontStyle);
NGUIEditorTools.DrawPadding();
GUILayout.EndHorizontal();
if (size != mFont.defaultSize)
{
NGUIEditorTools.RegisterUndo("Font change", mFont);
mFont.defaultSize = size;
}
if (style != mFont.dynamicFontStyle)
{
NGUIEditorTools.RegisterUndo("Font change", mFont);
mFont.dynamicFontStyle = style;
}
#endif
}
else
{
ComponentSelector.Draw<UIAtlas>(mFont.atlas, OnSelectAtlas, true);
if (mFont.atlas != null)
{
//.........这里部分代码省略.........
开发者ID:hanbim520,项目名称:UFLua,代码行数:101,代码来源:UIFontInspector.cs
注:本文中的FontType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论