Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Support variable width fonts - #254

Merged
nathansobo merged 10 commits into
devfrom
var-width-fonts
Feb 13, 2013
Merged

nathansobo merged 10 commits into
devfrom
var-width-fonts

Conversation

@nathansobo

Copy link
Copy Markdown
Contributor

The new atom-light-syntax theme makes use of bold, and since not all fixed-width fonts have the same width for bold and non-bold characters, this really forces our hand to support this.

  • make sure the whole build passes
  • investigate performance implications
  • optimize if necessary

variable-width

@kevinsawicki

Copy link
Copy Markdown
Contributor

⛅ Awesome! Papyrus really does sample.js justice. ⛅

@nathansobo

Copy link
Copy Markdown
Contributor Author

I'm never going back.

@jonrohan

Copy link
Copy Markdown
Contributor

Nathan Sobo added 10 commits February 12, 2013 17:07
When translating a logical screen position (columns/rows) to a pixel
position, the editor now builds a temporary version of the line for the
given row. It then uses the DOM range API to insert an empty range
at the correct text node and offset for the given column and determines
the left position based on its clientRect.

Depending on the speed impact, we may want to optimize this by
recycling the existing line node if it exists on screen rather than
building a new one every time. We will still have to build one if the
line we're moving to isn't on screen yet. We could also increase the
chances of the line being on screen by autoscrolling to the vertical
position first, and *then* calculating the horizontal position. Lots
to explore here.
When the font size changes and the editor is detached, it schedules
itself to be redrawn the next time we're reattached rather than
updating the display in a detached state.

Detached display updates worked in the past because we didn't need to
be on the DOM to determine horizontal and vertical positions once we
had calculated dimensions once. So it worked to temporarily attach
the editor when calculating new dimensions, and then continue updates
even when it was detached. That now breaks because we can't ask for
pixel positions if we aren't on the DOM.
This prevents the editor from synchronously redrawing in specs with
cursors in invalid locations. Markers are always updated under the
hood before a change event is emitted from the Buffer or DisplayBuffer.
We still wait to trigger marker observers, but if their position gets
read, it is up to date.
@nathansobo

Copy link
Copy Markdown
Contributor Author

This should close #132
/cc @cobyism

@nathansobo
nathansobo merged commit e7fb130 into dev Feb 13, 2013
@nathansobo
nathansobo deleted the var-width-fonts branch February 13, 2013 03:36
@cobyism

cobyism commented Feb 13, 2013

Copy link
Copy Markdown
Contributor

Oh snap! You guys rock!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants