Skip to content

Commit

Permalink
Fix incorrect glyph page index in FreeTypeFontGenerator (#7357)
Browse files Browse the repository at this point in the history
* Fixed assigning glyphs the wrong page index.

* Avoid collisions with glyph hash codes.
  • Loading branch information
raeleus committed Apr 20, 2024
1 parent 57c8ce1 commit 10b21c0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,9 @@ public FreeTypeBitmapFontData generateData (FreeTypeFontParameter parameter, Fre
}
}

Rectangle rect = packer.pack(mainPixmap);
glyph.page = packer.getPages().size - 1; // Glyph is always packed into the last page for now.
String pixmapName = glyph.hashCode() + "_" + glyph.id;
Rectangle rect = packer.pack(pixmapName, mainPixmap);
glyph.page = packer.getPageIndex(pixmapName);
glyph.srcX = (int)rect.x;
glyph.srcY = (int)rect.y;

Expand Down

0 comments on commit 10b21c0

Please sign in to comment.