// =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== void OnEnable() { script = target as MadFont; inputType = serializedObject.FindProperty("inputType"); texture = serializedObject.FindProperty("texture"); forceWhite = serializedObject.FindProperty("forceWhite"); glyphs = serializedObject.FindProperty("glyphs"); linesCount = serializedObject.FindProperty("linesCount"); fillFactorTolerance = serializedObject.FindProperty("fillFactorTolerance"); fntFile = serializedObject.FindProperty("fntFile"); }
// =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== void OnEnable() { script = target as MadFont; if (script.created) { ReloadColors(); } inputType = serializedObject.FindProperty("inputType"); texture = serializedObject.FindProperty("texture"); forceWhite = serializedObject.FindProperty("forceWhite"); glyphs = serializedObject.FindProperty("glyphs"); linesCount = serializedObject.FindProperty("linesCount"); fillFactorTolerance = serializedObject.FindProperty("fillFactorTolerance"); fntFile = serializedObject.FindProperty("fntFile"); }
// =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== void OnEnable() { script = target as MadFont; if (script.created) { primaryColor = script.material.GetColor("_PrimaryColor"); secondaryColor = script.material.GetColor("_SecondaryColor"); } inputType = serializedObject.FindProperty("inputType"); texture = serializedObject.FindProperty("texture"); forceWhite = serializedObject.FindProperty("forceWhite"); glyphs = serializedObject.FindProperty("glyphs"); linesCount = serializedObject.FindProperty("linesCount"); fillFactorTolerance = serializedObject.FindProperty("fillFactorTolerance"); fntFile = serializedObject.FindProperty("fntFile"); }
public override bool HasPreviewGUI() { MadFont font = target as MadFont; return(font.material != null); }
// =========================================================== // Constructors // =========================================================== public MadFontBuilder(MadFont font) { this.font = font; }
private Rect GlyphBounds(MadFont.Glyph g, out float xAdvance) { float realScale = scale; float xOffset = 0, yOffset = 0; float baseScale = font.data.infoSize / (float) font.data.commonScaleH; realScale = g.height / baseScale * scale; xOffset = g.xOffset / baseScale * scale; yOffset = g.yOffset / baseScale * scale; // wrong? xAdvance = g.xAdvance / baseScale * scale * font.textureAspect; float w = (realScale / g.height) * g.width; return new Rect(xOffset, yOffset, w * font.textureAspect, realScale); }