public FixedGridLayoutTests() { layout = new FixedGridLayout(16, 8); gridParentMetrics = new SizeMetrics(); gridParentMetrics.ParentMaxSize = new Size(1920, 1080); renderContext = CommonMocks.RenderContext(); }
protected void TestSizeMetrics(Size expectedIdealSize) { var sizeMetrics = new SizeMetrics(); var renderContext = new Mock <IWidgetRenderContext>(); var idealSize = ListLayout.ComputeIdealSize(Size.Empty, renderContext.Object); idealSize.Should().Be(expectedIdealSize); }
public static bool FontInit(ref Texture_Font_T font) { SizeMetrics sizemetrics = null; font.Glyphs = new System.Collections.Generic.List <Texture_Glyph_T>(); font.Height = 0; font.Ascender = 0; font.Descender = 0; font.Outlinethickness = 0.0f; font.Rendermode = RenderMode.RENDER_NORMAL; font.Hinting = 1; font.Kerning = 1; font.Filtering = 1; font.Lcd_filter_weights = new byte[5] { 0x10, 0x40, 0x70, 0x40, 0x10 }; if (!LoadFace(ref font, ref library, ref face, font.Size)) { return(false); } font.Underlineposition = face.UnderlinePosition / (HRESF * HRESF) * font.Size; font.Underlineposition = System.MathF.Round(font.Underlineposition); if (font.Underlineposition < -2.0) { font.Underlineposition = -2.0f; } font.Underlinethickness = face.UnderlineThickness / (HRESF * HRESF) * font.Size; font.Underlinethickness = System.MathF.Round(font.Underlinethickness); if (font.Underlinethickness < 1) { font.Underlinethickness = 1.0f; } sizemetrics = face.Size.Metrics; font.Ascender = sizemetrics.Ascender.ToSingle(); font.Descender = sizemetrics.Descender.ToSingle(); font.Height = sizemetrics.Height.ToSingle(); font.Linegap = font.Height - font.Ascender + font.Descender; GetGlyph(ref font, '\0'); return(true); }