mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-11-24 16:53:20 +08:00
use short to save space when storing the set of glyph points
This commit is contained in:
@@ -107,11 +107,11 @@
|
||||
{
|
||||
var point = Points[i];
|
||||
|
||||
var scaled = matrix.ScaleAndRotate(point.Point);
|
||||
var scaled = matrix.ScaleAndRotate(new PdfPoint(point.X, point.Y));
|
||||
|
||||
scaled = matrix.Translate(scaled);
|
||||
|
||||
newPoints[i] = new GlyphPoint(scaled, point.IsOnCurve);
|
||||
newPoints[i] = new GlyphPoint((short)scaled.X, (short)scaled.Y, point.IsOnCurve);
|
||||
}
|
||||
|
||||
return new Glyph(IsSimple, Instructions, EndPointsOfContours, newPoints, Bounds);
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
namespace UglyToad.PdfPig.Fonts.TrueType.Glyphs
|
||||
{
|
||||
using Geometry;
|
||||
|
||||
internal struct GlyphPoint
|
||||
{
|
||||
public PdfPoint Point { get; }
|
||||
public short X { get; }
|
||||
|
||||
public short Y { get; }
|
||||
|
||||
public bool IsOnCurve { get; }
|
||||
|
||||
public GlyphPoint(decimal x, decimal y, bool isOnCurve) : this(new PdfPoint(x, y), isOnCurve) { }
|
||||
public GlyphPoint(PdfPoint point, bool isOnCurve)
|
||||
public GlyphPoint(short x, short y, bool isOnCurve)
|
||||
{
|
||||
Point = point;
|
||||
X = x;
|
||||
Y = y;
|
||||
IsOnCurve = isOnCurve;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Point} | {IsOnCurve}";
|
||||
return $"({X}, {Y}) | {IsOnCurve}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user