Skip to content

Commit 4dda201

Browse files
committed
fixes so sample works again
1 parent 071cfec commit 4dda201

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Source/SVGImage/SVG/PaintServers/PaintServerManager.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,23 @@ public static Color ParseHexColor(string value)
147147
int start = 0;
148148
if (value[start] == '#') start++;
149149

150-
uint u = Convert.ToUInt32(value.Substring(start), 16);
150+
ulong u;
151151
if (value.Length <= 4)
152152
{
153+
uint @int = Convert.ToUInt32(value.Substring(start), 16);
153154
uint newval = 0;
154-
newval |= (u & 0x000f00) << 12;
155-
newval |= (u & 0x000f00) << 8;
156-
newval |= (u & 0x0000f0) << 8;
157-
newval |= (u & 0x0000f0) << 4;
158-
newval |= (u & 0x00000f) << 4;
159-
newval |= (u & 0x00000f);
155+
newval |= (@int & 0x000f00) << 12;
156+
newval |= (@int & 0x000f00) << 8;
157+
newval |= (@int & 0x0000f0) << 8;
158+
newval |= (@int & 0x0000f0) << 4;
159+
newval |= (@int & 0x00000f) << 4;
160+
newval |= (@int & 0x00000f);
160161
u = newval;
161162
}
163+
else {
164+
u = Convert.ToUInt64(value.Substring(start), 16);
165+
}
166+
162167
byte a = (byte)((u & 0xff000000) >> 24);
163168
byte r = (byte)((u & 0x00ff0000) >> 16);
164169
byte g = (byte)((u & 0x0000ff00) >> 8);

Source/SVGImage/SVG/TextStyle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public TextStyle(Shape owner)
5454

5555
public Typeface GetTypeface()
5656
{
57-
var fontFamily = _fontResolver.ResolveFontFamily(FontFamily);
57+
var fontFamily = _fontResolver.ResolveFontFamily(FontFamily) ?? new FontFamily(_defaults.FontFamily);
5858
return new Typeface(fontFamily,
5959
Fontstyle,
6060
Fontweight,

0 commit comments

Comments
 (0)