profile
viewpoint

Ask questionshintfull setting is not respected

I've configured hintfull in fontconfig:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintfull</const>
  </edit>
 </match>
</fontconfig>

This is recognized by alacritty. I've not disabled antialiasing for any font. Therefore alacritty uses the following code path:

https://github.com/alacritty/alacritty/blob/fde2424b398dadd2310686b365041189decd1d63/font/src/ft/mod.rs#L491

hintfull is not applied in this case.

Disabling antialiasing via fontconfig makes the font ragged in alacritty and other programs and is therefore not an option.

This problem is specific to alacritty. Hinting works as expected in all other programs I'm using.

The following patch fixes the problem:

diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index d393b63..76b0dc7 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -453,7 +453,7 @@ impl FreeTypeRasterizer {
     }
 
     fn ft_load_flags(pattern: &PatternRef) -> freetype::face::LoadFlag {
-        let antialias = pattern.antialias().next().unwrap_or(true);
+        let antialias = pattern.antialias().next().unwrap_or(false);
         let hinting = pattern.hintstyle().next().unwrap_or(fc::HintStyle::Slight);
         let rgba = pattern.rgba().next().unwrap_or(fc::Rgba::Unknown);
         let embedded_bitmaps = pattern.embeddedbitmap().next().unwrap_or(true);

Current master with antialiasing enabled: 2020-03-30-094447_412x159_scrot Current master with the patch applied and antialiasing enabled: 2020-03-30-094529_371x156_scrot Current master with antialiasing disabled: 2020-03-30-094617_345x151_scrot

alacritty/alacritty

Answer questions mahkoh

The previous patch is certainly not sufficient. It still has the desired effect on my laptop but does nothing on my desktop. Probably because I'm setting rgba to none on my desktop.

I'm now using the following patch:

diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index d393b63..f7a1a58 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -491,6 +491,7 @@ impl FreeTypeRasterizer {
             (true, _, fc::Rgba::Unknown) => LoadFlag::TARGET_NORMAL,
             (true, _, fc::Rgba::None) => LoadFlag::TARGET_NORMAL,
         };
+        flags = LoadFlag::TARGET_MONO;

         // Non scalable fonts only have bitmaps, so disabling them entirely is likely not a
         // desirable thing. Colored fonts aren't scalable, but also only have bitmaps.

With patch:

2020-07-01-230001_310x66_scrot

Without patch:

2020-07-01-230032_310x66_scrot

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List