Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
Fixes naming collision issue on Fedora 26.
|
|
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.
|
|
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 .
|
|
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.
|
|
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.
|
|
|
|
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);
}
|
|
Each Fc type is split into a separate file. This organization will help
as features are added to the bindings.
|
|
Because there are so many clippy warnings in the current codebase,
this commit removes '#![cfg_attr(feature = "clippy", deny(clippy))]',
to make it easier to fix warnings incrementally.
|
|
This silences a couple of compiler warnings in the build.
|
|
|
|
We had previously vendored a very early version of this package before
it was ever published.
|
|
Previously, the fallback symbol font copied the style of the font from
the config. However, the only available style for the fallback symbol
font is Normal slant, Normal weight.
|
|
|
|
|
|
|
|
|
|
|
|
As it turns out, FreeType does not always provide glyph data in LCD mode
as we requested. We now correctly handle several common modes returned
from FreeType including Lcd, Mono, and Gray.
Note that we don't check number of grays at this time since it's
1. Almost always 256, according to FreeType docs
2. Not available in the Rust FreeType bindings being used
Resolves #515
Resolves #185
Resolves #482
|
|
|
|
Descent was being reported as a positive value instead of negative. This
caused the background and text alignment to be off dramatically.
Resolves #545
|
|
We previously had a hard-coded value for aligning glyphs within cells.
The font descent is now used, and the offset should be correct by
default.
|
|
The changes to metric consumption rendered the size argument
unnecessary, remove it.
|
|
The font metrics function was using freetype metrics in an ineffective
way, improve the use of those metrics and remove the now unnecessary
separate default values for font offset in linux.
|
|
|
|
|
|
|
|
|
|
This is done in order to help prevent us from loading the same
font face over and over again under separate keys. We still incur
the performance hit of doing the fontconfig search each new glyph,
but that's unavoidable without more extensive refactoring.
|
|
|
|
The lifetime constraints didn't do what I thought, and such constraints
turn out to be unnecessary anyhow.
|
|
|
|
|
|
Loading a glyph from the cache is a very hot operation in the renderer.
The original implementation would first check if a glyph was loaded and
then call `get()` which would have to search a second time. This showed
up as a very slow point in profiles.
This patch addresses glyph cache access in two ways: by using a faster
hasher optimized for small keys (fnv), and by using the entry API for
fetching a cached glyph. The `fnv` hasher is faster than the default and
is very efficient for small keys. Using the entry API on the HashMap
means only 1 lookup instead of two. The entry API has a downside where
the key needs to get cloned on fetches.
Reducing the GlyphKey width to 64-bits helps in both areas. Copying an
8-byte wide type is very cheap and thus limits downside of the entry
API. The small width also helps with the hasher performance.
Over all, this patch reduced typical render times by several hundred
microseconds on a 2013 MacBook Pro with a full screen terminal full of
text.
|
|
|
|
as per https://github.com/jwilm/alacritty/issues/39
|
|
Makes thin stroke rendering for darwin configurable by a new toplevel
key under `font:` in the config file. Defaults to false, has no impact
on non macos.
|
|
This work started because we wanted to be able to simply say "monospace"
on Linux and have it give us some sort of font. The config format for
fonts changed to accomodate this new paradigm. As a result, italic and
bold can have different families from the normal (roman) face.
The fontconfig based font resolution probably works a lot better than
the CoreText version at this point. With CoreText, we simply iterate
over fonts and check it they match the requested properties. What's
worse is that the CoreText version requires a valid family. With
fontconfig, it will just provide the closest matching thing and use it
(unless a specific style is requested).
|
|
This allows consumers of the font crate to handle errors instead of the
library panicking.
|
|
This cleans up and fixes the C-type wrapping for fontconfig.
|
|
There's now a proper wrapper in place for working with the FontConfig
library. This should help significantly with error handling with font
loading; at least, the FontConfig code shouldn't panic. The FreeType
rasterizer still needs to be updated to handle missing fonts, and a more
sensible default font should be specified.
|
|
|