Giter VIP home page Giter VIP logo

glyph-finder's Introduction

Glyph finder: Discovers Linux fonts that actually contain the characters you want

screenshot of fonts being filteredfurther filtering

Due to font fallbacks, it can be hard to find or compare fonts that cover characters you’re interested in. This is made worse by the way coverage tables often underpromise on actually having glyphs for all the characters.

This code was hacked in a day to help locate fonts. It’s made of 2 separate things:

  • A minimal library to find out fonts that fully cover a test string.
  • A minimal QT app to do that interactively, with font samples.

Install

apt install pyqt5-dev libfontconfig-dev python3-freetype

git clone https://github.com/ldo/python_fontconfig
cd python_fontconfig; sudo python3 setup.py install

git clone https://github.com/melissaboiko/glyph-finder
cd glyph-finder; sudo python3 setup.py install

(This is the only working fontconfig binding I could find. The ones in pip including Python_fontconfig don't install, and the setuptools function to automatically fetch a git repo is getting some sort of cache which doesn't work. Python!)

Usage

Command: glyph-viewer [your-query-string] .

You can experiment with the query in the UI. Press Enter to search fonts again. Click a font name to copy it to clipboard.

Library usage:

has_glyphs("/path/to/myfont.ttf", "ąǚæſ")
# True if the font has glyphs for all the characters in query string.

font_families = families_with_glyphs_for("ąǚæſ")
# list of strings describing font families

Acknowledgements

Thank you, unknown author of the ‘compare-fonts’ pango/gtk2/python2 snippet that I had in my conffile for years till the relevant libraries died. I used that code a lot, and it inspired this one.

glyph-finder's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.