Add font fallback
Note: All the `First()` in the code are temperary workarounds to make it work and require refractoring
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.Drag;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
@@ -140,8 +141,8 @@ namespace FlaxEditor.Content
|
||||
var textRect = TextRect;
|
||||
for (int i = 0; i < ranges.Length; i++)
|
||||
{
|
||||
var start = font.GetCharPosition(text, ranges[i].StartIndex);
|
||||
var end = font.GetCharPosition(text, ranges[i].EndIndex);
|
||||
var start = font.First().GetCharPosition(text, ranges[i].StartIndex);
|
||||
var end = font.First().GetCharPosition(text, ranges[i].EndIndex);
|
||||
_highlights.Add(new Rectangle(start.X + textRect.X, textRect.Y, end.X - start.X, textRect.Height));
|
||||
}
|
||||
isThisVisible = true;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Actions;
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.GUI;
|
||||
@@ -42,7 +43,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
// Add script button
|
||||
var buttonText = "Add script";
|
||||
var textSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var textSize = Style.Current.FontMedium.First().MeasureText(buttonText);
|
||||
float addScriptButtonWidth = (textSize.X < 60.0f) ? 60.0f : textSize.X + 4;
|
||||
var buttonHeight = (textSize.Y < 18) ? 18 : textSize.Y + 4;
|
||||
_addScriptsButton = new Button
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
// Info
|
||||
var info = new Label(0, title.Bottom, DialogWidth, InfoHeight)
|
||||
{
|
||||
Font = new FontReference(style.FontSmall),
|
||||
Font = new FontReference(style.FontSmall.First()),
|
||||
Text = "Shift: also set bounds\nControl: also set pivot",
|
||||
Parent = this
|
||||
};
|
||||
@@ -423,7 +423,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
// Set control type button
|
||||
var space = layout.Space(20);
|
||||
var buttonText = "Set Type";
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.First().MeasureText(buttonText);
|
||||
float setTypeButtonWidth = (textSize.X < 60.0f) ? 60.0f : textSize.X + 4;
|
||||
var setTypeButton = new Button
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEditor.CustomEditors.Editors
|
||||
{
|
||||
@@ -100,7 +101,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
_linkButton.Clicked += ToggleLink;
|
||||
ToggleEnabled();
|
||||
SetLinkStyle();
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(LinkedLabel.Text.Value);
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.First().MeasureText(LinkedLabel.Text.Value);
|
||||
_linkButton.LocalX += textSize.X + 10;
|
||||
LinkedLabel.SetupContextMenu += (label, menu, editor) =>
|
||||
{
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
TooltipText = "Edit...",
|
||||
Parent = _label,
|
||||
};
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.First().MeasureText(buttonText);
|
||||
if (textSize.Y > button.Width)
|
||||
button.Width = textSize.Y + 2;
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace FlaxEditor
|
||||
/// </summary>
|
||||
public static string PrimaryFont = "Editor/Fonts/Roboto-Regular";
|
||||
|
||||
public static string CJKFont = "Editor/Fonts/NotoSansSC-Medium";
|
||||
|
||||
/// <summary>
|
||||
/// The Inconsolata Regular font.
|
||||
/// </summary>
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace FlaxEditor.GUI
|
||||
MaximumItemsInViewCount = 20;
|
||||
|
||||
var style = Style.Current;
|
||||
Font = new FontReference(style.FontMedium);
|
||||
Font = new FontReference(style.FontMedium.First());
|
||||
TextColor = style.Foreground;
|
||||
BackgroundColor = style.BackgroundNormal;
|
||||
BackgroundColorHighlighted = BackgroundColor;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -233,11 +234,11 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
{
|
||||
var style = Style.Current;
|
||||
float width = 20;
|
||||
if (style.FontMedium)
|
||||
if (style.FontMedium.First())
|
||||
{
|
||||
width += style.FontMedium.MeasureText(Text).X;
|
||||
width += style.FontMedium.First().MeasureText(Text).X;
|
||||
if (!string.IsNullOrEmpty(ShortKeys))
|
||||
width += 40 + style.FontMedium.MeasureText(ShortKeys).X;
|
||||
width += 40 + style.FontMedium.First().MeasureText(ShortKeys).X;
|
||||
}
|
||||
|
||||
return Mathf.Max(width, base.MinimumWidth);
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace FlaxEditor.GUI
|
||||
_contentsColor = style.Background.RGBMultiplied(0.7f);
|
||||
_linesColor = style.ForegroundDisabled.RGBMultiplied(0.7f);
|
||||
_labelsColor = style.ForegroundDisabled;
|
||||
_labelsFont = style.FontSmall;
|
||||
_labelsFont = style.FontSmall.First();
|
||||
|
||||
_mainPanel = new Panel(ScrollBars.Both)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using FlaxEngine;
|
||||
using FlaxEngine.Assertions;
|
||||
using FlaxEngine.GUI;
|
||||
using FlaxEditor.Options;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEditor.GUI.Docking
|
||||
{
|
||||
@@ -488,7 +489,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
{
|
||||
var style = Style.Current;
|
||||
if (style?.FontMedium != null)
|
||||
_titleSize = style.FontMedium.MeasureText(_title);
|
||||
_titleSize = style.FontMedium.First().MeasureText(_title);
|
||||
}
|
||||
|
||||
base.PerformLayoutBeforeChildren();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Utilities;
|
||||
@@ -86,8 +87,8 @@ namespace FlaxEditor.GUI
|
||||
var font = style.FontSmall;
|
||||
for (int i = 0; i < ranges.Length; i++)
|
||||
{
|
||||
var start = font.GetCharPosition(Name, ranges[i].StartIndex);
|
||||
var end = font.GetCharPosition(Name, ranges[i].EndIndex);
|
||||
var start = font.First().GetCharPosition(Name, ranges[i].StartIndex);
|
||||
var end = font.First().GetCharPosition(Name, ranges[i].EndIndex);
|
||||
_highlights.Add(new Rectangle(start.X + 2, 0, end.X - start.X, Height));
|
||||
}
|
||||
Visible = true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEditor.GUI
|
||||
{
|
||||
@@ -101,8 +102,8 @@ namespace FlaxEditor.GUI
|
||||
var style = Style.Current;
|
||||
float width = 18;
|
||||
|
||||
if (style.FontMedium)
|
||||
width += style.FontMedium.MeasureText(Text).X;
|
||||
if (style.FontMedium.First())
|
||||
width += style.FontMedium.First().MeasureText(Text).X;
|
||||
|
||||
Width = width;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEditor.GUI
|
||||
{
|
||||
@@ -65,9 +66,9 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
var style = Style.Current;
|
||||
|
||||
if (style.FontMedium)
|
||||
if (style.FontMedium.First())
|
||||
{
|
||||
Width = style.FontMedium.MeasureText(Text).X + 2 * DefaultMargin;
|
||||
Width = style.FontMedium.First().MeasureText(Text).X + 2 * DefaultMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -38,8 +39,8 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
Depth = -1;
|
||||
|
||||
if (Height < Style.Current.FontMedium.Height)
|
||||
Height = Style.Current.FontMedium.Height + 4;
|
||||
if (Height < Style.Current.FontMedium.First().Height)
|
||||
Height = Style.Current.FontMedium.First().Height + 4;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -129,7 +130,7 @@ namespace FlaxEditor.GUI
|
||||
Render2D.FillRectangle(rect, column.TitleBackgroundColor);
|
||||
|
||||
var style = Style.Current;
|
||||
var font = column.TitleFont ?? style.FontMedium;
|
||||
var font = column.TitleFont ?? style.FontMedium.First();
|
||||
Render2D.DrawText(font, column.Title, rect, column.TitleColor, TextAlignment.Center, TextAlignment.Center);
|
||||
|
||||
if (columnIndex < _columns.Length - 1)
|
||||
|
||||
@@ -345,7 +345,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
if (_previewValue != null)
|
||||
{
|
||||
// Based on Track.Draw for track text placement
|
||||
var left = _xOffset + 16 + Style.Current.FontSmall.MeasureText(Title ?? Name).X;
|
||||
var left = _xOffset + 16 + Style.Current.FontSmall.First().MeasureText(Title ?? Name).X;
|
||||
if (Icon.IsValid)
|
||||
left += 18;
|
||||
if (IsExpanded)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -150,8 +151,8 @@ namespace FlaxEditor.GUI
|
||||
|
||||
if (hasSprite)
|
||||
width += iconSize;
|
||||
if (!string.IsNullOrEmpty(_text) && style.FontMedium)
|
||||
width += style.FontMedium.MeasureText(_text).X + (hasSprite ? DefaultMargin : 0);
|
||||
if (!string.IsNullOrEmpty(_text) && style.FontMedium.First())
|
||||
width += style.FontMedium.First().MeasureText(_text).X + (hasSprite ? DefaultMargin : 0);
|
||||
|
||||
Width = width;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -317,7 +318,7 @@ namespace FlaxEditor.GUI.Tree
|
||||
BackgroundColorSelected = style.BackgroundSelected;
|
||||
BackgroundColorHighlighted = style.BackgroundHighlighted;
|
||||
BackgroundColorSelectedUnfocused = style.LightBackground;
|
||||
TextFont = new FontReference(style.FontSmall);
|
||||
TextFont = new FontReference(style.FontSmall.First());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -237,12 +237,18 @@ namespace FlaxEditor.Options
|
||||
public int NumberOfGameClientsToLaunch = 1;
|
||||
|
||||
private static FontAsset DefaultFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.PrimaryFont);
|
||||
private static FontAsset _cjkFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.CJKFont);
|
||||
private FontReference _titleFont = new FontReference(DefaultFont, 18);
|
||||
private FontReference _largeFont = new FontReference(DefaultFont, 14);
|
||||
private FontReference _mediumFont = new FontReference(DefaultFont, 9);
|
||||
private FontReference _smallFont = new FontReference(DefaultFont, 9);
|
||||
private FontReference _outputLogFont = new FontReference(FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont), 10);
|
||||
|
||||
public FontReference CJKFont
|
||||
{
|
||||
get => new FontReference(_cjkFont, 9);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title font for editor UI.
|
||||
/// </summary>
|
||||
|
||||
@@ -261,8 +261,9 @@ namespace FlaxEditor.Options
|
||||
// Fonts
|
||||
FontTitle = options.Interface.TitleFont.GetFont(),
|
||||
FontLarge = options.Interface.LargeFont.GetFont(),
|
||||
FontMedium = options.Interface.MediumFont.GetFont(),
|
||||
FontSmall = options.Interface.SmallFont.GetFont(),
|
||||
FontMedium = new Font[] { options.Interface.MediumFont.GetFont(), options.Interface.CJKFont.GetFont() },
|
||||
FontSmall = new Font[] { options.Interface.SmallFont.GetFont(), options.Interface.CJKFont.GetFont() },
|
||||
FontCJK = options.Interface.CJKFont.GetFont(),
|
||||
|
||||
// Icons
|
||||
ArrowDown = Editor.Icons.ArrowDown12,
|
||||
@@ -314,8 +315,8 @@ namespace FlaxEditor.Options
|
||||
// Fonts
|
||||
FontTitle = options.Interface.TitleFont.GetFont(),
|
||||
FontLarge = options.Interface.LargeFont.GetFont(),
|
||||
FontMedium = options.Interface.MediumFont.GetFont(),
|
||||
FontSmall = options.Interface.SmallFont.GetFont(),
|
||||
FontMedium = new Font[] { options.Interface.MediumFont.GetFont(), options.Interface.CJKFont.GetFont() },
|
||||
FontSmall = new Font[] { options.Interface.SmallFont.GetFont(), options.Interface.CJKFont.GetFont() },
|
||||
|
||||
// Icons
|
||||
ArrowDown = Editor.Icons.ArrowDown12,
|
||||
|
||||
@@ -142,8 +142,8 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
var textRect = TextRect;
|
||||
for (int i = 0; i < ranges.Length; i++)
|
||||
{
|
||||
var start = font.GetCharPosition(text, ranges[i].StartIndex);
|
||||
var end = font.GetCharPosition(text, ranges[i].EndIndex);
|
||||
var start = font.First().GetCharPosition(text, ranges[i].StartIndex);
|
||||
var end = font.First().GetCharPosition(text, ranges[i].EndIndex);
|
||||
_highlights.Add(new Rectangle(start.X + textRect.X, textRect.Y, end.X - start.X, textRect.Height));
|
||||
}
|
||||
isThisVisible = true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.CustomEditors.Dedicated;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Drag;
|
||||
@@ -100,7 +101,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
_debugRelevant = Behavior.GetNodeDebugRelevancy(instance, behavior);
|
||||
_debugInfo = Behavior.GetNodeDebugInfo(instance, behavior);
|
||||
if (!string.IsNullOrEmpty(_debugInfo))
|
||||
_debugInfoSize = Style.Current.FontSmall.MeasureText(_debugInfo);
|
||||
_debugInfoSize = Style.Current.FontSmall.First().MeasureText(_debugInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
var font = style.FontSmall;
|
||||
for (int i = 0; i < ranges.Length; i++)
|
||||
{
|
||||
var start = font.GetCharPosition(_archetype.Title, ranges[i].StartIndex);
|
||||
var end = font.GetCharPosition(_archetype.Title, ranges[i].EndIndex);
|
||||
var start = font.First().GetCharPosition(_archetype.Title, ranges[i].StartIndex);
|
||||
var end = font.First().GetCharPosition(_archetype.Title, ranges[i].EndIndex);
|
||||
_highlights.Add(new Rectangle(start.X + textRect.X, 0, end.X - start.X, Height));
|
||||
|
||||
if (ranges[i].StartIndex <= 0)
|
||||
@@ -222,8 +222,8 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
_highlights.Clear();
|
||||
var style = Style.Current;
|
||||
var font = style.FontSmall;
|
||||
var start = font.GetCharPosition(_archetype.Title, 0);
|
||||
var end = font.GetCharPosition(_archetype.Title, _archetype.Title.Length - 1);
|
||||
var start = font.First().GetCharPosition(_archetype.Title, 0);
|
||||
var end = font.First().GetCharPosition(_archetype.Title, _archetype.Title.Length - 1);
|
||||
_highlights.Add(new Rectangle(start.X + textRect.X, 0, end.X - start.X, Height));
|
||||
_isFullMatch = true;
|
||||
Visible = true;
|
||||
@@ -237,8 +237,8 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
_highlights.Clear();
|
||||
var style = Style.Current;
|
||||
var font = style.FontSmall;
|
||||
var start = font.GetCharPosition(_archetype.Title, 0);
|
||||
var end = font.GetCharPosition(_archetype.Title, _archetype.Title.Length - 1);
|
||||
var start = font.First().GetCharPosition(_archetype.Title, 0);
|
||||
var end = font.First().GetCharPosition(_archetype.Title, _archetype.Title.Length - 1);
|
||||
_highlights.Add(new Rectangle(start.X + textRect.X, 0, end.X - start.X, Height));
|
||||
Visible = true;
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
Render2D.DrawText(style.FontSmall, _archetype.Title, textRect, Enabled ? style.Foreground : style.ForegroundDisabled, TextAlignment.Near, TextAlignment.Center);
|
||||
if (_archetype.SubTitle != null)
|
||||
{
|
||||
var titleLength = style.FontSmall.MeasureText(_archetype.Title).X;
|
||||
var titleLength = style.FontSmall.First().MeasureText(_archetype.Title).X;
|
||||
var subTitleRect = new Rectangle(textRect.X + titleLength, textRect.Y, textRect.Width - titleLength, textRect.Height);
|
||||
Render2D.DrawText(style.FontSmall, _archetype.SubTitle, subTitleRect, style.ForegroundDisabled, TextAlignment.Near, TextAlignment.Center);
|
||||
}
|
||||
|
||||
@@ -1428,7 +1428,7 @@ namespace FlaxEditor.Surface.Elements
|
||||
|
||||
if (_defaultValueEditor != null)
|
||||
{
|
||||
_defaultValueEditor.Location = new Float2(X + Width + 8 + Style.Current.FontSmall.MeasureText(Text).X, Y);
|
||||
_defaultValueEditor.Location = new Float2(X + Width + 8 + Style.Current.FontSmall.First().MeasureText(Text).X, Y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1635,7 +1635,7 @@ namespace FlaxEditor.Surface.Elements
|
||||
{
|
||||
if (DefaultValueEditors[i].CanUse(this, ref _currentType))
|
||||
{
|
||||
var bounds = new Rectangle(X + Width + 8 + Style.Current.FontSmall.MeasureText(Text).X, Y, 90, Height);
|
||||
var bounds = new Rectangle(X + Width + 8 + Style.Current.FontSmall.First().MeasureText(Text).X, Y, 90, Height);
|
||||
_editor = DefaultValueEditors[i];
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEditor.Surface.Elements;
|
||||
using FlaxEditor.Surface.Undo;
|
||||
@@ -199,7 +200,7 @@ namespace FlaxEditor.Surface
|
||||
continue;
|
||||
if (child is InputBox inputBox)
|
||||
{
|
||||
var boxWidth = boxLabelFont.MeasureText(inputBox.Text).X + 20;
|
||||
var boxWidth = boxLabelFont.First().MeasureText(inputBox.Text).X + 20;
|
||||
if (inputBox.DefaultValueEditor != null)
|
||||
boxWidth += inputBox.DefaultValueEditor.Width + 4;
|
||||
leftWidth = Mathf.Max(leftWidth, boxWidth);
|
||||
@@ -207,7 +208,7 @@ namespace FlaxEditor.Surface
|
||||
}
|
||||
else if (child is OutputBox outputBox)
|
||||
{
|
||||
rightWidth = Mathf.Max(rightWidth, boxLabelFont.MeasureText(outputBox.Text).X + 20);
|
||||
rightWidth = Mathf.Max(rightWidth, boxLabelFont.First().MeasureText(outputBox.Text).X + 20);
|
||||
rightHeight = Mathf.Max(rightHeight, outputBox.Archetype.Position.Y - Constants.NodeMarginY - Constants.NodeHeaderSize + 20.0f);
|
||||
}
|
||||
else if (child is Control control)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.Tabs;
|
||||
using FlaxEditor.Modules;
|
||||
using FlaxEditor.SceneGraph.Actors;
|
||||
@@ -147,7 +148,7 @@ namespace FlaxEditor.Tools.Foliage
|
||||
Parent = _noFoliagePanel,
|
||||
Enabled = false
|
||||
};
|
||||
var textSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var textSize = Style.Current.FontMedium.First().MeasureText(buttonText);
|
||||
if (_createNewFoliage.Width < textSize.X)
|
||||
{
|
||||
_createNewFoliage.LocalX -= (textSize.X - _createNewFoliage.Width) / 2;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.Tabs;
|
||||
using FlaxEditor.Modules;
|
||||
using FlaxEditor.SceneGraph.Actors;
|
||||
@@ -105,7 +106,7 @@ namespace FlaxEditor.Tools.Terrain
|
||||
Parent = _noTerrainPanel,
|
||||
Enabled = false
|
||||
};
|
||||
var textSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var textSize = Style.Current.FontMedium.First().MeasureText(buttonText);
|
||||
if (_createTerrainButton.Width < textSize.X)
|
||||
{
|
||||
_createTerrainButton.LocalX -= (textSize.X - _createTerrainButton.Width) / 2;
|
||||
|
||||
@@ -548,9 +548,9 @@ namespace FlaxEditor.Viewport
|
||||
#region Camera settings widget
|
||||
|
||||
var largestText = "Relative Panning";
|
||||
var textSize = Style.Current.FontMedium.MeasureText(largestText);
|
||||
var textSize = Style.Current.FontMedium.First().MeasureText(largestText);
|
||||
var xLocationForExtras = textSize.X + 5;
|
||||
var cameraSpeedTextWidth = Style.Current.FontMedium.MeasureText("0.00").X;
|
||||
var cameraSpeedTextWidth = Style.Current.FontMedium.First().MeasureText("0.00").X;
|
||||
|
||||
// Camera Settings Widget
|
||||
_cameraWidget = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
|
||||
@@ -801,7 +801,7 @@ namespace FlaxEditor.Viewport
|
||||
#region View mode widget
|
||||
|
||||
largestText = "Brightness";
|
||||
textSize = Style.Current.FontMedium.MeasureText(largestText);
|
||||
textSize = Style.Current.FontMedium.First().MeasureText(largestText);
|
||||
xLocationForExtras = textSize.X + 5;
|
||||
|
||||
var viewMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperLeft);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -162,8 +163,8 @@ namespace FlaxEditor.Viewport.Widgets
|
||||
{
|
||||
var style = Style.Current;
|
||||
|
||||
if (style != null && style.FontMedium)
|
||||
Width = CalculateButtonWidth(_forcedTextWidth > 0.0f ? _forcedTextWidth : style.FontMedium.MeasureText(_text).X, Icon.IsValid);
|
||||
if (style != null && style.FontMedium.First())
|
||||
Width = CalculateButtonWidth(_forcedTextWidth > 0.0f ? _forcedTextWidth : style.FontMedium.First().MeasureText(_text).X, Icon.IsValid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.Dialogs;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -53,7 +54,7 @@ namespace FlaxEditor.Windows
|
||||
Parent = this
|
||||
};
|
||||
var buttonText = "Copy version info";
|
||||
var fontSize = Style.Current.FontMedium.MeasureText(buttonText);
|
||||
var fontSize = Style.Current.FontMedium.First().MeasureText(buttonText);
|
||||
var copyVersionButton = new Button(Width - fontSize.X - 8, 6, fontSize.X + 4, 20)
|
||||
{
|
||||
Text = buttonText,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEditor.Windows.Profiler
|
||||
{
|
||||
@@ -84,8 +85,8 @@ namespace FlaxEditor.Windows.Profiler
|
||||
Render2D.FillRectangle(bounds, color);
|
||||
Render2D.DrawRectangle(bounds, color * 0.5f);
|
||||
|
||||
if (_nameLength < 0 && style.FontMedium)
|
||||
_nameLength = style.FontMedium.MeasureText(_name).X;
|
||||
if (_nameLength < 0 && style.FontMedium.First())
|
||||
_nameLength = style.FontMedium.First().MeasureText(_name).X;
|
||||
|
||||
if (_nameLength < bounds.Width + 4)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.GUI.Tabs;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
@@ -272,8 +273,8 @@ namespace FlaxEditor.Windows
|
||||
var textRect = item.TextRect;
|
||||
for (int i = 0; i < ranges.Length; i++)
|
||||
{
|
||||
var start = font.GetCharPosition(text, ranges[i].StartIndex);
|
||||
var end = font.GetCharPosition(text, ranges[i].EndIndex);
|
||||
var start = font.First().GetCharPosition(text, ranges[i].StartIndex);
|
||||
var end = font.First().GetCharPosition(text, ranges[i].EndIndex);
|
||||
highlights.Add(new Rectangle(start.X + textRect.X, textRect.Y, end.X - start.X, textRect.Height));
|
||||
}
|
||||
item.SetHighlights(highlights);
|
||||
|
||||
Reference in New Issue
Block a user