private Result <Tag> CreateTagFrom(TagStat tagStat, double fontSizeMultiplier, double averageWordsCount) { var fontSizeDelta = (tagStat.RepeatsCount - averageWordsCount) * fontSizeMultiplier; Font resFont; if (settings.DefaultFont != null) { resFont = settings.DefaultFont.WithModifiedFontSizeOf((float)fontSizeDelta); } else { return(Result.Fail <Tag>("Incorrect font given")); } return(Result .Of(() => graphics.MeasureString(tagStat.Word, resFont)) .Then(stringSize => layouter.PutNextRectangle(stringSize)) .Then(tagPlace => new RectangleF(new PointF(0, 0), bitmap.Size).Contains(tagPlace) ? new Tag(tagStat, resFont, tagPlace) : Result.Fail <Tag>($"Can't visualize all tags inside bitmap of size {bitmap.Size}"))); }
public BlogTagWrapper(TagStat tagStat) { Name = tagStat.Name; Count = tagStat.Count; }