-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1307 from bgw/split-char-atlas-files
Split CharAtlas types and utility functions off
- Loading branch information
Showing
8 changed files
with
89 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2017 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import { ITerminal } from '../../Types'; | ||
import { ITheme } from 'xterm'; | ||
import { IColorSet } from '../Types'; | ||
import { ICharAtlasConfig } from './Types'; | ||
|
||
export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig { | ||
const clonedColors = { | ||
foreground: colors.foreground, | ||
background: colors.background, | ||
cursor: null, | ||
cursorAccent: null, | ||
selection: null, | ||
ansi: colors.ansi.slice(0, 16) | ||
}; | ||
return { | ||
scaledCharWidth, | ||
scaledCharHeight, | ||
fontFamily: terminal.options.fontFamily, | ||
fontSize: terminal.options.fontSize, | ||
fontWeight: terminal.options.fontWeight, | ||
fontWeightBold: terminal.options.fontWeightBold, | ||
allowTransparency: terminal.options.allowTransparency, | ||
colors: clonedColors | ||
}; | ||
} | ||
|
||
export function configEquals(a: ICharAtlasConfig, b: ICharAtlasConfig): boolean { | ||
for (let i = 0; i < a.colors.ansi.length; i++) { | ||
if (a.colors.ansi[i] !== b.colors.ansi[i]) { | ||
return false; | ||
} | ||
} | ||
return a.fontFamily === b.fontFamily && | ||
a.fontSize === b.fontSize && | ||
a.fontWeight === b.fontWeight && | ||
a.fontWeightBold === b.fontWeightBold && | ||
a.allowTransparency === b.allowTransparency && | ||
a.scaledCharWidth === b.scaledCharWidth && | ||
a.scaledCharHeight === b.scaledCharHeight && | ||
a.colors.foreground === b.colors.foreground && | ||
a.colors.background === b.colors.background; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright (c) 2017 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import { FontWeight } from 'xterm'; | ||
import { IColorSet } from '../Types'; | ||
|
||
export const INVERTED_DEFAULT_COLOR = -1; | ||
export const DIM_OPACITY = 0.5; | ||
|
||
export interface ICharAtlasConfig { | ||
fontSize: number; | ||
fontFamily: string; | ||
fontWeight: FontWeight; | ||
fontWeightBold: FontWeight; | ||
scaledCharWidth: number; | ||
scaledCharHeight: number; | ||
allowTransparency: boolean; | ||
colors: IColorSet; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Copyright (c) 2017 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
export const CHAR_ATLAS_CELL_SPACING = 1; |