Skip to content

Commit

Permalink
Fix release-image text position
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Jan 10, 2022
1 parent 11288bb commit 8d551c0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions build/Build.ReleaseImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Linq;
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.Tooling;
using Nuke.Common.Utilities.Collections;
using Serilog;
using SixLabors.Fonts;
Expand All @@ -20,11 +21,14 @@

partial class Build
{
[LatestGitHubRelease("JetBrains/JetBrainsMono", TrimPrefix = true)]
readonly string JetBrainsMonoVersion;

string[] FontDownloadUrls =>
new[]
{
"https://github.com/googlefonts/roboto/releases/latest/download/roboto-unhinted.zip",
"https://github.com/JetBrains/JetBrainsMono/releases/download/v1.0.6/JetBrainsMono-1.0.6.zip"
$"https://github.com/JetBrains/JetBrainsMono/releases/download/v{JetBrainsMonoVersion}/JetBrainsMono-{JetBrainsMonoVersion}.zip"
};

AbsolutePath FontDirectory => TemporaryDirectory / "fonts";
Expand Down Expand Up @@ -53,7 +57,8 @@ partial class Build
var logo = Image.Load(WatermarkImageFile);
logo.Mutate(x => x.Resize((int) (logo.Width * logoScaling), (int) (logo.Height * logoScaling)));
var robotoFont = FontCollection.Families.Single(x => x.Name == "Roboto Black");
var thinFont = FontCollection.Families.Single(x => x.Name == "JetBrains Mono Thin");
var boldFont = FontCollection.Families.Single(x => x.Name == "JetBrains Mono ExtraBold");
var graphicsOptions =
new DrawingOptions
{
Expand All @@ -75,15 +80,15 @@ partial class Build
opacity: 0.05f)
.DrawText(
text: "New Release".ToUpperInvariant(),
font: robotoFont.CreateFont(70),
font: thinFont.CreateFont(100),
color: Color.WhiteSmoke,
location: new PointF(image.Width / 2f, image.Height / 2f - 100),
location: new PointF(image.Width / 2f, image.Height / 2f - 120),
options: graphicsOptions)
.DrawText(
text: MajorMinorPatchVersion,
font: robotoFont.CreateFont(180),
font: boldFont.CreateFont(230),
color: Color.WhiteSmoke,
location: new PointF(image.Width / 2f, image.Height / 2f),
location: new PointF(image.Width / 2f, image.Height / 2f + 60),
options: graphicsOptions));
using var fileStream = new FileStream(ReleaseImageFile, FileMode.Create);
Expand Down

0 comments on commit 8d551c0

Please sign in to comment.