Correct shade rectangle rendering

This commit is contained in:
Daniel Imms
2025-12-22 12:09:41 -08:00
parent 5ae9ddf4b8
commit 0af884d379
2 changed files with 14 additions and 54 deletions
@@ -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 <reserved>
'\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
@@ -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.