sdushantha / fontpreview Goto Github PK
View Code? Open in Web Editor NEWHighly customizable and minimal font previewer written in bash
License: MIT License
Highly customizable and minimal font previewer written in bash
License: MIT License
So far I have tried 3 image viewers:
macfeh
- Does not reload the image when the image gets altered. The normal feh
has an --auto-reload
option, but macfeh
doesnt, and it does not look it will be added if we ask for it because the developer has not been active for a really long time.
qlmanage
(Quick Look) - Does not reload the image when the image gets altered
Preview.app - Is able to reload the image using a small hack. But the down side of using preview is that it does not look minimal. It is possible to hide the tool bar and some of the junk, but I am not sure if it is possible to do so from the command line.
To change the focus from the image viewer back to the terminal, we can of course use Apple Script.
When opening a font with fontpreview
the window only has "sxiv" as the title. If multiple fonts are opened it becomes hard to keep track which fontpreview
window shows which font.
So including the proper name of the font in the preview window might better user experience.
on my system it displays the first font fine,
then after selecting the second it doesnt display anything.
any chance to fix? thank you @sdushantha
For me the font preview works only for one font. When I want to preview a second font I have to quit and restart the script.
Ubuntu 18.04
bash 4.4.20
Hello
this will not work for now:
./fontpreview -i /home/jd/Productions/B/BLionTaleFont/BLionTale-Regular.otf --preview-text "BONSOIR" -o a.png
expected: a.png shows a BONSOIR word
encountered: a.png contains the whole default alphabet
:)
I have really slow connection to github. As a result, I can only clone the repo at ~15KiBps. A single demo.gif takes up 5.93MB, which is larger than all other files combined (the repo weighs only 21KB after the removal).
Solution: use an image hosting service and embed the image in README.
Preview all font at once (with a custom text eg. using --preview-text
) in a list (one font per line).
Would make it easy to compare lot of fonts at once.
Hello,
Your fontpreview
shows only the systems fonts, then I want the fontpreview
to show other non-system font fonts to preview the fonts, for example:
fontpreview '/home/your_username/GitLab/fontes/Fontes de Apple e Microsoft/'
Hey,
I came to try the tool from Reddit (looked really nice and handy). Actually, the issue is that it can't find any fonts in my distribution (i.e. Pop! OS 18.04 LTS (uses Ubuntu as its base)).
Going through the code on line 105.
^^ I found out the command which finds the fonts and runs awk on the output. The issue lies in awk not being able to parse the output correctly.
After getting the fonts and running awk on it:
The actual script (fontpreview)'s output:
Appreciate you looking into it. Let me know if further details are required to resolve the issue.
Please implement a title in the font preview window, which should show the font name and style or the postscript name.
Fonts have often misleading names, sometimes still in the DOS 8.3 naming convention. For similar-looking fonts, it's not easy to see which font it really is if you don't see the real font name embedded in the font. Font names like bookosb.ttf
and bookosbi.ttf
don't tell much if you need a certain font, for example in LibreOffice which shows the real font names and not the file names.
fc-scan --format "%{fullname[$(( $(sed -E 's/^(.*)en.*/\1/;s/[^,]//g' <<<"$(fc-scan --format "%{fullnamelang}\n" /mnt/Fonts/bookosb.ttf)" | wc -c) -1 ))]}\n" /mnt/Fonts/bookosb.ttf
is a way to retrieve the font name wherever fontconfig
is installed, so practically everywhere on Linux. The complex line is necessary because a simple fc-scan --format "%{fullname}\n"
would return something like
Bookman Old Style Negreta,Bookman Old Style tučné,Bookman Old Style fed,Bookman Old Style Fett,Bookman Old Style Έντονα,Bookman Old Style Bold,Bookman Old Style Negrita,Bookman Old Style Lihavoitu,Bookman Old Style Gras,Bookman Old Style Félkövér,Bookman Old Style Grassetto,Bookman Old Style Vet,Bookman Old Style Halvfet,Bookman Old Style Pogrubiony,Bookman Old Style Negrito,Bookman Old Style Полужирный,Bookman Old Style Fet,Bookman Old Style Kalın,Bookman Old Style Krepko,Bookman Old Style Lodia
instead of just
Bookman Old Style Bold
Alternatively, fc-scan --format "%{postscriptname}\n"
is simpler, but returns
which needs to be parsed by the user to get the proper name for linux use.
Two points:
sxiv
, then fzf
gets confusedI got the first working in terminal, but not yet in fontpreview
.
The second will probalby need a review of opening/closing strategy.
Let me know :)
https://www.freshports.org/x11-fonts/fontpreview/
Thanks a lot for merging the patches I've submitted some time ago. It helped a lot with creating the port.
Relevant Arch Wiki page.
xfontsel -print
# ... pick a font with desired properties
-*-fira code-*-*-*-*-*-*-*-*-*-*-*-*
Programs that use it:
xosd
-based (such as osd_cat
, osd_clock
)In the PKGBUILD file on AUR
package() {
cd "$pkgname/"
make DEST="$pkgdir/" install
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/fontpreview/LICENSE.md"
}
The executable will be located at root /
by default which is probably not intended.
It would be cool if the program updated the font on the font preview window as you scrolled, without having to click the enter key
Hello,
I just want to inform you, that I started a reimplementation of fontpreview in Emacs Lisp,
because I often need fontnames for projects within Emacs. It's still in an early stage. Just
thought, you might want to know.
I gave you credits of course.
Sebastian Meisel
Every time I load a font, the window focus goes to the preview window and I have to click on the terminal to set focus back to the font selection.
Is it possible to make it retain focus on the font selection window (terminal)?
I'm sure not everything here is needed to reproduce but here is my current setup:
OS: Debian GNU/Linux 10 (buster) x86_64
Kernel: 4.19.0-6-amd64
DE: KDE
WM: KWin
WM Theme: Materia-Manjaro-Dark-Gradient
Theme: Breeze Dark [KDE], Breeze [GTK2/3]
Icons: Materia-Manjaro-Dark-2 [KDE], breeze [GTK2/3]
Terminal: konsole
I sometimes make projects that need fonts bundled. This requires me to find out where I installed my fonts to. The system font viewer isn't really helpful at this. So, I would really appreciate if the path of fonts was displayed after the fontnames given a flag such as --show-path
.
Hello :)
I am very busy at the moment with school related things and would like to focus more on that for some time. So, I was wondering if any of you, with some good knowledge with bash, would like to get push access to this repo so that you can merge PRs, and push edits to the repo and keep this project alive?
If you are interested, please do contact me by email (check my profile).
In opensuse, user must install 2 additional packages:
sudo zypper in fzf sxiv
and then works.
Hi!
I would be super nice if you could tag releases with git tag
. It makes it much easier to track development and package this nice tool for various package managers.
Thanks!
I just learned from @Krasjet that you can use überzug to display the font preview right on the terminal! Which is AWESOME!
I was thinking that we could use fzf
's preview window to display the font preview image. This means users wont have to press [ENTER], to view the font preview because fzf
automatically displays the content in the preview window just by highlighting it.
This would also fix the issues (#12) many users we having with xdotool
not working properly.
Also, using überzug would mean that everything would be in one window instead of having a separate window for the font preview.
@aeghn has made a PR(#13) to add keybindings to do certain action in fzf
. So if we do add the überzug image preview, we can then quickly remove the image to display the help menu in fzf
's preview window.
Let me know what you guys think!
PS. I cant work a lot on project for the next 2 weeks because I will be very busy, so if someone wants push access please do contact me :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.