ryanoasis / nerd-fonts

Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
https://NerdFonts.com
Other
54.08k stars 3.63k forks source link

Thin vertical blue line on my prompt #156

Closed RiccardoMPesce closed 1 year ago

RiccardoMPesce commented 7 years ago

Hello, I am using Oh My Zsh theme PowerLevel9k with nerd-fonts. I use Gnome-Terminal, on Antergos (which is Arch Linux). As my font, I both have patched with the font-patcher-py3 the following:

Droid Sans Mono for Powerline Nerd Font Complete.otf Droid Sans Mono Nerd Font Complete.otf

The first one is the src/ font patched, while the second one is a vanilla patched. Using both them gives the same effect.

This is the effect I get (the vertical blue line after the prompt), after changing the background color to that gray. problem Not only with this font, but with all the nerd fonts.

Here it is my .zshrc file:


# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
  export ZSH=/home/riccardo/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel9k/powerlevel9k"

POWERLEVEL9K_MODE='nerdfont-complete'

DEFAULT_USER="riccardo"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
POWERLEVEL9K_DISABLE_RPROMPT=true
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=false
POWERLEVEL9K_DIR_HOME_BACKGROUND='251'
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND='251'
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='251'
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND='236'
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND='236'
POWERLEVEL9K_DIR_HOME_FOREGROUND='236'

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(sudo, archlinux, bundler, docker, gem, gitfast, git-extras, git-flow, git-flow-avh, git-hubflow, git-remote-branch, github, pip, python, repo, sublime, vi-mode, brew, rvm, rails, git, npm, rake, ruby, zsh-completions)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# source /usr/share/nvm/init-nvm.sh

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

DISABLE_UPDATE_PROMPT=true

zstyle ':completion:*' special-dirs true

export PATH="$HOME/.linuxbrew/bin:$PATH"

If I remove all the POWERLINE9K_..._BACKGROUND, the default background is blue.

How do I solve it? Thanks.

agriffis commented 7 years ago

I had a similar problem with Deja Vu Sans Mono on gnome-terminal. It improved for me when I switched to the "Mono" variant. What happens if you patch with --mono?

(I think @ryanoasis is also working on fixing these problems in the non-mono variants, but his work on that isn't finished yet.)

RiccardoMPesce commented 7 years ago

Patching it with ./font-patcher-py3 -c --mono -ext otf -out ~/.local/share/fonts/NerdFonts src/unpatched-fonts/DroidSansMono/Droid\ Sans\ Mono\ for\ Powerline.otf && fc-cache -fv keeps giving me the same issue.

ryanoasis commented 7 years ago

@RiccardoMPesce Ah you are using the py3 version of the patcher right? I haven't updated that yet.

You did pull the latest of master ?

Anyway here are the results of Droid for me:

before fix:

selection_038

after fix:

selection_039

Let me update the py3 version and you can retry :smile:

RiccardoMPesce commented 7 years ago

@ryanoasis thanks for the effort. Unfortunately, the blue vertical line persist. Can it be the fact that I am using otf instead of ttf?

EDIT. it is the same. However, the blue line is less noticeable.

ryanoasis commented 7 years ago

EDIT. it is the same. However, the blue line is less noticeable.

Well that is at least some good news. I was going to say maybe you needed to clear your font cache and close all terminals.. but it sounds like you are seeing a difference?


Also for me the powerline glyph was more appropriately vertically centered. Did you notice any change with that as well?

Also, would you mind posting an updated screenshot?

RiccardoMPesce commented 7 years ago

partially solved

As you can see in the directory line, the blue line is less noticeable. :) Glyphs are okay now, are centered and there is a better padding around them.

EDIT. Later I will try tweaking oh_my_zsh and powerlevel9k a bit, as the problem seems to be derived from the back that the standard background color of blue is a feature of oh_my_zsh. I will update this as soon as I get everything done.

EDIT 2. the command echo $color gives me this output

none normal bg-blue 31 bold no-standout bg-magenta faint no-underline bg-cyan standout no-blink bg-white underline 33 41 01 blink no-reverse bg-default 27 no-conceal reverse conceal 30 31 08 39 02 32 24 45 35 05 34 30 39 47 black 23 red green 43 yellow 36 blue magenta 37 cyan 03 white 44 35 default 40 28 07 46 04 33 37 40 22 34 42 00 30 30 25 49 bg-black 36 32 bg-red bg-green bg-yellow

Maybe this is what should be changed. How do I do it?

ryanoasis commented 7 years ago

@RiccardoMPesce Thanks for the updates. I'm unsure how to change those items in oh_my_zsh at the moment. We can look into this more...

fpaterno commented 7 years ago

Problem is the same here with Adobe Source Code Pro font and the last version of patcher :

bug

Do you have any solution for this problem ?

LuRsT commented 6 years ago

@RiccardoMPesce did you manage to solve this? How?

@fpaterno Could you please open a seperate issue if you have the same problem detailing your terminal config please?

Thraka commented 6 years ago

I'm getting this same issue on pretty much all the fonts used in windows. Its really gross looking :(

fabius85 commented 5 years ago

I have the same issue with Inconsolata Nerd Font and i made some tests. Screenshots posted below are taken with bash shell, but same thing occurs with zsh so it's shell indipendent (in some previous posts it was suggested that the issue may occur because of zsh or oh-my-zsh, but that's not the cause). Also i tested with two different terminal emulators: st and xterm With Inconsolata for Powerline (link) everything is smooth as it should be (screenshot 3 and 6), so the issue must be with Nerd Font patch. Inconsolata for Powerline NOTE: Screenshots taken inside tmux, but behavior is the same outside of it.

  1. Problem occurs on st with Inconsolata Nerd Font st -f "Inconsolata Nerd Font:pixelsize=30" 01_ZcsWUL3

  2. Same on st with Inconsolata Nerd Font Mono st -f "Inconsolata Nerd Font Mono:pixelsize=30" 06_iwRE01S

  3. No problems with Inconsolata for Powerline (not Nerd Font) st -f "Inconsolata for Powerline:pixelsize=30" 04_1VwrS0b

  4. Even worse on xterm with Inconsolata Nerd Font (1px bottom right gaps) xterm -fa "Inconsolata Nerd Font:pixelsize=30" 03_Cxevo9m

  5. Even worse on xterm with Inconsolata Nerd Font Mono (2px bottom right gaps) xterm -fa "Inconsolata Nerd Font Mono:pixelsize=30" 05_rF02NeW

  6. No issues with on xterm with Inconsolata for Powerline xterm -fa "Inconsolata for Powerline:pixelsize=30" 02_gCQPypf

So i checked the glyphs and they look a bit different: Inconsolata for Powerline: 07_sZ2JYrv Inconsolata Nerd Font Mono: 08_lfSeq4S And that might be the cause.

EDIT Can confirm the issue is with the glyphs in Nerd Font patch. With FontForge i exported powerline glyphs from Inconsolata for Powerline and imported them to Inconsolata Nerd Font Mono and everything is working fine.

dfokin commented 4 years ago

The line appears because of subpixel antialiasing. Check this setting in .Xresources: Xft.rgba Line appears if it is set to "rgb" and disappears if value is set to "vrgb" xrdb -query | grep Xft.rgba Xft.rgba: vrgb

austinorth commented 4 years ago

I'm running on Ubuntu MATE with GNOME Terminal, and I tried @dfokin 's fix, but it didn't work. What I ended up doing is switching to https://github.com/powerline/fonts/tree/master/Hack for my font. Works like a dream.

areguera commented 4 years ago

I am presenting this issue as well with nerd-fonts last version (commit 5f748cdb104a241ec8ac229f24518f3f867e8eb2) from master branch and "SauceCodePro Nerd Font Mono Medium", 12px:

image image

in more detail:

image image

I did the git pull, then run the install.sh script, reboot the system and the vertical line still persists.

I am using Fedora 32 with gnome-terminal 3.36.1.1 and the following configuration:

image

The antialiasing in GNOME Tweaks 3.34.0 is the following:

image

Appreciate any help to get this fixed.

Thanks.

areguera commented 4 years ago

Once I uninstalled packages from https://github.com/silenc3r/fedora-better-fonts the glyphs started to look better on the terminal. The left-side arrows look good now. The right-side one is still showing the vertical line on it:

image

areguera commented 4 years ago

and changing the terminal font size from 12 to 11, fixed completely: image

buckley310 commented 2 years ago

I've been fighting the vertical line issue for a while. I finally ended up cheating and just editing the powerline character and extending it to the left so it overlaps the preceding character. I haven't seen this suggested anywhere else. It wouldn't work for everyone, but with my setup it's perfect since the preceding character is always a space of the same color.

FWIW, I personally wouldn't want to disable subpixel antialiasing, because it's there to make fonts look better, but it seems like there's no silver bullet here so everyone just has to pick the best solution for them. :shrug:

I would probably recommend against changing antialiasing to VRGB unless your monitor is actually VRGB though. Greyscale antialiasing should look better than incorrectly configured RGB antialiasing.

postprocess script:

import fontforge, sys, os
f = fontforge.open(sys.argv[1])
glyph = f[0xE0B0]
bb = glyph.boundingBox()
pen = glyph.glyphPen(replace=False)
pen.moveTo(bb[0],bb[1])
pen.lineTo(bb[0],bb[3])
pen.lineTo(bb[0]-150,bb[3])
pen.lineTo(bb[0]-150,bb[1])
pen.closePath()
os.unlink(sys.argv[1])
f.generate(sys.argv[1])

prompt (Dejavu Sans Mono 12pt): image powerline glyph: image

m-bartlett commented 1 year ago

https://github.com/ryanoasis/nerd-fonts/issues/156#issuecomment-602170101

Thank you! This was what fixed it for me. I was spending hours fussing with fontforge, and even considered doing exactly what the post above is showing (extending the triangle with a small block).

Using rgba produced slightly better results in my opinion compared to vrgb, but the blue lines do indeed appear when set to rgb.

Here is a table of how each setting renders for me if it's of use to anyone having this issue, I'm using st with wideglyph and font2 patches. rgb vrgb rgba
20221013-095644 20221013-095519 20221013-095621

Notice how vrgb has a lot more noisy subpixel red/blue compared to rgba.

PS I used xzoom to magnify my terminal for these screenshots, it was very handy for visualizing this issue.

Finii commented 1 year ago

There is also

but I'm not sure we should go that route, especially because different terminal emulators handle 'overhanging' glyphs differently and might just scale the 'overhang' away. A lot very(?) widespread ones allow specifically no left side bearing (overhang to the left) kitty, Windows Terminal, alacritty, iirc...

The aliasing on the other hand, usually universally works; but some terminals have their own antialias-setting apart from the system's :roll_eyes:

Edit: 780 works especially good with terminals that support fully proportional fonts, like tilix

Finii commented 1 year ago

If you see a line an the right-pointing-trianguar thing but not on the left-pointing one, ... there was a bug in the patcher that could result in exactly that, iirc. maybe we should investigate 780 further. I stopped work in that to pursue other problems :grimacing:

Description is in the commit message of https://github.com/ryanoasis/nerd-fonts/pull/780/commits/f528ffb2998a610fe0cc484ec224dd0ddbf7f7ad

Finii commented 1 year ago

Just noticed the 'real repair' commits have been merged already (within #764), so since v2.2.2 the negative bearing should work.

image

If you still see lines only on right pointing things and not on left pointing things that will most probably be a terminal issue that does not allow left bearings (overlap).

(Not that I see the non-Mono glyph (right), WHY does it extend over the right side border?)

buckley310 commented 1 year ago

The issue is gone for me on v2.2.2 :partying_face: I've removed my patches and it still looks good.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference.