public void Activate() { Window window = NUIApplication.GetDefaultWindow(); var fit = new TextFit(); fit.Enable = true; fit.MinSize = 5.0f; fit.MaxSize = 50.0f; label = new TextLabel() { Text = "ABCDE", Size = new Size(300, 100), PointSize = 10, Position = new Position(100, 100), BackgroundColor = Color.Yellow, }; label.SetTextFit(fit); window.Add(label); label.TextFitChanged += (s, e) => { TextFit textfit = label.GetTextFit(); Tizen.Log.Error("NUI", $"FontSize : {textfit.FontSize}\n"); }; }
public static TextFit GetTextFitStruct(PropertyMap map) { var textFit = new TextFit(); if (null != map) { var defaultValue = "PointSize"; textFit.Enable = GetBoolFromMap(map, "enable", false); textFit.MinSize = GetFloatFromMap(map, "minSize", 0.0f); textFit.MaxSize = GetFloatFromMap(map, "maxSize", 0.0f); textFit.StepSize = GetFloatFromMap(map, "stepSize", 0.0f); textFit.FontSize = GetFloatFromMap(map, "fontSize", 0.0f); textFit.FontSizeType = GetFontSizeType(GetStringFromMap(map, "fontSizeType", defaultValue)); } return(textFit); }
public static PropertyMap GetTextFitMap(TextFit textFit) { var map = new PropertyMap(); map.Add("enable", textFit.Enable); map.Add("fontSizeType", GetFontSizeString(textFit.FontSizeType)); if (textFit.MinSize != null) { map.Add("minSize", (float)textFit.MinSize); } if (textFit.MaxSize != null) { map.Add("maxSize", (float)textFit.MaxSize); } if (textFit.StepSize != null) { map.Add("stepSize", (float)textFit.StepSize); } return(map); }
public static void Add(string text, Matrix transform, Vec2 size, TextFit fit, TextAlign position = TextAlign.Center, TextAlign align = TextAlign.Center, float offX = 0, float offY = 0, float offZ = 0) => NativeAPI.text_add_in(text, transform, size, fit, -1, position, align, offX, offY, offZ);