@@ -3,6 +3,8 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { IDimensions, IOffset, IRenderDimensions } from 'browser/renderer/shared/Types';
|
||||
|
||||
export function throwIfFalsy<T>(value: T | undefined | null): T {
|
||||
if (!value) {
|
||||
throw new Error('value must not be falsy');
|
||||
@@ -28,3 +30,41 @@ function isBoxOrBlockGlyph(codepoint: number): boolean {
|
||||
export function excludeFromContrastRatioDemands(codepoint: number): boolean {
|
||||
return isPowerlineGlyph(codepoint) || isBoxOrBlockGlyph(codepoint);
|
||||
}
|
||||
|
||||
export function createRenderDimensions(): IRenderDimensions {
|
||||
return {
|
||||
css: {
|
||||
canvas: createDimension(),
|
||||
cell: createDimension()
|
||||
},
|
||||
device: {
|
||||
canvas: createDimension(),
|
||||
cell: createDimension(),
|
||||
char: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
left: 0,
|
||||
top: 0
|
||||
}
|
||||
},
|
||||
scaledCharWidth: 0,
|
||||
scaledCharHeight: 0,
|
||||
scaledCellWidth: 0,
|
||||
scaledCellHeight: 0,
|
||||
scaledCharLeft: 0,
|
||||
scaledCharTop: 0,
|
||||
scaledCanvasWidth: 0,
|
||||
scaledCanvasHeight: 0,
|
||||
canvasWidth: 0,
|
||||
canvasHeight: 0,
|
||||
actualCellWidth: 0,
|
||||
actualCellHeight: 0
|
||||
};
|
||||
}
|
||||
|
||||
function createDimension(): IDimensions {
|
||||
return {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user