public CircularCloudLayouterResultFormatter(IDataProvider dataProvider, ICloudSettings cloudSettings, IFontSettings fontSettings, ILogger logger) { this.dataProvider = dataProvider; this.cloudSettings = cloudSettings; this.fontSettings = fontSettings; this.logger = logger; }
public static Font CreateFont(IFontSettings fontSettings) { FontStyle style = (fontSettings.Bold ? FontStyle.Bold : 0) | (fontSettings.Italics ? FontStyle.Italic : 0) | (fontSettings.Underlined ? FontStyle.Underline : 0); return new Font(new FontFamily(fontSettings.FontFamily), fontSettings.EmSize, style); }
public LabelSettings(IBrushSettings background, IPenSettings borderPen, IFontSettings font, IBrushSettings fontBrush, ContentAlignment contentAlignment) { Background = background; BorderPen = borderPen; Font = font; FontBrush = fontBrush; ContentAlignment = contentAlignment; }
private int GetFontSize(IFontSettings fontSettings, int currentFrequency, int minFrequency, int maxFrequency) { var minFontSize = fontSettings.MinFontSizeInPoints; var maxFontSize = fontSettings.MaxFontSizeInPoints; return(currentFrequency > minFrequency ? Math.Max ( (int)Math.Ceiling((double)maxFontSize * (currentFrequency - minFrequency) / (maxFrequency - minFrequency)), minFontSize ) : minFontSize); }
public Result <TagsCloud> CreateTagsCloud(string textFilePath, IFontSettings fontSettings) { return(sourceWordsProvider.Get() .Then ( words => wordsAnalyzer .Analyze(words) .OrderByDescending(kvp => kvp.Value) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value) ) .Then(frequencyByWord => GetTags(frequencyByWord, fontSettings)) .Then(tags => new TagsCloud(tags, layouter.CloudWidth, layouter.CloudHeight, layouter.Center)) .RefineError("Cannot create tags cloud")); }
internal static ISpeechSettings GetMockSpeechSettings( float displaySpeed = 5f, IFontSettings fontSettings = null, int fontSize = 45, bool fontOnSpeakerName = false ) { IFontSettings mockFontSettings = Substitute.For <IFontSettings>(); mockFontSettings.FontAsset.Returns(Resources.Load <TMPro.TMP_FontAsset>(Path.Combine("Fonts", "OpenSans SDF"))); ISpeechSettings speechSettings = Substitute.For <ISpeechSettings>(); speechSettings.DisplaySpeed.Returns(displaySpeed); speechSettings.FontSettings.Returns(fontSettings ?? mockFontSettings); speechSettings.FontColor.Returns(Color.white); speechSettings.FontSize.Returns(fontSize); speechSettings.FontOnSpeakerName.Returns(fontOnSpeakerName); return(speechSettings); }
public void SetFont_ShouldChangeFontOfSpeechTextDisplay_WhenReceivesFontParam() { // ARRANGE IFontSettings mockFontSettings = Substitute.For <IFontSettings>(); mockFontSettings.FontAsset.Returns(Resources.Load <TMP_FontAsset>(Path.Combine("Fonts", "OpenSans SDF"))); IDialogueSystemElements dialogueSystemElements = new DialogueSystemElements() { DialoguePanel = new GameObject(), DefaultSpeechSettings = DialogueTestHelpers.GetMockSpeechSettings(), SpeechTextDisplay = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(), SpeakerNameDisplay = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(), }; TextMeshProUGUI speechTextDisplay = (TextMeshProUGUI)dialogueSystemElements.SpeechTextDisplay; // ACT dialogueSystemElements.SetFontSettings(mockFontSettings, false); // ASSERT Assert.AreEqual(mockFontSettings.FontAsset.sourceFontFile, speechTextDisplay.font.sourceFontFile); }
private IEnumerable <Tag> GetTags(Dictionary <string, int> frequencyByWord, IFontSettings fontSettings) { var tags = new List <Tag>(); if (!frequencyByWord.Values.Any()) { return(tags); } var minFrequency = frequencyByWord.Values.Min(); var maxFrequency = frequencyByWord.Values.Max(); foreach (var weightedWord in frequencyByWord) { var fontSize = GetFontSize(fontSettings, weightedWord.Value, minFrequency, maxFrequency); var font = new Font(fontSettings.FontFamily, fontSize, fontSettings.FontStyle, GraphicsUnit.Point); var frameSize = TextRenderer.MeasureText(weightedWord.Key, font); var frame = layouter.PutNextRectangle(frameSize); tags.Add(new Tag(weightedWord.Key, font, frame)); } return(tags); }
private void FontsControl_Load(object sender, EventArgs e) { _settings = SettingsBuilder.GetSettings<IFontSettings>(Site); InitializeFontControl(_font, _settings.CodeFont ?? Constants.DefaultCodeFont); }
private void FontsControl_Load(object sender, EventArgs e) { _settings = SettingsBuilder.GetSettings <IFontSettings>(Site); InitializeFontControl(_font, _settings.CodeFont ?? Constants.DefaultCodeFont); }
public CloudSettings(IImageSettings imageSettings, IFontSettings fontSettings) { ImageSettings = imageSettings; FontSettings = fontSettings; }