summaryrefslogtreecommitdiffstats
path: root/font
AgeCommit message (Collapse)Author
2018-12-22Add proper underline and strikeout supportChristian Duerr
This makes use of the new rectangle rendering methods used to display the colored visual bell to add proper underline and strikeout support to Alacritty.
2018-12-10Upgrade to Rust 2018Joe Wilm
This resolves a lot of NLL issues, however full NLL will be necessary to handle a couple of remaining issues.
2018-12-07Use tool lints for clippy allow/deny lint attributesMatthias Krüger
2018-11-14Update all dependenciesChristian Duerr
This applies all breaking and non-breaking dependency updates.
2018-11-10Upgrade Glutin to v0.19.0Matt Keeler
Some changes include: • Use the with_hardware_acceleration function on the ContextBuilder to not require the discrete GPU • Remove the LMenu and RMenu virtual key codes (winit 0.16.0 removed these because Windows now generates LAlt and RAlt instead • Replace set_cursor_state with hide_cursor (winit 0.16.0 removed the set_cursor_state function) • Replace GlWindow::hidpi_factor with GlWindow::get_hidpi_factor and change to expecting an f64 • Use the glutin/winit dpi size and position types where possible Glutin's dpi change event has been implemented. All size events now return logical sizes. As a result of that, the logical sizes are translated in the `display::handle_rezize` method so DPI scaling works correctly. When the DPI is changed, the glyph cache is updated to make use of the correct font size again. Moving a window to a different screen which is a different DPI caused a racing condition where the logical size of the event was sent to the `handle_resize` method in `src/display.rs`, however if there was a DPI change event before `handle_resize` is able to process this message, it would incorrectly use the new DPI to scale the resize event. To solve this issue instead of sending the logical size to the `handle_resize` method and then converting it to a physical size in there, the `LogicalSize` of the resize event is transformed into a `PhysicalSize` as soon as it's received. This fixes potential racing conditions since all events are processed in order. The padding has been changed so it's also scaled by DPR. The `scale_with_dpi` config option has been removed. If it's not present a warning will be emitted. The `winit` dependency on Windows has been removed. All interactions with winit in Alacritty are handled through glutin.
2018-11-04Fix clippy issuesChristian Duerr
This resolves all existing clippy issues and removes some old `allow` annotations which aren't neccesary anymore.
2018-10-20Add support for rendering cursors to rusttypeZac Pullar-Strecker
2018-10-16Add support for Windows (#1374)Zac Pullar-Strecker
Initial support for Windows is implemented using the winpty translation layer. Clipboard support for Windows is provided through the `clipboard` crate, and font rasterization is provided by RustType. The tty.rs file has been split into OS-specific files to separate standard pty handling from the winpty implementation. Several binary components are fetched via build script on windows including libclang and winpty. These could be integrated more directly in the future either by building those dependencies as part of the Alacritty build process or by leveraging git lfs to store the artifacts. Fixes #28.
2018-09-30Bump fontconfig dependenciesJon Gjengset
The patch uses the Cargo.toml patch section to force a single downstream choice of freetype-sys instead of relying on forks of other crates. It also bumps the fontconfig/freetype dependencies in the process.
2018-09-19Update core-* dependenciesJeff Muizelaar
The core-* dependencies have been updated and every breaking change has been resolved. These are the main changes which required adaption: - font_path() returns a PathBuf now - get_descriptors() returns an Option<CFArray> - get_advances_for_glyphs and get_glyphs_for_characters are now unsafe. All packages which did not have breaking updates have also been updated.
2018-09-17Fix style issuesMatthias Krüger
2018-07-25Fix clippy lints and run font tests on travisMatthias Krüger
This fixes some existing clippy issues and runs the `font` tests through travis. Testing of copypasta crate was omitted due to problens when running on headless travis-ci environment (x11 clipboard would fail).
2018-07-21Add support for LCD-V pixel modeyshui
2018-07-02Enable clippy in font/copypasta cratesMatthias Krüger
Enabled clippy in the sub-crates font and copypasta. All issues that were discovered by this change have also been fixed.
2018-07-01Fix clippy issuesChristian Duerr
2018-06-17Move to cargo clippyChristian Duerr
Using clippy as a library has been deprecated, instead the `cargo clippy` command should be used instead. To comply with this change clippy has been removed from the `Cargo.toml` and is now installed with cargo when building in CI. This has also lead to a few new clippy issues to show up, this includes everything in the `font` subdirectory. This has been fixed and `font` should now be covered by clippy CI too. This also upgrades all dependencies, as a result this fixes #1341 and this fixes #1344.
2018-02-28Upgrade dependenciesSam Rijs
Upgrading glutin to the latest version allows building alacritty even with old XRandr versions. This is relevant for Debian machines (and other ancient systems).
2018-02-07fix fallbacks in macos (#1099)Joe Moon
fixes #1086
2018-01-31Update core-text (#1061)Jeff Muizelaar
This cleans up a bunch of code.
2018-01-26Update dependenciesgolem131
Updated the version of some dependencies. This also changes to a new clippy version so clippy can work with the latest nightly compiler again. Some issues created by new lints have been fixed.
2018-01-21Better character cell width with FreeType (#1029)Rachel K
This should fix #1020, #710, and #902
2018-01-05Prevent font_size_modifier from sinking too low (#994)Christian Duerr
This replaces the `font_size_modifier` stored on the `Term` struct with a `font_size` field. With this change it is not necessary anymore to calculate the new font size from a delta but the current font size is always stored directly on the `Term` struct. As a result of this it is now possible to increase the font size by more than 127 steps at runtime. It also limits the minimum font size to 1, so issues with the `font_size_modifier` dropping far below font size 1 are resolved with this change. This fixes #955.
2017-12-24Move custom cursor block on ftChristian Dürr
Moved the custom cursor block on ft to the top, so no unnecessary operations are executed when trying to draw a custom cursor glyph.
2017-12-24Use font_key provided with cursor glyphsChristian Dürr
Previously it was assumed that the font_key for the normal font is always 0, because this assumption was a bit of a stretch, now the font_key provided with the glyph is used. This is always the bold, italics or normal font associated with the cell.
2017-12-24Fix linux symbol sizeChristian Duerr
With linux every box, line or underline should now have the pixel-perfect size with any font at any size. This uses the default font to get the size of the monospace box. It assumes that the face 0 is always the primary font, if this is not the case, this will probably break.
2017-12-24Add box cursor to unfocused underline and beamChristian Duerr
Because some people have requested this change, the beam and underline cursors now also transform into an empty box when the terminal loses focus. Like this there is one unique symbol to indicate that a terminal is not currently focused.
2017-12-24Refactor darwin codeChristian Duerr
The ascent calculation on darwin was more complicated than it needed to be. By running a `.ceil()` instead of adding one, checking if it's 0, substracting if it is, and then flooring it, a few instructions could be shaved off.
2017-12-24Add custom box cursor for unfocused windowChristian Duerr
2017-12-24Format cursor code and add documentationChristian Duerr
As requested a few comments have been added to the darwin code. There also was an off by one error in the ascent calculation which has been corrected. The beam cursor width has also been tweaked to be slightly slimmer in general. All code added in this PR has also been run through the default rustfmt to make sure the formatting is okay.
2017-12-24Add custom cursors for macosChristian Duerr
The macos target now also supports the custom beam and underline cursors. The only thing left for this is now is testing and making sure it works with tiny fonts.
2017-12-24Add custom beam cursorChristian Duerr
In issue jwilm/asacritty#31 a few people complained about Beam cursor being weird with their fonts, so to make all cursors uniform in alacritty, a custom cursor has been added for the Beam too. The beam cursor's height is always the full height of the monospace font glyph bounding box. The width depends on the font size. It is calculated using the width of the cell and dividing it by two. The block is always aligned at the far-left of the cell. The implementation is identical to the one of the underline cursor, but it has been refactored so the glyphs are created in `lib.rs`, which can be used by darwin/macos to implement these features too. A small bug in the underline cursor has also been fixed, until now the width was just using the width of the unicode character. Now it should be using the full width of the monospace glyph bounding box with every font. Here are some screenshots for the Beam cursor: ![Small](https://u.teknik.io/v1QH3.png) ![Normal](https://u.teknik.io/RTlp2.png) ![Big](https://u.teknik.io/DLu2M.png) ![Huge](https://u.teknik.io/pSAFX.png)
2017-12-24Specify unicode code point explicitlyChristian Duerr
2017-12-24Update comment to reference proper characterChristian Duerr
The unicode character comment has been updated to correctly reference the character instead of commenting on the variable that might be that character.
2017-12-24Revert to old system for macosChristian Duerr
Because rendering with macos works differently, the old underline cursor is used for that. The cursor symbol has also been setup as a constant in the font project.
2017-12-24Add custom underline cursorChristian Duerr
As mentioned in jwilm/alacritty#931, it can be troublesome if a font has an underline symbol outside of the glyph's bounding box. This can lead to the underline disappearing at the bottom of the terminal. As a solution a symbol from the private use area was used as the character code for the underline symbol. Whenever this symbol is encountered, instead of rendering it, a custom block is rendered. In this implementation the block has the full character as width and sits flush with the bottom of the glyph's bounding box. The height is half the distance between the baseline and the bottom of the bounding box.
2017-12-23Update euclid to v16Chet Gurevitch
2017-12-23Update depsChet Gurevitch
2017-12-22Remove debug printJoe Wilm
2017-12-22Fix macOS fallbacks (#956)Joe Wilm
The cascade list is now generated from Menlo for all fonts. This doesn't feel correct to me, but it seems to give the expected behavior on macOS. One of the problems cited was that certain glyphs like ❯ would not be rendered with default cascade lists for some fonts.
2017-10-30fix some typos in commentsMartin Lindhe
2017-10-30config_subsitute(): fix typo by renaming to config_substitute()Martin Lindhe
2017-10-14Fix memory leak from font resizingJoe Wilm
The source of the leak was loading up multiple copies of the FT_face even when not necessary. Fonts are now appropriately cached for FreeType when going through the `Rasterize::load_font` API. Additionally, textures in the glyph cache are now reused. The result of this is that resizing to already loaded fonts is free from a memory consumption perspective.
2017-10-08Update servo-fontconfig-sys forkJoe Wilm
Fixes naming collision issue on Fedora 26.
2017-10-08Scale all fonts based on device-pixel-ratioJoe Wilm
Rather than use DPI from config, use device-pixel-ratio from winit. This is computed using the display DPI anyhow, so it should have the same effect.
2017-10-08Support bitmap fontsDan Aloni
To allow FontConfig to work with Bitmap font, we shall pass the size we are interested in, and account for the size returned in the font matching process. This is, because we cannot scale those fonts. FontConfig will return the closest match, and we take its returned pixel size back when we are rendering the glyphs. There's an oddity when call set_char_size in TrueType - we need to behave as if the DPI is 72. It is due to the following macro: #define FT_REQUEST_HEIGHT( req ) \ ( (req)->vertResolution \ ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \ : (req)->height ) Further work can allow for integer scaling of the largest bitmap font variant. Tested with Terminus PCF-type font under Linux. This addresses issue #582 .
2017-10-08FreeType rasterizer respects some fontconfigJoe Wilm
The FreeType rasterizer now reads settings like antialias, rgba, lcdfilter, and hintstyle and chooses FreeType settings accordingly. The result is that Alacritty fonts should look similar to the rest of the system.
2017-10-08Improve glyph rasterization performanceJoe Wilm
The hash map of key -> face was previouly cloned every time a glyph was rasterized. This refactored the rasterization path to be more borrowck friendly. Sadly, this implementation is not *that* clean, but once NLLs land, much of this can be cleaned up.
2017-10-08Remove unused macrosJoe Wilm
2017-10-08Extend and improve FcPattern bindingsJoe Wilm
The fontconfig `FcPattern` type is wrapped as `fc::Pattern` and `fc::Pattern` ref. All methods for accessing data on the pattern now return an `Iterator`. This API turns out to be much more ergonomic than providing an integer index. We also override the default `nth` implementation of `Iterator` on these accessors to allow random (incremental only) access. For instance, accessing `family` attributes from a pattern: let families = pattern.family(); let second = pattern.nth(1); Or printing available styles for style in pattern.style() { println!("style={}", style); }
2017-10-08Organize fontconfig wrappersJoe Wilm
Each Fc type is split into a separate file. This organization will help as features are added to the bindings.