-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
DrawerOptions.cs
37 lines (30 loc) · 1.26 KB
/
DrawerOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using SkiaSharp;
using System;
using System.Diagnostics;
namespace BinaryKits.Zpl.Viewer.ElementDrawers
{
public class DrawerOptions
{
public Func<string, SKTypeface> FontLoader { get; set; } = DefaultFontLoader;
public SKEncodedImageFormat RenderFormat { get; set; } = SKEncodedImageFormat.Png;
/// <summary>
/// Applies label over a white background after rendering all elements
/// </summary>
public bool OpaqueBackground { get; set; } = false;
public int RenderQuality { get; set; } = 80;
public bool ReplaceDashWithEnDash { get; set; } = true;
public static Func<string, SKTypeface> DefaultFontLoader = fontName => {
var typeface = SKTypeface.Default;
if (fontName == "0")
{
//typeface = SKTypeface.FromFile(@"swiss-721-black-bt.ttf");
typeface = SKTypeface.FromFamilyName("Helvetica", SKFontStyleWeight.Bold, SKFontStyleWidth.SemiCondensed, SKFontStyleSlant.Upright);
}
else
{
typeface = SKTypeface.FromFamilyName("DejaVu Sans Mono", SKFontStyleWeight.Normal, SKFontStyleWidth.Normal, SKFontStyleSlant.Upright);
}
return typeface;
};
}
}