Skip to content

Commit

Permalink
Platform-independent way to build path for fonts into the sample. Now…
Browse files Browse the repository at this point in the history
… should work on non-Windows systems.
  • Loading branch information
snechaev committed Dec 19, 2023
1 parent e0eb503 commit 1b4c949
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions samples/DrawWithImageSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ public static void Main(string[] args)
{
var fonts = new FontCollection();
var woffFonts = new FontCollection();
FontFamily font = fonts.Add(@"Fonts\SixLaborsSampleAB.ttf");
FontFamily fontWoff = woffFonts.Add(@"Fonts\SixLaborsSampleAB.woff");
FontFamily fontWoff2 = woffFonts.Add(@"Fonts\OpenSans-Regular.woff2");
FontFamily carter = fonts.Add(@"Fonts\CarterOne.ttf");
FontFamily wendyOne = fonts.Add(@"Fonts\WendyOne-Regular.ttf");
FontFamily whitneyBook = fonts.Add(@"Fonts\whitney-book.ttf");
FontFamily colorEmoji = fonts.Add(@"Fonts\Twemoji Mozilla.ttf");
FontFamily font2 = fonts.Add(@"Fonts\OpenSans-Regular.ttf");
FontFamily sunflower = fonts.Add(@"Fonts\Sunflower-Medium.ttf");
FontFamily bugzilla = fonts.Add(@"Fonts\me_quran_volt_newmet.ttf");

FontFamily notoKR = fonts.Add(@"Fonts\NotoSansKR-Regular.otf");
FontFamily font = fonts.Add(IOPath.Combine("Fonts", "SixLaborsSampleAB.ttf"));

Check warning on line 24 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 24 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 24 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 24 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 24 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 24 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, true)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily fontWoff = woffFonts.Add(IOPath.Combine("Fonts", "SixLaborsSampleAB.woff"));

Check warning on line 25 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 25 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 25 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 25 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 25 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 25 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, true)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily fontWoff2 = woffFonts.Add(IOPath.Combine("Fonts", "OpenSans-Regular.woff2"));

Check warning on line 26 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 26 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 26 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 26 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 26 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 26 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, true)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily carter = fonts.Add(IOPath.Combine("Fonts", "CarterOne.ttf"));

Check warning on line 27 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 27 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 27 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 27 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 27 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 27 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, true)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily wendyOne = fonts.Add(IOPath.Combine("Fonts", "WendyOne-Regular.ttf"));

Check warning on line 28 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 28 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 28 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 28 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 28 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, windows-latest, net6.0, 6.0.x, -x64, true)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily whitneyBook = fonts.Add(IOPath.Combine("Fonts", "whitney-book.ttf"));

Check warning on line 29 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, ubuntu-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 29 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)

Check warning on line 29 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net7.0, 7.0.x, true, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily colorEmoji = fonts.Add(IOPath.Combine("Fonts", "Twemoji Mozilla.ttf"));

Check warning on line 30 in samples/DrawWithImageSharp/Program.cs

View workflow job for this annotation

GitHub Actions / Build (false, macos-latest, net6.0, 6.0.x, -x64, false)

The behavior of 'FontCollection.Add(string)' could vary based on the current user's locale settings. Replace this call in 'Program.Main(string[])' with a call to 'FontCollection.Add(string, CultureInfo)'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1304)
FontFamily font2 = fonts.Add(IOPath.Combine("Fonts", "OpenSans-Regular.ttf"));
FontFamily sunflower = fonts.Add(IOPath.Combine("Fonts", "Sunflower-Medium.ttf"));
FontFamily bugzilla = fonts.Add(IOPath.Combine("Fonts", "me_quran_volt_newmet.ttf"));

FontFamily notoKR = fonts.Add(IOPath.Combine("Fonts", "NotoSansKR-Regular.otf"));

RenderText(notoKR, "\uD734", pointSize: 72);
RenderText(notoKR, "Sphinx of black quartz, judge my vow!", pointSize: 72);
Expand Down

0 comments on commit 1b4c949

Please sign in to comment.