Correct WebGL dropcap texture layout

This commit is contained in:
2026-06-07 17:59:01 +02:00
parent da37608197
commit 7abd3387f3
5 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
* Defines the canonical page geometry used by the WebGL book renderer.
*/
import { BaseModule } from './base-module.js';
import { calculateProceduralBookThickness, snapProceduralPageCount } from './procedural-book-model.js?v=20260607-webgl-resize-prime';
import { calculateProceduralBookThickness, snapProceduralPageCount } from './procedural-book-model.js?v=20260607-webgl-typography-a';
export const BOOK_TEXTURE_WIDTH = 3072;
+2 -3
View File
@@ -264,7 +264,8 @@ class BookPaginationModule extends BaseModule {
const inkRight = Number.isFinite(metrics.actualBoundingBoxRight) && metrics.actualBoundingBoxRight > 0
? metrics.actualBoundingBoxRight
: (metrics.width || 0);
return Math.max(inkRight, lineHeightPx * 1.08) + this.measureNormalTextGap(fontPx);
const advanceWidth = metrics.width || 0;
return Math.max(inkRight, advanceWidth, lineHeightPx * 1.08) + this.measureNormalTextGap(fontPx);
}
measureNormalTextGap(fontPx) {
@@ -355,8 +356,6 @@ class BookPaginationModule extends BaseModule {
fragments.push(node.value || '');
} else if (node.type === 'glue' && node.width > 0) {
fragments.push(' ');
} else if (node.type === 'penalty' && node.penalty === 100) {
fragments.push('|');
}
}
return fragments.join('').replace(/\s+/g, ' ').trimStart();
+1 -1
View File
@@ -24,7 +24,7 @@ const ModuleState = {
ERROR: 'ERROR'
};
const MODULE_CACHE_BUSTER = '20260607-webgl-resize-prime';
const MODULE_CACHE_BUSTER = '20260607-webgl-typography-a';
window.MODULE_CACHE_BUSTER = MODULE_CACHE_BUSTER;
/**
+1 -1
View File
@@ -4,7 +4,7 @@ import { RenderPass } from 'https://esm.sh/three@0.165.0/examples/jsm/postproces
import { SSAOPass } from 'https://esm.sh/three@0.165.0/examples/jsm/postprocessing/SSAOPass.js';
import { SMAAPass } from 'https://esm.sh/three@0.165.0/examples/jsm/postprocessing/SMAAPass.js';
import { OutputPass } from 'https://esm.sh/three@0.165.0/examples/jsm/postprocessing/OutputPass.js';
import { PROCEDURAL_BOOK, createProceduralBookModel, snapProceduralPageCount } from './procedural-book-model.js?v=20260607-webgl-resize-prime';
import { PROCEDURAL_BOOK, createProceduralBookModel, snapProceduralPageCount } from './procedural-book-model.js?v=20260607-webgl-typography-a';
const canvas = document.getElementById('scene');
canvas.style.cursor = 'grab';