fix(viewer2d): correct Slug GPU text scale to match DWG cap-height
SlugTextBatch.add() scaled em-unit glyph outlines by the raw DWG `height` value, but glyph ink only reaches capHeightEm (~0.74 em) of the em box. Rendered cap height ended up ~26% short of spec (e.g. a 3.6-height TABLE cell text rendered at ~2.68), while the canvas-sprite fallback already corrected for this via measured ascent. Divide by capHeightEm so both paths agree. Rebuilds dist2 (was stale since before the Entity selection/Property Inspector/Layer panel work landed).
This commit is contained in:
@@ -328,7 +328,10 @@ export class SlugTextBatch {
|
||||
colorInt: number, alignH: number, alignV: number): void {
|
||||
const eng = this.engine;
|
||||
const lines = String(text).split('\n');
|
||||
const scale = height;
|
||||
// Glyph outlines are em-scaled (getPath(0,0,1)), so raw cap ink height is
|
||||
// capHeightEm em, not 1em. Divide by it so the rendered cap height equals
|
||||
// the DWG `height` field, matching the canvas-sprite fallback's ascent fit.
|
||||
const scale = height / eng.capHeightEm;
|
||||
const lineStep = height * 5 / 3; // CAD default MTEXT line spacing
|
||||
const blockH = (lines.length - 1) * lineStep + height;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user