Skip to content

Commit a9d3b67

Browse files
Cleanup
1 parent e13d255 commit a9d3b67

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/SixLabors.Fonts/Tables/TrueType/Hinting/TrueTypeInterpreter.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public TrueTypeInterpreter(int maxStack, int maxStorage, int maxFunctions, int m
8282
this.twilight = new Zone(maxTwilightPoints, isTwilight: true);
8383
this.controlValueTable = [];
8484
this.baseControlValueTable = [];
85-
this.contours = Array.Empty<ushort>();
85+
this.contours = [];
8686
}
8787

8888
public void InitializeFunctionDefs(byte[] instructions)
@@ -191,7 +191,7 @@ public bool TryHintGlyph(
191191

192192
// FreeType's interpreter treats the storage area and glyph-level CVT modifications as non-persistent.
193193
// Reset storage and restore the baseline CVT state for each glyph.
194-
Array.Clear(this.storage);
194+
Array.Clear(this.storage, 0, this.storage.Length);
195195

196196
if (this.baseControlValueTable.Length > 0)
197197
{
@@ -235,14 +235,13 @@ public bool TryHintGlyph(
235235
}
236236
catch (Exception)
237237
{
238-
// TODO: Is there a general Reset I can call?
239238
// The interpreter can fail for malformed instructions; in that case we skip hinting.
240239
Array.Clear(this.points.TouchState, 0, this.points.TouchState.Length);
241240

242241
// Reset interpreter state so nothing leaks if the caller catches.
243242
this.stack.Clear();
244243
this.callStackSize = 0;
245-
this.contours = Array.Empty<ushort>();
244+
this.contours = [];
246245
this.zp0 = this.zp1 = this.zp2 = this.points = default;
247246

248247
this.state = this.cvtState;
@@ -268,7 +267,7 @@ private void ResetTwilightZone()
268267
twOriginal[i].Point = default;
269268
}
270269

271-
Array.Clear(this.twilight.TouchState);
270+
Array.Clear(this.twilight.TouchState, 0, this.twilight.TouchState.Length);
272271
}
273272

274273
private void Execute(StackInstructionStream stream, bool inFunction, bool allowFunctionDefs)

src/SixLabors.Fonts/Tables/TrueType/TrueTypeGlyphMetrics.CompatibilityLists.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class TrueTypeGlyphMetrics
1010
{
1111
/// <summary>
1212
/// Represents a set of font family names that require font hinting to render correctly.
13-
/// Base on the Freetype list in ttobjs.c
13+
/// Based on the FreeType list in ttobjs.c
1414
/// </summary>
1515
private static readonly HashSet<string> MustHintFonts =
1616
new(StringComparer.Ordinal)

0 commit comments

Comments
 (0)