@@ -1218,6 +1218,14 @@ internal struct GlyphRenderData
12181218 /// </summary>
12191219 public Pen ? PenReference { get ; init ; }
12201220
1221+ /// <summary>
1222+ /// Gets the color palette selection the glyph's colors were resolved with, or
1223+ /// <see langword="null"/> when the glyph resolves no palette colors. The selection
1224+ /// changes the cached layer paints, so palette variants of one glyph must occupy
1225+ /// separate cache entries.
1226+ /// </summary>
1227+ public FontPalette ? FontPalette { get ; init ; }
1228+
12211229 /// <summary>
12221230 /// Determines whether two <see cref="CacheKey"/> instances are equal.
12231231 /// </summary>
@@ -1269,7 +1277,8 @@ public static CacheKey FromParameters(
12691277 TextAttributes = parameters . TextRun . TextAttributes ,
12701278 TextDecorations = parameters . TextRun . TextDecorations ,
12711279 Size = size ,
1272- PenReference = penReference
1280+ PenReference = penReference ,
1281+ FontPalette = parameters . FontPalette
12731282 } ;
12741283
12751284 /// <inheritdoc/>
@@ -1291,7 +1300,8 @@ public bool Equals(CacheKey other)
12911300 this . TextAttributes == other . TextAttributes &&
12921301 this . TextDecorations == other . TextDecorations &&
12931302 this . Size . Equals ( other . Size ) &&
1294- ReferenceEquals ( this . PenReference , other . PenReference ) ;
1303+ ReferenceEquals ( this . PenReference , other . PenReference ) &&
1304+ Equals ( this . FontPalette , other . FontPalette ) ;
12951305
12961306 /// <inheritdoc/>
12971307 public override int GetHashCode ( )
@@ -1312,6 +1322,7 @@ public override int GetHashCode()
13121322 hash . Add ( this . TextDecorations ) ;
13131323 hash . Add ( this . Size ) ;
13141324 hash . Add ( this . PenReference is null ? 0 : RuntimeHelpers . GetHashCode ( this . PenReference ) ) ;
1325+ hash . Add ( this . FontPalette ) ;
13151326 return hash . ToHashCode ( ) ;
13161327 }
13171328 }
0 commit comments