1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-21 04:11:44 +03:00
Commit Graph

49 Commits

Author SHA1 Message Date
Wez Furlong
3026d0fa16 refactor scaling changed 2019-02-23 23:10:40 -08:00
Wez Furlong
aa9942e6d4 spawned windows no longer inherit scaling
On hidpi displays we'd end up with a window twice the size; whoops!
2019-02-23 17:11:23 -08:00
Wez Furlong
9bc54da406 use Rc<FontSystem> rather than Box
This will help with an upcoming change
2019-02-23 17:05:46 -08:00
Wez Furlong
332b0faeaa CoreText renderer is now the default on macOS
I've added dingbats to the fallback list on macos as that is needed
for some symbols we use in tools at work.

With that, and some tweaks for allowing for missing letter glyphs
when loading a symbol font as a fallback, we can make that the
default for macOS

Closes https://github.com/wez/wezterm/issues/5
2019-02-22 15:51:36 -08:00
Wez Furlong
89da009dce Adjust for high dpi displays with the glutin backend
This results in a less blurry display.
As a bonus, this lays down some plumbing for changing the font
size on the fly.

Refs: https://github.com/wez/wezterm/issues/2
2019-02-22 15:22:27 -08:00
Wez Furlong
7e2e48dadc add default metrics accessor to FontConfiguration struct 2019-02-22 15:21:07 -08:00
Wez Furlong
97096ffc5d implement coretext font rendering
This uses harfbuzz for shaping and thus can render both emoji and
ligatures

Refs: https://github.com/wez/wezterm/issues/5
2019-02-22 15:21:04 -08:00
Wez Furlong
9fa376d2a3 Add command line override for font system 2019-02-20 09:01:36 -08:00
Wez Furlong
6ffe4a3044 prefer freetype over rusttype 2019-02-18 23:31:22 -08:00
Wez Furlong
03f6f1272b fixup macos compilation 2019-02-18 22:22:43 -08:00
Wez Furlong
3dfaf7111f allow runtime selection of font loader/renderer
This cleans up the rats nest of conditional build bits
and allows easier testing and comparison of the systems.
2019-02-18 22:02:31 -08:00
Wez Furlong
79fb3e206b use fontload + freetype on windows 2019-02-18 21:09:54 -08:00
Wez Furlong
1039e013c1 extract fontloader loader from fontloader_and_rusttype 2019-02-18 13:28:25 -08:00
Wez Furlong
9de24a75ed split rusttype font from fontloader 2019-02-18 13:13:36 -08:00
Wez Furlong
ad55946f07 extract freetype font impl to its own module 2019-02-18 12:52:31 -08:00
Wez Furlong
ad41cecd6e make harfbuzz dep optional 2019-02-17 12:55:02 -08:00
Wez Furlong
f976ca6e23 add rusttype rasterizer 2019-02-16 21:29:04 -08:00
Wez Furlong
12e2dcd181 add incomplete shaping plumbing 2019-02-16 17:12:54 -08:00
Wez Furlong
a4e1bd827e start integrating rusttype and font_loader for windows 2019-02-16 16:15:39 -08:00
Wez Furlong
434c1a1664 wezterm.exe now links, but is missing lots of impl 2019-02-16 15:21:28 -08:00
Wez Furlong
ada197f94e don't panic if we get confused by text char boundaries
This triggered for me when grepping a file containing various
foreign language translations (non UTF-8).
2018-10-21 14:45:26 -07:00
Wez Furlong
efb9acdc84 don't error out if we can't find a glyph
Could repro the issue with this little python script:

```
print(u"\ua123HELLO")
```
2018-08-04 15:06:16 -07:00
Wez Furlong
d73892a4fd update for recent rustfmt changes
No functional changes
2018-04-11 13:15:12 -07:00
Wez Furlong
f7a567b847 share a reference to the config 2018-03-03 16:42:46 -08:00
Wez Furlong
f1db5dac40 clippy 2018-03-03 13:00:56 -08:00
Wez Furlong
9673c8c1b7 roll back bundling of harfbuzz
This will likely break travis; I'll follow up with something to help with that.

Refs: https://github.com/wez/wezterm/issues/1
2018-02-22 21:07:17 -08:00
Wez Furlong
c39dbdc356 stubs for macos font loading 2018-02-20 22:33:09 -08:00
Wez Furlong
a7f2757452 rustfmt update 2018-02-20 22:08:19 -08:00
Wez Furlong
e9e3e47b94 make fontconfig/freetype conditional 2018-02-20 20:55:03 -08:00
Wez Furlong
999396bc45 separate out the fontconfig/freetype code 2018-02-20 20:20:37 -08:00
Wez Furlong
dd4c9d6683 refactor the font loading code
This is the first step towards making this code more system independent.
2018-02-20 19:53:50 -08:00
Wez Furlong
5a99dd143c move hbwrap into harfbuzz crate 2018-02-20 14:32:28 -08:00
Wez Furlong
4818cdb838 improve font rendering by reducing hinting level
and using a more robust color multiplication function.
2018-02-18 20:30:53 -08:00
Wez Furlong
220e73e528 clean up more of the rendering
We can now render bg colors, selection, cursor, and the text has
reasonable proportions, and coloring.

bright cyan on blue has some black AA artifacts that I need to
investigate.
2018-02-17 11:53:54 -08:00
Wez Furlong
b6aa2cffea make hyperlinks show underlined on hover
Adds some plumbing to track the current mouse position and
extract the hyperlink from the cell that is being hovered over.

We render those cells with underline, possibly in a different color.

We don't yet do anything on click.
2018-02-11 12:11:02 -08:00
Wez Furlong
4ce67c7f9a Use the palette crate for blending
I wasn't pleased with how text was rendering on a colored background,
and after some research I discovered that I was neglecting to convert
from sRGB to a linear RGB colorspace, and that this was causing the
blending to have inaccurate results.

This diff pulls in the palette crate to handle the heavy lifting.
It doesn't appear to have any especially fast optimizations for this
though, which is a shame because the blending code I was using
previously was largely integer math with few branches.  The colorspace
conversion has several floating point operations and branches that
are unavoidable :-/

We run a bit hotter on the CPU but the results are much more pleasing
to the eye.
2018-02-09 23:32:35 -08:00
Wez Furlong
edd5911535 Add a small font styling engine
This enables selecting an italic font when the cell is italic,
but has more power beyond just that simple property.

This runs a little hot on the CPU so there's probably some caching and
tweaking that can be done to make the evaluation a bit cheaper.
2018-02-07 09:23:24 -08:00
Wez Furlong
4c8e3ffd75 improve clustering and cursor rendering
We weren't quite right with handling the cursor around double-width
characters.  We're now a bit more robust at this because we're
clustering and taking pains to consider the printable width of the
cell as well as the width of the shaped (eg: with contextual ligatures)
glyph.

There may still be issues with contextual ligatures of length 3,
but I haven't managed to nail down exactly the issue yet.
2018-02-04 08:28:32 -08:00
Wez Furlong
36a884b872 Add compositing to colorize text
Defines a couple of compositing operators so that we can support having
both colored background and colored text.
2018-01-22 22:32:48 -08:00
Wez Furlong
fb53f2c16b remove cairo dependency
It's a PITA to make it work with pixels without scaling and blurring
2018-01-22 18:54:18 -08:00
Wez Furlong
3ea7bbc501 compute descender, render cell box, fixup GRAY handling 2018-01-22 08:13:00 -08:00
Wez Furlong
31f35554a4 Add text color, improve resize render performance 2018-01-21 17:14:56 -08:00
Wez Furlong
306414baa9 Add double buffering to eliminate flicker
Actually, the flicker was caused by the back pixel setting on the
window; I spent a long time running this down and finally got the
clue from this crusade against flicker:
http://www.ruska.it/michal/flicker.html
2018-01-21 10:25:40 -08:00
Wez Furlong
aa18b273f9 remove sdl. use cairo + xcb
The spacing between glyphs seems too wide.  Need to figure this out.
A bunch of the integer vs float changes in this diff were a result
of trying to run this down, but success has been limited, and in fact
the spacing has increased as a result of making this more correct(!)
2018-01-21 01:32:59 -08:00
Wez Furlong
144d8cc3eb start pulling in cairo 2018-01-18 07:20:29 -08:00
Wez Furlong
df64bce18a add some docs, make slightly more efficient when computing cluster size vec 2018-01-17 00:17:22 -08:00
Wez Furlong
93c10590ca println -> debug build only logging 2018-01-17 00:07:31 -08:00
Wez Furlong
06b47bfc58 move FontHolder -> Font
Also change the constructor to pass in a fontconfig pattern
2018-01-17 00:01:34 -08:00
Wez Furlong
79bf022f68 move font code into main source
Initially I wanted to make the font code separate from
the main wterm executable in the hope that it would be
reusable.  However, we do need to be able to reach in
to both the font implementation and the SDL texture
implementation in order to capture the glyph data
into textures, so let's just embrace it all being
in the same crate.
2018-01-16 23:32:23 -08:00