From 0af884d37980267b1865773b2030a6f2b2477f8a Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 22 Dec 2025 12:09:41 -0800 Subject: [PATCH] Correct shade rectangle rendering --- .../customGlyphs/CustomGlyphDefinitions.ts | 29 +++++++------- .../src/customGlyphs/CustomGlyphRasterizer.ts | 39 ------------------- 2 files changed, 14 insertions(+), 54 deletions(-) diff --git a/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts b/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts index 122e2924..d94fcfbf 100644 --- a/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts +++ b/addons/addon-webgl/src/customGlyphs/CustomGlyphDefinitions.ts @@ -207,28 +207,27 @@ export const unifiedCharDefinitions: { [index: string]: CustomGlyphCharacterDefi [0, 1], [1, 0] ], [0, 0, 1, 1]] }, - // TODO: Make sure these are rendered correctly '\u{1FB91}': { type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_REGION_AND_SOLID_OCTANT_BLOCK_VECTOR, data: { // UPPER HALF BLOCK AND LOWER HALF INVERSE MEDIUM SHADE pattern: [[ - [1, 0], - [0, 1] - ], [0, 0, 1, 0.5]], - vectors: [{ x: 0, y: 4, w: 8, h: 4 }] - } }, - '\u{1FB92}': { type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_REGION_AND_SOLID_OCTANT_BLOCK_VECTOR, data: { // UPPER HALF INVERSE MEDIUM SHADE AND LOWER HALF BLOCK - pattern: [[ - [1, 0], - [0, 1] + [0, 1], + [1, 0] ], [0, 0.5, 1, 0.5]], vectors: [{ x: 0, y: 0, w: 8, h: 4 }] } }, - // 1FB93 is reserved + '\u{1FB92}': { type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_REGION_AND_SOLID_OCTANT_BLOCK_VECTOR, data: { // UPPER HALF INVERSE MEDIUM SHADE AND LOWER HALF BLOCK + pattern: [[ + [0, 1], + [1, 0] + ], [0, 0, 1, 0.5]], + vectors: [{ x: 0, y: 4, w: 8, h: 4 }] + } }, + // 1FB93 is '\u{1FB94}': { type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_REGION_AND_SOLID_OCTANT_BLOCK_VECTOR, data: { // LEFT HALF INVERSE MEDIUM SHADE AND RIGHT HALF BLOCK pattern: [[ - [1, 0], - [0, 1] - ], [0.5, 0, 0.5, 1]], - vectors: [{ x: 0, y: 0, w: 4, h: 8 }] + [0, 1], + [1, 0] + ], [0, 0, 0.5, 1]], + vectors: [{ x: 4, y: 0, w: 4, h: 8 }] } }, // #endregion diff --git a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts index 79a97931..4e42ae7c 100644 --- a/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts +++ b/addons/addon-webgl/src/customGlyphs/CustomGlyphRasterizer.ts @@ -215,45 +215,6 @@ function drawBlockPatternWithRegion( ctx.restore(); } -/** - * Draws block + inverse shade combo characters. - * Fills the solid region completely, then draws inverse medium shade in the shade region. - */ -// function drawBlockShadeComboChar( -// ctx: CanvasRenderingContext2D, -// regions: [[number, number, number, number], [number, number, number, number]], -// xOffset: number, -// yOffset: number, -// deviceCellWidth: number, -// deviceCellHeight: number -// ): void { -// const [solidRegion, shadeRegion] = regions; - -// // Draw solid block region -// const solidX = Math.round(xOffset + solidRegion[0] * deviceCellWidth); -// const solidY = Math.round(yOffset + solidRegion[1] * deviceCellHeight); -// const solidW = Math.round(solidRegion[2] * deviceCellWidth); -// const solidH = Math.round(solidRegion[3] * deviceCellHeight); -// ctx.fillRect(solidX, solidY, solidW, solidH); - -// // Draw inverse medium shade region -// const shadeX = Math.round(xOffset + shadeRegion[0] * deviceCellWidth); -// const shadeY = Math.round(yOffset + shadeRegion[1] * deviceCellHeight); -// const shadeW = Math.round(shadeRegion[2] * deviceCellWidth); -// const shadeH = Math.round(shadeRegion[3] * deviceCellHeight); - -// for (let py = 0; py < shadeH; py++) { -// const absY = shadeY + py - yOffset; -// for (let px = 0; px < shadeW; px++) { -// const absX = shadeX + px - xOffset; -// // Inverse checkerboard: fill at (x + y) % 2 === 1 -// if (((absX + absY) % 2) === 1) { -// ctx.fillRect(shadeX + px, shadeY + py, 1, 1); -// } -// } -// } -// } - /** * Draws the following box drawing characters by mapping a subset of SVG d attribute instructions to * canvas draw calls.