Skip to content
80 changes: 40 additions & 40 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<Project>
<!--<Import Condition="Exists('Local.Packages.props')" Project="$([MSBuild]::GetPathOfFileAbove('Local.Packages.props', '$(MSBuildThisFileDirectory)'))" />-->
<PropertyGroup>
<Logging_Abstractions_PackageVersion>8.0.3</Logging_Abstractions_PackageVersion>
<Logging_PackageVersion>8.0.1</Logging_PackageVersion>
<Cryptography_PackageVersion>8.0.1</Cryptography_PackageVersion>
</PropertyGroup>
<ItemGroup>
<!-- Logging packages used by all PDFsharp projects -->
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(Logging_Abstractions_PackageVersion)" />
<!-- Logging packages only used by PDFsharp sample projects and tests -->
<!--<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(Logging_PackageVersion)" />-->
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="$(Logging_PackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(Logging_PackageVersion)" />
<!-- Digital signature packages used by PdfSharp.Cryptography and for testing -->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="$(Cryptography_PackageVersion)" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.5.0" />
<!-- Unit test packages used for testing only-->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit.core" Version="2.9.3" />
<PackageVersion Include="xunit.assert" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Xunit.Priority" Version="1.1.6" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageVersion Include="XunitXml.TestLogger" Version="4.1.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<!-- GitVersion used for Semantic Versioning -->
<PackageVersion Include="GitVersion.MsBuild" Version="5.12.0" />
<!-- GitVersion 6 does not work in VS because of .NET Framework -->
<!--<PackageVersion Include="GitVersion.MsBuild" Version="6.1.0" />-->
<!-- Other packages -->
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>
<Project>
<!--<Import Condition="Exists('Local.Packages.props')" Project="$([MSBuild]::GetPathOfFileAbove('Local.Packages.props', '$(MSBuildThisFileDirectory)'))" />-->
<PropertyGroup>
<Logging_Abstractions_PackageVersion>8.0.3</Logging_Abstractions_PackageVersion>
<Logging_PackageVersion>8.0.1</Logging_PackageVersion>
<Cryptography_PackageVersion>8.0.1</Cryptography_PackageVersion>
</PropertyGroup>

<ItemGroup>

<!-- Logging packages used by all PDFsharp projects -->
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(Logging_Abstractions_PackageVersion)" />
<!-- Logging packages only used by PDFsharp sample projects and tests -->
<!--<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(Logging_PackageVersion)" />-->
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="$(Logging_PackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(Logging_PackageVersion)" />

<!-- Digital signature packages used by PdfSharp.Cryptography and for testing -->
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="$(Cryptography_PackageVersion)" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.5.0" />

<!-- Unit test packages used for testing only-->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit.core" Version="2.9.3" />
<PackageVersion Include="xunit.assert" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="Xunit.Priority" Version="1.1.6" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageVersion Include="XunitXml.TestLogger" Version="4.1.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />

<!-- GitVersion used for Semantic Versioning -->
<PackageVersion Include="GitVersion.MsBuild" Version="5.12.0" />
<!-- GitVersion 6 does not work in VS because of .NET Framework -->
<!--<PackageVersion Include="GitVersion.MsBuild" Version="6.1.0" />-->

<!-- Other packages -->
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>

</Project>
47 changes: 21 additions & 26 deletions src/foundation/src/PDFsharp/src/PdfSharp/Drawing/XFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,36 +372,31 @@ void Initialize()
/// </summary>
void InitializeFromGdi()
{
try
if (GdiFontFamily != null!)
{
// Create font based on its family.
GdiFont = new Font(GdiFontFamily, (float)_emSize, (GdiFontStyle)_style, GraphicsUnit.World);
}

if (GdiFont != null!)
{
Locks.EnterFontFactory();
if (GdiFontFamily != null!)
{
// Create font based on its family.
GdiFont = new Font(GdiFontFamily, (float)_emSize, (GdiFontStyle)_style, GraphicsUnit.World);
}

if (GdiFont != null!)
{
#if DEBUG_
string name1 = _gdiFont.Name;
string name2 = _gdiFont.OriginalFontName;
string name3 = _gdiFont.SystemFontName;
string name1 = _gdiFont.Name;
string name2 = _gdiFont.OriginalFontName;
string name3 = _gdiFont.SystemFontName;
#endif
_familyName = GdiFont.FontFamily.Name;
// TODO_OLD: _glyphTypeface = XGlyphTypeface.GetOrCreateFrom(_gdiFont);
}
else
{
Debug.Assert(false);
}

if (GlyphTypeface == null!)
GlyphTypeface = XGlyphTypeface.GetOrCreateFromGdi(GdiFont);

CreateDescriptorAndInitializeFontMetrics();
_familyName = GdiFont.FontFamily.Name;
// TODO_OLD: _glyphTypeface = XGlyphTypeface.GetOrCreateFrom(_gdiFont);
}
finally { Locks.ExitFontFactory(); }
else
{
Debug.Assert(false);
}

if (GlyphTypeface == null!)
GlyphTypeface = XGlyphTypeface.GetOrCreateFromGdi(GdiFont);

CreateDescriptorAndInitializeFontMetrics();
}
#endif

Expand Down
Loading