embed fonts

This commit is contained in:
Luke Pulverenti
2015-03-08 23:56:42 -04:00
parent e70e06f0ac
commit 2caf01f43b
4 changed files with 62 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
using System.Globalization;
using ImageMagickSharp;
using ImageMagickSharp;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Drawing;
using System.Globalization;
namespace MediaBrowser.Server.Implementations.Drawing
{
@@ -8,6 +9,13 @@ namespace MediaBrowser.Server.Implementations.Drawing
{
private const int OffsetFromTopRightCorner = 38;
private readonly IApplicationPaths _appPaths;
public UnplayedCountIndicator(IApplicationPaths appPaths)
{
_appPaths = appPaths;
}
public void DrawUnplayedCountIndicator(MagickWand wand, ImageSize imageSize, int count)
{
var x = imageSize.Width - OffsetFromTopRightCorner;
@@ -25,7 +33,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
pixel.Opacity = 0;
pixel.Color = "white";
draw.FillColor = pixel;
draw.Font = "Sans-Serif";
draw.Font = PlayedIndicatorDrawer.ExtractFont("robotoregular.ttf", _appPaths);
draw.FontStyle = FontStyleType.NormalStyle;
draw.TextAlignment = TextAlignType.CenterAlign;
draw.FontWeight = FontWeightType.RegularStyle;
@@ -36,7 +44,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
if (text.Length == 1)
{
x += 2;
x += 1;
}
else if (text.Length == 2)
{