-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add character dimensions API #702
Comments
Just did a bit of research into what we actually want here, this is what I came up with.
interface IDimensions {
width: number;
height: number;
}
export class Terminal {
dimensions: {
// dimensions.actualCellWidth/Height
cell: IDimensions;
// Convenience: container.width = cell.width*terminal.cols = dimensions.canvasWidth
// Generic language
container: IDimensions;
}
} My proposal to fix the export interface ITerminalOptions {
/**
* Specifying this option will use the container for the element that
* enabled character measurement. The idea is to provide a container that is
* always visible to host the _offscreen_ element such that even if you call
* Terminal.open on an element that is not yet visible on the page, it can
* still get character measurements and initialize the terminal. If you do
* not set this, Terminal.dimensions will not be available until shortly
* after Terminal.open is called. This element will not be removed when
* Terminal.dispose is called.
*
* NOTE: It's important that the CSS styles don't differ from that of the
* element that is passed to Terminal.open, otherwise the measurements could
* be off.
*
* NOTE: Setting this will also enable sharing of the character measurement
* element across multiple terminals. However, because of this it's not
* recommended to use the same measureContainer across multiple terminals
* that have differing font settings.
*/
measureContainer: HTMLElement;
}
|
We probably actually want to expose the dimensions on the renderer and eventually phase out |
To clarify, this should not expose char measure but rather the dimensions of a cell for the specific renderer. The dom renderer cells are < 1px larger than canvas/webgl since they always render on the a round integer x coord. See microsoft/vscode#87153 for more context. |
VS Code has it's own character measure implementation for example. @parisk thoughts?
Related: #696
The text was updated successfully, but these errors were encountered: