Use current row when filling in old atlas pages

This commit is contained in:
Daniel Imms
2022-10-29 19:50:44 -07:00
parent 57a65e0858
commit 5e95475d6b
+11 -3
View File
@@ -596,13 +596,21 @@ export class TextureAtlas implements ITextureAtlas {
let activePage: AtlasPage;
let activeRow: ICharAtlasActiveRow;
while (true) {
// Get the best current row from all active pages
activePage = this._activePages[this._activePages.length - 1];
activeRow = activePage.currentRow;
for (const p of this._activePages) {
// Select the ideal existing row, preferring fixed rows over the current row
// activeRow = p.currentRow;
if (rasterizedGlyph.size.y <= p.currentRow.height) {
activePage = p;
activeRow = p.currentRow;
}
}
// Replace the best current row with a fixed row if there is one at least as good as the
// current row
for (const p of this._activePages) {
for (const row of p.fixedRows) {
if ((activeRow === p.currentRow || row.height < activeRow.height) && rasterizedGlyph.size.y <= row.height) {
if (row.height <= activeRow.height && rasterizedGlyph.size.y <= row.height) {
activePage = p;
activeRow = row;
}