Skip to content

Commit 8ed0880

Browse files
authored
Merge pull request ststeiger#259 from jafin/fix/build-warnings
refactor: Fix build warnings
2 parents 655ae9b + ffd0258 commit 8ed0880

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

PdfSharpCore/Drawing/XGlyphTypeface.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,23 @@ public XGlyphTypeface(string key, XFontSource fontSource)
6868
Initialize();
6969
}
7070

71+
// ReSharper disable once UnusedMember.Global
72+
public XGlyphTypeface(string key, XFontFamily fontFamily, XFontSource fontSource, XStyleSimulations styleSimulations)
73+
{
74+
_key = key;
75+
_fontFamily = fontFamily;
76+
_fontSource = fontSource;
77+
_styleSimulations = styleSimulations;
78+
_fontface = OpenTypeFontface.CetOrCreateFrom(fontSource);
79+
80+
Initialize();
81+
}
82+
7183
public static XGlyphTypeface GetOrCreateFrom(string familyName, FontResolvingOptions fontResolvingOptions)
7284
{
7385
// Check cache for requested type face.
7486
string typefaceKey = ComputeKey(familyName, fontResolvingOptions);
75-
XGlyphTypeface glyphTypeface;
76-
if (GlyphTypefaceCache.TryGetGlyphTypeface(typefaceKey, out glyphTypeface))
87+
if (GlyphTypefaceCache.TryGetGlyphTypeface(typefaceKey, out var glyphTypeface))
7788
{
7889
// Just return existing one.
7990
return glyphTypeface;
@@ -88,8 +99,7 @@ public static XGlyphTypeface GetOrCreateFrom(string familyName, FontResolvingOpt
8899
}
89100
// Now create the font family at the first.
90101
XFontFamily fontFamily;
91-
PlatformFontResolverInfo platformFontResolverInfo = fontResolverInfo as PlatformFontResolverInfo;
92-
if (platformFontResolverInfo != null)
102+
if (fontResolverInfo is PlatformFontResolverInfo platformFontResolverInfo)
93103
{
94104
}
95105
else

PdfSharpCore/Drawing/XGraphics.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ public sealed class XGraphics : IDisposable
123123
}
124124
XGraphics(XSize size, XGraphicsUnit pageUnit, XPageDirection pageDirection)
125125
{
126-
if (size == null)
127-
throw new ArgumentNullException("size");
128-
129-
130126
_gsStack = new GraphicsStateStack(this);
131127
_pageSizePoints = new XSize(size.Width, size.Height);
132128
switch (pageUnit)
-328 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)